From: Richard Kreckel Date: Fri, 8 Mar 2002 20:32:59 +0000 (+0000) Subject: * matrix:;pow(): Fix exponent==0 case. X-Git-Tag: release_1-0-7~2 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=b3f0d2416a7a0195446e410ebba10ec2c51cbd37 * matrix:;pow(): Fix exponent==0 case. * matrix::print(): Implement print_latex. * Add unit_matrix(unsigend) and unit_matrix(unsigned,unsigned). --- diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index f92a7c56..8daa11db 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -150,23 +150,38 @@ void matrix::print(const print_context & c, unsigned level) const if (is_a(c)) c.s << class_name() << '('; - c.s << "["; - for (unsigned y=0; y(c)) + c.s << "\\left(\\begin{array}{" << std::string(col,'c') << "}"; + else c.s << "["; - for (unsigned x=0; x(c)) + c.s << "["; + for (unsigned co=0; co(c)) + c.s << "&"; + else + c.s << ","; + } else { + if (!is_a(c)) + c.s << "]"; + } + } + if (ro(c)) + c.s << "\\\\"; + else + c.s << ","; } - m[col*(y+1)-1].print(c); - c.s << "],"; - } - c.s << "["; - for (unsigned x=0; x(c)) + c.s << "\\end{array}\\right)"; + else + c.s << "]"; if (is_a(c)) c.s << ')'; @@ -605,17 +620,19 @@ matrix matrix::pow(const ex & expn) const matrix C(row,col); for (unsigned r=0; r