[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:
From: |
David Bateman |
Subject: |
Re: |
Date: |
Tue, 10 Apr 2007 09:52:13 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
mustafa yurtkolesi wrote:
> hi to you all
> is spcholinv
> <http://web.mit.edu/octave_v2.9.9/doc/interpreter/HTML/spcholinv.html#spcholinv>
> a
> well defined function for octave
> if so why evertime i enter spcholinv
> <http://web.mit.edu/octave_v2.9.9/doc/interpreter/HTML/spcholinv.html#spcholinv>
> octave
> says
> error: `spcholinv' undefined near line 8 column 1
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
What version of octave are you using. It will need to be 2.9.4 or later
to have spcholinv. spcholinv is dispatched on top of cholinv and so
calling cholinv instead is the recommended way to use it, so that full
matrices are treated correctly as well. Also note that cholinv was
introduced before the inv function recognized positive definite matrices
and treated them accordingly. Therefore, I personally consider cholinv,
chol2inv and their sparse counter parts to be obsoleted, by inv itself.
Finally, its a really really bad idea to try and form the inverse of a
sparse matrix. The inverse is almost invariably full, and so it
typically takes significant computational resources to form it. The only
reason to want a sparse inverse is that is the LU or cholesky
factorization is fairly sparse, then the number of computations needed
to form the inverse can be reduced. Consider the case
octave:9> N= 1024; A = randn(N,N); A = A*A' + N/10*eye(N); t0 =
cputime(); B = inv(A); cputime() - t0
ans = 4.2883
octave:10> N= 1024; A = randn(N,N); A = A*A' + N/10*eye(N); t0 =
cputime(); B = cholinv(A); cputime() - t0
ans = 4.2214
octave:11> N= 1024; d=0.02; A = sprandn(N,N,d); A = A*A' +
N/10*speye(N); t0 = cputime(); B = inv(A); cputime() - t0
ans = 14.081
octave:12> N= 1024; d=0.02; A = sprandn(N,N,d); A = A*A' +
N/10*speye(N); t0 = cputime(); B = spcholinv(A); cputime() - t0
ans = 13.854
Factorizations of random matrices are almost never sparse, and so as
expected the cholesky factorization of A is almost full and as the
sparse inverse is in fact slower than the full one. I'd expect the
reverse to be true for sparse matrices with some sort of structure. Also
note that "inv" is as fast as "cholinv"
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
- [no subject], mustafa yurtkolesi, 2007/04/09
- Re:, Geordie McBain, 2007/04/10
- Re:,
David Bateman <=
- Prev by Date:
Re:
- Next by Date:
Re:
- Previous by thread:
Re:
- Next by thread:
Re:
- Index(es):