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.
I can't comment on the algorithms as I'm not good with stuff like this
(that's why I use Octave, so I don't really have to know it). I can,
however, comment on the code.
First of all, I think it would be nice if you wrote the code in texinfo,
as that improves the look of the function help text online.
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.
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=/
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev