help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Performance of chol() on sparse matrices


From: Andreas Stahel
Subject: Performance of chol() on sparse matrices
Date: Sat, 8 Nov 2008 16:00:00 +0100
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Dear Octave users

when testing code for a class a timing result on Octave 3.0.3 puzzled me.
generate a very sparse, symmetric, positive definite matrix Anxny (size 62500x62500) and time a few commands

x=Anxny\b  -> 0.8 sec
R=chol(Anxny) -> 7.3 sec
x=R\(R'\b)  -> 2.3 sec
[L,U,P]=splu(Anxny) -> 12 sec

I would expect the Cholesky back-substitution to be fastest and cho(Anxny) to be comparable to Anxny\b !!

Would you happen to have hints on why this occurs

With best regards

Andreas

=============code =============
nx=250; ny=250;
hx=1/(nx+1); hy=1/(ny+1);
Dxx=spdiags([-ones(nx,1) 2*ones(nx,1) -ones(nx,1)],[-1 0 1],nx,nx)/(hx^2);
Dyy=spdiags([-ones(ny,1) 2*ones(ny,1) -ones(ny,1)],[-1 0 1],ny,ny)/(hy^2);
Anxny=kron(speye(ny),Dxx) + kron(Dyy,speye(nx));

b=ones(nx*ny,1);
t0=cputime;
x2=Anxny\b;
SolveTime=cputime()-t0
t0=cputime;
R=chol(Anxny);
CholTime=cputime()-t0
t0=cputime;
x3=R\(R'\b);
CholSolveTime=cputime()-t0
t0=cputime;
[L,U,P]=splu(Anxny);
LUTime=cputime()-t0

--
Andreas Stahel       E-Mail: address@hidden
Mathematics, BFH-TI  Phone: ++41 +32 32 16 258
Quellgasse 21        Fax:   ++41 +32 321 500
CH-2501 Biel         WWW:   http://prof.ti.bfh.ch/sha1/
Switzerland



reply via email to

[Prev in Thread] Current Thread [Next in Thread]