@@ -48,16 +48,20 @@ class ComplexMatrix
4848 ComplexMatrix& operator *=(const std::complex <double > &s);
4949 ComplexMatrix& operator +=(const ComplexMatrix &m);
5050 ComplexMatrix& operator -=(const ComplexMatrix &m);
51+ // return a matrix whose element is the real part of element of the ComplexMatrix.
5152 matrix real () const ; // Peize Lin add 2017-03-29
5253
5354 // ==================
5455 // member function:
5556 // ==================
57+ // set all elements to be complex<double> {0.0,0.0}
5658 void zero_out (void );
59+ // set to be a unit matrix,
5760 void set_as_identity_matrix (void );
5861
5962 std::ostream & print ( std::ostream & os, const double threshold_abs=0.0 , const double threshold_imag=0.0 ) const ; // Peize Lin add 2021.09.08
6063
64+ // check if all the elements are real
6165 bool checkreal (void );
6266};
6367
@@ -68,35 +72,47 @@ ComplexMatrix operator*(const std::complex<double> &s, const ComplexMatrix &m);
6872ComplexMatrix operator *(const ComplexMatrix &m, const std::complex <double > &s);
6973ComplexMatrix operator *(const double &s, const ComplexMatrix &m);
7074ComplexMatrix operator *(const ComplexMatrix &m, const double &s);
71-
75+
76+ // calculate the trace
7277std::complex <double > trace (const ComplexMatrix &m);
7378
74- double abs2_row (const ComplexMatrix &m,const int ir); // mohan add 2008-7-1
75- double abs2_column (const ComplexMatrix &m,const int ic); // mohan add 2008-7-1
79+ // calculate the sum of the square of the modulus of the elements in ir row.
80+ double abs2_row (const ComplexMatrix &m,const int ir); // mohan add 2008-7-1
81+
82+ // calculate the sum of the square of the modulus of the elements in ic-th column.
83+ double abs2_column (const ComplexMatrix &m,const int ic); // mohan add 2008-7-1
84+
85+ // calculate the sum of the square of the modulus of all elements.
7686double abs2 (const ComplexMatrix &m);
87+
88+ // calculate the sum of the square of the modulus of all elements of an array of ComplexMatrix.
7789double abs2 (const int nmat, ComplexMatrix **m);
7890
7991ComplexMatrix transpose (const ComplexMatrix &m, const bool &conjugate);
8092ComplexMatrix conj (const ComplexMatrix &m); // Peize Lin add 2019-05-13
8193
94+ // do mout += s*min
8295void scale_accumulate (
8396 const std::complex <double > &s,
8497 const ComplexMatrix &min,
8598 ComplexMatrix &mout);
8699
100+ // do (*mout[i]) += s * (*min[i]); int i<nmat
87101void scale_accumulate (
88102 const int &nmat,
89103 const std::complex <double > &s,
90104 ComplexMatrix **min,
91105 ComplexMatrix **mout);
92106
107+ // Do mout = s1*m1 + s2*m2
93108void scaled_sum (
94109 const std::complex <double > &s1,
95110 const ComplexMatrix &m1,
96111 const std::complex <double > &s2,
97112 const ComplexMatrix &m2,
98113 ComplexMatrix &mout);
99114
115+ // Do (*mout[i]) = s1 * (*m1[i]) + s2 * (*m2[i])
100116void scaled_sum (
101117 const int &nmat,
102118 const std::complex <double > &s1,
0 commit comments