> require(phytools)
> # simulate tree
> tree<-pbtree(n=2000)
> C<-vcv(tree)
> # using solve
> system.time(Cinv1<-solve(C))
user system elapsed
15.15 0.07 15.23
> system.time(Cinv2<-chol2inv(chol(C)))
user system elapsed
6.69 0.02 6.74
> mean(abs(Cinv2-Cinv1))
[1] 3.953766e-16
> # simulate tree
> tree<-pbtree(n=2000)
> C<-vcv(tree)
> # using solve
> system.time(Cinv1<-solve(C))
user system elapsed
15.15 0.07 15.23
> system.time(Cinv2<-chol2inv(chol(C)))
user system elapsed
6.69 0.02 6.74
> mean(abs(Cinv2-Cinv1))
[1] 3.953766e-16
That's faster.
No comments:
Post a Comment
Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.