MPQC  3.0.0-alpha
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 
8 namespace sc {
9 
10  class RefSCMatrix;
11 
12  void
13  scmat_perform_op_on_blocks(const Ref<SCElementOp>& op,
14  const Ref<SCMatrixBlockList> &blocklist);
15 
18  void canonicalize_column_phases(RefSCMatrix& A);
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
sc::SCElementMaxAbs
Definition: elemop.h:444
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::SCElementKNorm
Computes k-norm of matrix.
Definition: elemop.h:499
sc::canonicalize_column_phases
void canonicalize_column_phases(RefSCMatrix &A)
Canonicalize phases of SCMatrix A phases are canonical when the largest-magnitude coefficient in each...
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc::print_scmat_norms
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
sc::scprintf
This class allows printf-like output to be sent to an ostream.
Definition: formio.h:97
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:23:58 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.