MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
util.h
1
2#ifndef _math_scmat_util_h
3#define _math_scmat_util_h
4
5#include <math/scmat/elemop.h>
6#include <math/scmat/block.h>
7
8namespace sc {
9
10 class RefSCMatrix;
11
12 void
13 scmat_perform_op_on_blocks(const Ref<SCElementOp>& op,
14 const Ref<SCMatrixBlockList> &blocklist);
15
19
21 template <class RefSCMat>
22 void print_scmat_norms(const RefSCMat& A, const std::string& label, std::ostream& os = ExEnv::out0())
23 {
25 A.element_op(maxabs_op);
26 const double maxabs = maxabs_op->result();
27
28 Ref<SCElementKNorm> onenorm_op(new SCElementKNorm(1));
29 A.element_op(onenorm_op);
30 const double onenorm = onenorm_op->result();
31
32 Ref<SCElementKNorm> twonorm_op(new SCElementKNorm(2));
33 A.element_op(twonorm_op);
34 const double twonorm = twonorm_op->result();
35
36 os << indent << "Norms of " << label << std::endl;
37 os << indent << "------------------------" << std::endl;
38 os << indent << "||A||_{\\infty} = " << scprintf("%10.5lf",maxabs) << std::endl;
39 os << indent << "||A||_1 = " << scprintf("%10.5lf",onenorm) << std::endl;
40 os << indent << "||A||_2 = " << scprintf("%10.5lf",twonorm) << std::endl << std::endl;
41 }
42
43};
44
45#endif
static std::ostream & out0()
Return an ostream that writes from node 0.
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
A template class that maintains references counts.
Definition ref.h:361
Computes k-norm of matrix.
Definition elemop.h:499
Definition elemop.h:444
This class allows printf-like output to be sent to an ostream.
Definition formio.h:97
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
void canonicalize_column_phases(RefSCMatrix &A)
Canonicalize phases of SCMatrix A phases are canonical when the largest-magnitude coefficient in each...
void print_scmat_norms(const RefSCMat &A, const std::string &label, std::ostream &os=ExEnv::out0())
Compute and print out neatly various matrix norms of A.
Definition util.h:22

Generated at Wed Sep 25 2024 02:45:29 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.