From: Richard Kreckel Date: Tue, 24 Jul 2001 00:59:16 +0000 (+0000) Subject: - rewrote binary scanning in matrix::pow(), stealing from CLN's expt_pos(). X-Git-Tag: release_0-9-2~21 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=5061cef31b58e90ff57c579d077c9ce625688161 - rewrote binary scanning in matrix::pow(), stealing from CLN's expt_pos(). --- diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index ca574cc3..65dfd4dc 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -599,35 +599,31 @@ matrix matrix::pow(const ex & expn) const // Integer cases are computed by successive multiplication, using the // obvious shortcut of storing temporaries, like A^4 == (A*A)*(A*A). if (expn.info(info_flags::integer)) { - numeric k; - matrix prod(row,col); + numeric b = ex_to(expn); + matrix A(row,col); if (expn.info(info_flags::negative)) { - k = -ex_to(expn); - prod = this->inverse(); + b *= -1; + A = this->inverse(); } else { - k = ex_to(expn); - prod = *this; + A = *this; } - matrix result(row,col); + matrix C(row,col); for (unsigned r=0; r