Thanks for the different replies. I've got the idea. I'm geting impressed with ginac. I'm using it to perform a rather simple task, but I was unable to deal with it with matlab(symbolic) or maple, due to their limitations in subs funtions. Incredible fine piece of work! Thank you Javier On Wed, 2006-03-08 at 23:24 +0100, Richard B. Kreckel wrote:
Sheplyakov Alexei wrote:
You can try this silly patch:
Index: ginac/matrix.cpp =================================================================== RCS file: /home/cvs/GiNaC/ginac/matrix.cpp,v retrieving revision 1.99.2.5 diff -u -r1.99.2.5 matrix.cpp --- ginac/matrix.cpp 19 Oct 2005 21:21:56 -0000 1.99.2.5 +++ ginac/matrix.cpp 8 Mar 2006 18:51:06 -0000 @@ -583,7 +583,7 @@ if (m[r1*col+c].is_zero()) continue; for (unsigned r2=0; r2<other.cols(); ++r2) - prod[r1*other.col+r2] += (m[r1*col+c] * other.m[c*other.col+r2]).expand(); + prod[r1*other.col+r2] += (m[r1*col+c] * other.m[c*other.col+r2]); } } return matrix(row, other.col, prod);
I think the expansion was unintentional and I have applied this patch to the trunk. Thanks.
In matrix operations, in particularl in the elimination algorithms, one frequently needs to try a bit harder than if (foo.is_zero())... to test for zeros. One also needs to take some care to avoid excessively long terms to build up. For the elements of a matrix product, I see no need for the former, but I do see need for the latter. For instance, consider evalm([[(a+b),0],[0,(c+d)]]^666); in ginsh notation.
Cheers -richy.