X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fmatrix_checks.cpp;h=9e907ec365127aa63a70091d15a44e9664813079;hp=1bf8e0c85019c5e94a242bff95bf0383c5dbfe1a;hb=ff6822e9aa640a0ee6eeb653e891a236a19a1e64;hpb=5c0989497994b35faa9c17b18f936c21dbb22d78;ds=sidebyside diff --git a/check/matrix_checks.cpp b/check/matrix_checks.cpp index 1bf8e0c8..9e907ec3 100644 --- a/check/matrix_checks.cpp +++ b/check/matrix_checks.cpp @@ -1,9 +1,31 @@ -// check/matrix_checks.cpp +/** @file matrix_checks.cpp + * + * Here we test manipulations on GiNaC's symbolic matrices. */ -/* Here we test manipulations on GiNaC's symbolic matrices. */ +/* + * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ -#include "ginac.h" #include +#include "ginac.h" + +#ifndef NO_NAMESPACE_GINAC +using namespace GiNaC; +#endif // ndef NO_NAMESPACE_GINAC static unsigned matrix_determinants(void) { @@ -104,10 +126,10 @@ static unsigned matrix_invert2(void) matrix m_i = m.inverse(); ex det = m.determinant().expand(); - if ( (normal(m_i(0,0)*det) != d) || - (normal(m_i(0,1)*det) != -b) || - (normal(m_i(1,0)*det) != -c) || - (normal(m_i(1,1)*det) != a) ) { + if ((normal(m_i(0,0)*det) != d) || + (normal(m_i(0,1)*det) != -b) || + (normal(m_i(1,0)*det) != -c) || + (normal(m_i(1,1)*det) != a)) { clog << "inversion of 2x2 matrix " << m << " erroneously returned " << m_i << endl; return 1; @@ -127,15 +149,15 @@ static unsigned matrix_invert3(void) matrix m_i = m.inverse(); ex det = m.determinant().normal().expand(); - if ( (normal(m_i(0,0)*det) != (e*i-f*h)) || - (normal(m_i(0,1)*det) != (c*h-b*i)) || - (normal(m_i(0,2)*det) != (b*f-c*e)) || - (normal(m_i(1,0)*det) != (f*g-d*i)) || - (normal(m_i(1,1)*det) != (a*i-c*g)) || - (normal(m_i(1,2)*det) != (c*d-a*f)) || - (normal(m_i(2,0)*det) != (d*h-e*g)) || - (normal(m_i(2,1)*det) != (b*g-a*h)) || - (normal(m_i(2,2)*det) != (a*e-b*d)) ) { + if ((normal(m_i(0,0)*det) != (e*i-f*h)) || + (normal(m_i(0,1)*det) != (c*h-b*i)) || + (normal(m_i(0,2)*det) != (b*f-c*e)) || + (normal(m_i(1,0)*det) != (f*g-d*i)) || + (normal(m_i(1,1)*det) != (a*i-c*g)) || + (normal(m_i(1,2)*det) != (c*d-a*f)) || + (normal(m_i(2,0)*det) != (d*h-e*g)) || + (normal(m_i(2,1)*det) != (b*g-a*h)) || + (normal(m_i(2,2)*det) != (a*e-b*d))) { clog << "inversion of 3x3 matrix " << m << " erroneously returned " << m_i << endl; return 1; @@ -208,7 +230,7 @@ unsigned matrix_checks(void) result += matrix_invert3(); result += matrix_misc(); - if (! result) { + if (!result) { cout << " passed "; clog << "(no output)" << endl; } else {