tag:blogger.com,1999:blog-8499895524521663926.post8765882582219678036..comments2024-03-27T07:13:39.236-04:00Comments on Phylogenetic Tools for Comparative Biology: Upper triangle of a matrix to a vector by rowLiam Revellhttp://www.blogger.com/profile/04314686830842384151noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8499895524521663926.post-80358847439122909572016-09-19T17:09:14.279-04:002016-09-19T17:09:14.279-04:00Hmmm. This is a very old post. Must be the solutio...Hmmm. This is a very old post. Must be the solution for the number of elements in the upper diagonal of a square matrix of dimension m x m. In particular, x=m*(m-1)/2 solved for m.<br />Liam Revellhttps://www.blogger.com/profile/04314686830842384151noreply@blogger.comtag:blogger.com,1999:blog-8499895524521663926.post-34196103901979378412016-09-19T15:28:57.372-04:002016-09-19T15:28:57.372-04:00Hi
Could you please explain why m<-(-1+sqrt(1+8...Hi<br />Could you please explain why m<-(-1+sqrt(1+8*length(x)))/2<br />thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8499895524521663926.post-19332280143707083412015-06-30T12:21:43.016-04:002015-06-30T12:21:43.016-04:00Thank you so much for you post! I just need this!!...Thank you so much for you post! I just need this!!!Anonymoushttps://www.blogger.com/profile/02214189537085779723noreply@blogger.comtag:blogger.com,1999:blog-8499895524521663926.post-77510134624245005342013-06-28T18:19:35.939-04:002013-06-28T18:19:35.939-04:00Similarly, here's a function that puts a vecto...Similarly, here's a function that puts a vector into the upper diagonal of a matrix - by row:<br /><br />upper.diag<-function(x){<br /> m<-(-1+sqrt(1+8*length(x)))/2<br /> X<-lower.tri(matrix(NA,m,m),diag=TRUE)<br /> X[X==TRUE]<-x<br /> t(X)<br />}Liam Revellhttps://www.blogger.com/profile/04314686830842384151noreply@blogger.com