Treelayout and CGS

David Bateman dbateman at dbateman.org
Wed Nov 19 18:28:06 CST 2008


R! wrote:
> Hi,
> So there is a second version, i clean cgs procedure so now it fit more the
> codding standards. I also find one bug which is solved now.
> In treelayout I also made some cleanup but I don't wont change the variable
> name much.I know that it's bad to have CamelCase variable but these script
> is closely conected with treeplot where are also these variables.
> New version:
> http://www.nabble.com/file/p20591667/cgs.m cgs.m 
> http://www.nabble.com/file/p20591667/treelayout.m treelayout.m 


Why do you accept two preconditioners in cgs and then just multiply them 
together? The reason to pass two preconditioners in this manner is that 
if M1 and M2 are sparse then (M1 * M2) has a good chance of having a lot 
of fill in and so M1 * (M2 * res) will therefore be much faster than (M1 
*  M2) * res and use a lot less memory. If M1 and M2 are sparse then 
please don't multiply them together in this fashion, but rather do 
something like

   precon = [];
   if (nargin == 5)
     precon = M1;
   elseif (nargin > 5)
     if (isparse(M1) && issparse(M2)
       precon = @(x) M1 * (M2 * x);
     else
       precon = M1 * M2;
     endif
   endif

Apart from that I can't see any issues. If you are happy with the above 
change I'll commit these when I have the chance.

Cheers
David


-- 
David Bateman                                dbateman at dbateman.org
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)


More information about the Octave-maintainers mailing list