[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
chol2inv for Octave?
From: |
Mike Miller |
Subject: |
chol2inv for Octave? |
Date: |
Thu, 5 May 2005 23:59:31 -0500 (CDT) |
A friend who uses R a lot was just showing me that to compute the inverse
of a symmetric positive-definite matrix, R has the function "chol2inv"
which takes the Cholesky upper triangle of the symmetric PD matrix as
input and returns the inverse of the symmetric PD matrix as output.
Thus, one may get the inverse of a symmetric PD matrix 'M' by doing this:
chol2inv(chol(M))
In R, this runs twice as fast as solve(M), which is R's command for
computing the inverse. Comparing R to Octave on the same machine and
using a 1000 x 1000 matrix M, I find that R's solve(M) is slower by about
25% than Octave's inv(M), but R's chol2inv(chol(M)) is much faster. In
fact, chol2inv(chol(M) in R is about as fast as inv(chol(M)) in Octave,
but R is computing the inverse of M and Octave is computing the inverse of
chol(M).
So I'm wondering why Octave doesn't have a chol2inv function! ;-)
Maybe it has one and I just can't find it.
Regards,
Mike
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- chol2inv for Octave?,
Mike Miller <=