X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fmatrix.cpp;h=60869f09fa709bbd17b051206fa4b32c29db0e73;hb=55ef6d50c8a068080d8fffb22e04358cdfd289b8;hp=ca574cc32fd9f7355fe378dded9c9bde50cf9da8;hpb=1b5601580eba6925b0af9408c56d6b2027b56013;p=ginac.git diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index ca574cc3..60869f09 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; rinfo(info_flags::numeric)) numeric_flag = false; ++r; @@ -965,7 +961,7 @@ matrix matrix::solve(const matrix & vars, // Gather some statistical information about the augmented matrix: bool numeric_flag = true; exvector::const_iterator r = aug.m.begin(), rend = aug.m.end(); - while (r != rend) { + while (r!=rend && numeric_flag==true) { if (!r->info(info_flags::numeric)) numeric_flag = false; ++r;