From 1067e394af3446a2fc9be1eee3a54fe422247907 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Thu, 31 May 2001 17:14:25 +0000 Subject: [PATCH] determinant_algo::laplace sometimes had the sign wrong because of the change to permutation_sign() --- ginac/matrix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index 99083c06..d47c89e2 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -640,7 +640,6 @@ matrix matrix::transpose(void) const return matrix(this->cols(),this->rows(),trans); } - /** Determinant of square matrix. This routine doesn't actually calculate the * determinant, it only implements some heuristics about which algorithm to * run. If all the elements of the matrix are elements of an integral domain @@ -756,7 +755,8 @@ ex matrix::determinant(unsigned algo) const std::vector pre_sort; for (std::vector::iterator i=c_zeros.begin(); i!=c_zeros.end(); ++i) pre_sort.push_back(i->second); - int sign = permutation_sign(pre_sort.begin(), pre_sort.end()); + std::vector pre_sort_test(pre_sort); // permutation_sign() modifies the vector so we make a copy here + int sign = permutation_sign(pre_sort_test.begin(), pre_sort_test.end()); exvector result(row*col); // represents sorted matrix unsigned c = 0; for (std::vector::iterator i=pre_sort.begin(); -- 2.47.0