/* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Copyright (C) 2010 Thales group */ /* Authors: Johann Dréo */ #include #include #include #include #include "cholesky.h" void setformat( std::ostream& out ) { out << std::right; out << std::setfill(' '); out << std::setw( 5 + std::numeric_limits::digits10); out << std::setprecision(std::numeric_limits::digits10); out << std::setiosflags(std::ios_base::showpoint); } template std::string format(const MT& mat ) { std::ostringstream out; setformat(out); for( unsigned int i=0; i T round( T val, T prec = 1.0 ) { return (val > 0.0) ? floor(val * prec + 0.5) / prec : ceil(val * prec - 0.5) / prec ; } template bool equal( const MT& M1, const MT& M2, double prec /* = 1/std::numeric_limits::digits10 ???*/ ) { if( M1.size1() != M2.size1() || M1.size2() != M2.size2() ) { return false; } for( unsigned int i=0; i