]> www.ginac.de Git - ginac.git/commitdiff
* Don't expand elements of a matrix multiplication.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Thu, 9 Mar 2006 01:24:28 +0000 (01:24 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Thu, 9 Mar 2006 01:24:28 +0000 (01:24 +0000)
ginac/matrix.cpp

index 5dc90e26e514b487181b27230d8fcb7c663d425a..f62e2d409244d8a50d44890b8eae74f8ac5e4eb1 100644 (file)
@@ -580,10 +580,11 @@ matrix matrix::mul(const matrix & other) const
        
        for (unsigned r1=0; r1<this->rows(); ++r1) {
                for (unsigned c=0; c<this->cols(); ++c) {
        
        for (unsigned r1=0; r1<this->rows(); ++r1) {
                for (unsigned c=0; c<this->cols(); ++c) {
+                       // Quick test: can we shortcut?
                        if (m[r1*col+c].is_zero())
                                continue;
                        for (unsigned r2=0; r2<other.cols(); ++r2)
                        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);
                }
        }
        return matrix(row, other.col, prod);