From: Christian Bauer Date: Thu, 7 Jun 2001 20:09:21 +0000 (+0000) Subject: - maximum number of arguments for lists bumped to 16 (for making 4x4 matrices) X-Git-Tag: release_0-9-0~6 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=6cf1171daa84575b8799ac4fa5d2564456463bd5 - maximum number of arguments for lists bumped to 16 (for making 4x4 matrices) - added non-const operator() for setting matrix elements --- diff --git a/ginac/basic.cpp b/ginac/basic.cpp index eb8e8ca9..2b1b68b0 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -363,7 +363,7 @@ ex basic::evalf(int level) const return *this; } -/** Evaluate sums and products of matrices. */ +/** Evaluate sums, products and integer powers of matrices. */ ex basic::evalm(void) const { if (nops() == 0) diff --git a/ginac/container.pl b/ginac/container.pl index 93c59182..480d5a56 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -13,7 +13,7 @@ if ($ARGV[0] eq 'lst') { if ($#ARGV==1) { $maxargs=$ARGV[1]; } else { - $maxargs=15; # must be greater or equal than the value used in function.pl + $maxargs=16; # must be greater or equal than the value used in function.pl } if ($type eq 'exprseq') { diff --git a/ginac/inifcns.cpp b/ginac/inifcns.cpp index de5522ad..4d1c978b 100644 --- a/ginac/inifcns.cpp +++ b/ginac/inifcns.cpp @@ -475,15 +475,15 @@ ex lsolve(const ex &eqns, const ex &symbols) for (unsigned c=0; c=row || co>=col) - throw (std::range_error("matrix::set(): index out of range")); - if (value.return_type() != return_types::commutative) - throw std::runtime_error("matrix::set(): non-commutative argument"); - + throw (std::range_error("matrix::operator(): index out of range")); + ensure_if_modifiable(); - m[ro*col+co] = value; - return *this; + clearflag(status_flags::hash_calculated); + return m[ro*col+co]; } @@ -924,7 +924,7 @@ matrix matrix::inverse(void) const // First populate the identity matrix supposed to become the right hand side. matrix identity(row,col); for (unsigned i=0; i j) - m.set(i, j, l.op(i).op(j)); + m(i, j) = l.op(i).op(j); else - m.set(i, j, ex(0)); + m(i, j) = _ex0(); return m; } @@ -1480,7 +1479,7 @@ ex diag_matrix(const lst & l) matrix &m = *new matrix(dim, dim); m.setflag(status_flags::dynallocated); for (unsigned i=0; i