[GiNaC-list] multiplying a matrix with 0 makes it become a scalar 0

dummy-address at web.de dummy-address at web.de
Sun Sep 21 16:35:05 CEST 2008


Hi!

symbol a("a"), b("b"), c("c");
matrix blah(3,1);
blah = a,b,c;

cout << "blah: " << blah << endl;
//output:
//    blah: [[a],[b],[c]]

cout << "3*blah: " << 3*blah << endl;
//output:
//    3*blah: 3*[[a],[b],[c]]

cout << "(3*blah).evalm(): " << (3*blah).evalm() << endl;
// output:
//    [[3*a], [3*b], [3*c]]

cout << "0*blah: " << 0*blah << endl;
// output:
//    0

cout << "(0*blah).evalm(): " << (0*blah).evalm() << endl;
// output:
//    0

I don't like this behaviour. Is it supposed to be that way or is this a
bug? Is there a nice way to prevent a matrix from losing its row and
column information?

Regards
Al Capone



More information about the GiNaC-list mailing list