47 #include "AbstractLinAlgPack_TestMatrixSymSecant.hpp"
48 #include "AbstractLinAlgPack_MatrixOp.hpp"
49 #include "AbstractLinAlgPack_MatrixNonsing.hpp"
50 #include "AbstractLinAlgPack_VectorSpace.hpp"
51 #include "AbstractLinAlgPack_VectorMutable.hpp"
52 #include "AbstractLinAlgPack_VectorOut.hpp"
53 #include "AbstractLinAlgPack_VectorStdOps.hpp"
54 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
55 #include "AbstractLinAlgPack_assert_print_nan_inf.hpp"
57 bool AbstractLinAlgPack::TestMatrixSymSecant(
61 ,value_type warning_tol
63 ,
bool print_all_warnings
72 using AbstractLinAlgPack::assert_print_nan_inf;
73 using LinAlgOpPack::V_MtV;
77 sep_line[] =
"\n-----------------------------------------------------------------\n";
84 <<
"\n|(sum(B*s)-sum(y))/||y||inf| = ";
85 VectorSpace::vec_mut_ptr_t
86 Bs = y.space().create_member();
92 err = ::fabs( (sum_Bs - sum_y) / nrm_y );
95 <<
"|("<<sum_Bs<<
"-"<<sum_y<<
")/"<<nrm_y<<
"| = " << err << std::endl;
96 if( err >= error_tol ) {
99 <<
"Error, above error = " << err <<
" >= error_tol = " << error_tol
100 <<
"\nThe test has failed!\n";
101 if(out && print_all_warnings) {
110 else if( err >= warning_tol ) {
113 <<
"Warning!, above error = " << err <<
" >= warning_tol = " << warning_tol << std::endl;
118 *B_nonsing =
dynamic_cast<const MatrixNonsing*
>(&B);
123 <<
"\n|(sum(inv(B)*y)-sum(s))/||s||inf| = ";
124 VectorSpace::vec_mut_ptr_t
125 InvBy = s.space().create_member();
128 sum_InvBy =
sum(*InvBy),
130 nrm_s = s.norm_inf(),
131 err = ::fabs( (sum_InvBy - sum_s) / nrm_s );
134 <<
"|("<<sum_InvBy<<
"-"<<sum_s<<
")/"<<nrm_s<<
"| = " << err << std::endl;
135 if( err >= error_tol ) {
138 <<
"Error, above error = " << err <<
" >= error_tol = " << error_tol
139 <<
"\nThe test has failed!\n";
140 if(out && print_all_warnings) {
144 <<
"\ninv(B)*y =\n" << *InvBy
149 else if( err >= warning_tol ) {
152 <<
"Warning!, above error = " << err <<
" >= warning_tol = " << warning_tol << std::endl;
void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
v_lhs = inv(op(M_rhs1)) * v_rhs2
value_type sum(const Vector &v_rhs)
result = sum( v_rhs(i), i = 1,,,dim )