Søren Hauberg wrote: > tor, 16 10 2008 kl. 12:01 -0400, skrev Sentil Balaji BeeJay: >> I am a source forge user registered as a Octave-forge Developer. My >> Source forge user id is coolbbeejay. >> >> I would like to forge the attached files into Sparse Matrix package of >> Octave .The codes perform Incomplete Cholesky factorization and Sparse >> Cholesky factorization. > > First of all, sorry about the late reply.
Also sorry for the late reply.. > Then, let's look at 'cholinc': > > [R,P]=chol(A); > [m n]=size(A); > if(droptol==0) > for i=1:m > for j=1:n > if(A(i,j)==0.0) > R(i,j)=0.0; > end > end > end > > Can't the loops be written as > > R (A == 0) = 0; > > That would be faster and more simple. > > else > for i=1:m > for j=1:n > if(R(i,j)<droptol) > R(i,j)=0.0; > end > end > end > > Again, can't this simply be written as > > R (R < droptol) = 0; > > ? Why do you let the index be determined by the value of R here, and in > the other case let it be determined by the value of A? Is that > intentional? > > end > K=R; > > It seems you might as well just return R and remove K altogether. > > The same comments also goes for 'spchol'. But, is the 'spchol' function > actually needed. Wouldn't the 'cholinc' function work just fine for > sparse matrices? I assume 'chol' is overloaded for sparse matrices Note that if R is sparse then R (R < droptol) = 0 will first create a sparse logical matrix "R<droptol". Ideally lots of elements of droptol will be smaller than droptol and so this sparse logical matrix is probably pretty dense. So rather than setting values to zero you might be better off to write such code to select the non-zero values instead. Then converting this sparse logical matrix to an index vector in R(R < droptol) will result in a dense matrix in any case, as the idx-vector C++ class doesn't internally handle sparse logical matrices. Frankly, you are better off handling such games in C++ for sparse matrices. As for the algorithm, the reason to have an incomplete factorization is as a pre-conditioner to an iterative solver to accelerate its convergence. The goal here is a low cost incomplete factorization! If you have the full cholesky factorization you might as well use that rather than drop values as you've done.. It'll work, but it will be slow. The drop tolerance test should be an integral part of the cholesky factorization itself in such a way that dropped values play no further part in the calculation and so incur no cost. I'm sorry, I therefore believe that your implementation of the incomplete cholesky factorization although technically correct is too niave too be of any real use... Regards David . > > Søren > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ -- David Bateman [EMAIL PROTECTED] 35 rue Gambetta +33 1 46 04 02 18 (Home) 92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
