33 #include <util/misc/formio.h>
34 #include <util/ref/ref.h>
35 #include <math/scmat/matrix.h>
37 #ifndef _chemistry_qc_mbptr12_printscmatnorms_h
38 #define _chemistry_qc_mbptr12_printscmatnorms_h
43 template <
class RefSCMat>
44 void print_scmat_norms(
const RefSCMat& A,
const std::string& label, std::ostream& os =
ExEnv::out0())
46 Ref<SCElementMaxAbs> maxabs_op(
new SCElementMaxAbs);
47 A.element_op(maxabs_op);
48 const double maxabs = maxabs_op->result();
50 Ref<SCElementKNorm> onenorm_op(
new SCElementKNorm(1.0));
51 A.element_op(onenorm_op);
52 const double onenorm = onenorm_op->result();
54 Ref<SCElementKNorm> twonorm_op(
new SCElementKNorm(2.0));
55 A.element_op(twonorm_op);
56 const double twonorm = twonorm_op->result();
58 os << indent <<
"Norms of " << label << endl;
59 os << indent <<
"------------------------" << endl;
60 os << indent <<
"||A||_{\\infty} = " << scprintf(
"%10.5lf",maxabs) << endl;
61 os << indent <<
"||A||_1 = " << scprintf(
"%10.5lf",onenorm) << endl;
62 os << indent <<
"||A||_2 = " << scprintf(
"%10.5lf",twonorm) << endl << endl;