CPPLapack
 All Classes Files Functions Variables Friends Pages
Public Member Functions | Public Attributes | Friends | List of all members
zhematrix Class Reference

Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage]. More...

#include <zhematrix.hpp>

Public Member Functions

 zhematrix ()
 
 zhematrix (const zhematrix &)
 
 zhematrix (const _zhematrix &)
 
 zhematrix (const CPPL_INT &)
 
 zhematrix (const char *)
 
 ~zhematrix ()
 
_zgematrix to_zgematrix () const
 
zhecomplex operator() (const CPPL_INT &, const CPPL_INT &)
 
comple operator() (const CPPL_INT &, const CPPL_INT &) const
 
zhematrixset (const CPPL_INT &, const CPPL_INT &, const comple &)
 
void write (const char *) const
 
void read (const char *)
 
void complete () const
 
void clear ()
 
zhematrixzero ()
 
zhematrixidentity ()
 
void chsign ()
 
void copy (const zhematrix &)
 
void shallow_copy (const _zhematrix &)
 
void resize (const CPPL_INT &)
 
_zrovector row (const CPPL_INT &) const
 
_zcovector col (const CPPL_INT &) const
 
CPPL_INT zhesv (zgematrix &)
 
CPPL_INT zhesv (zcovector &)
 
CPPL_INT zheev (std::vector< double > &, const bool &)
 
CPPL_INT zheev (std::vector< double > &, std::vector< zcovector > &)
 
CPPL_INT zheev (std::vector< double > &, std::vector< zrovector > &)
 
zhematrixoperator= (const zhematrix &)
 
zhematrixoperator= (const _zhematrix &)
 
zhematrixoperator+= (const zhematrix &)
 
zhematrixoperator+= (const _zhematrix &)
 
zhematrixoperator-= (const zhematrix &)
 
zhematrixoperator-= (const _zhematrix &)
 
zhematrixoperator*= (const zhematrix &)
 
zhematrixoperator*= (const _zhematrix &)
 
zhematrixoperator*= (const double &)
 
zhematrixoperator/= (const double &)
 

Public Attributes

CPPL_INT const & m
 matrix row size More...
 
CPPL_INT n
 matrix column size More...
 
comple * array
 1D array to store matrix data More...
 
comple ** darray
 array of pointers of column head addresses More...
 

Friends

std::ostream & operator<< (std::ostream &, const zhematrix &)
 
void swap (zhematrix &, zhematrix &)
 
_zhematrix _ (zhematrix &)
 
_zhematrix t (const zhematrix &)
 
_zgematrix i (const zhematrix &)
 
_zhematrix conj (const zhematrix &)
 
_zhematrix conjt (const zhematrix &)
 
const zhematrixoperator+ (const zhematrix &)
 
_zhematrix operator- (const zhematrix &)
 
_zgematrix operator+ (const zhematrix &, const zgematrix &)
 
_zgematrix operator+ (const zhematrix &, const _zgematrix &)
 
_zhematrix operator+ (const zhematrix &, const zhematrix &)
 
_zhematrix operator+ (const zhematrix &, const _zhematrix &)
 
_zgematrix operator+ (const zhematrix &, const zgbmatrix &)
 
_zgematrix operator+ (const zhematrix &, const _zgbmatrix &)
 
_zgematrix operator+ (const zhematrix &, const zgsmatrix &)
 
_zgematrix operator+ (const zhematrix &, const _zgsmatrix &)
 
_zgematrix operator+ (const zhematrix &, const zhsmatrix &)
 
_zgematrix operator+ (const zhematrix &, const _zhsmatrix &)
 
_zgematrix operator- (const zhematrix &, const zgematrix &)
 
_zgematrix operator- (const zhematrix &, const _zgematrix &)
 
_zhematrix operator- (const zhematrix &, const zhematrix &)
 
_zhematrix operator- (const zhematrix &, const _zhematrix &)
 
_zgematrix operator- (const zhematrix &, const zgbmatrix &)
 
_zgematrix operator- (const zhematrix &, const _zgbmatrix &)
 
_zgematrix operator- (const zhematrix &, const zgsmatrix &)
 
_zgematrix operator- (const zhematrix &, const _zgsmatrix &)
 
_zgematrix operator- (const zhematrix &, const zhsmatrix &)
 
_zgematrix operator- (const zhematrix &, const _zhsmatrix &)
 
_zcovector operator* (const zhematrix &, const zcovector &)
 
_zcovector operator* (const zhematrix &, const _zcovector &)
 
_zgematrix operator* (const zhematrix &, const zgematrix &)
 
_zgematrix operator* (const zhematrix &, const _zgematrix &)
 
_zgematrix operator* (const zhematrix &, const zhematrix &)
 
_zgematrix operator* (const zhematrix &, const _zhematrix &)
 
_zgematrix operator* (const zhematrix &, const zgbmatrix &)
 
_zgematrix operator* (const zhematrix &, const _zgbmatrix &)
 
_zgematrix operator* (const zhematrix &, const zgsmatrix &)
 
_zgematrix operator* (const zhematrix &, const _zgsmatrix &)
 
_zgematrix operator* (const zhematrix &, const zhsmatrix &)
 
_zgematrix operator* (const zhematrix &, const _zhsmatrix &)
 
_zhematrix operator* (const zhematrix &, const double &)
 
_zgematrix operator* (const zhematrix &, const comple &)
 
_zhematrix operator/ (const zhematrix &, const double &)
 
_zgematrix operator/ (const zhematrix &, const comple &)
 
_zhematrix operator* (const double &, const zhematrix &)
 
_zgematrix operator* (const comple &, const zhematrix &)
 

Detailed Description

Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].

The imaginary part of every diagonal component is not referenced.

Definition at line 4 of file zhematrix.hpp.

Constructor & Destructor Documentation

zhematrix::zhematrix ( )
inline

zhematrix constructor without arguments

Definition at line 3 of file zhematrix-constructor.hpp.

References array, darray, and n.

4  : m(n)
5 {CPPL_VERBOSE_REPORT;
6  //////// initialize ////////
7  n = 0;
8  array =NULL;
9  darray =NULL;
10 }
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix::zhematrix ( const zhematrix mat)
inline

zhematrix copy constructor

Definition at line 18 of file zhematrix-constructor.hpp.

References array, darray, i, and n.

19  : m(n)
20 {CPPL_VERBOSE_REPORT;
21  //////// initialize ////////
22  n =mat.n;
23  array =new comple[n*n];
24  darray =new comple*[n];
25  for(int i=0; i<n; i++){
26  darray[i] =&array[i*n];
27  }
28 
29  //////// copy ////////
30  CPPL_INT size =n*n;
31  CPPL_INT inc =1;
32  zcopy_(&size, mat.array, &inc, array, &inc);
33 }
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix::zhematrix ( const _zhematrix mat)
inline

zhematrix constructor to cast _zhematrix

Definition at line 37 of file zhematrix-constructor.hpp.

References array, _zhematrix::array, darray, _zhematrix::darray, _zhematrix::n, n, and _zhematrix::nullify().

38  : m(n)
39 {CPPL_VERBOSE_REPORT;
40  n =mat.n;
41  array =mat.array;
42  darray =mat.darray;
43 
44  mat.nullify();
45 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
void nullify() const
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple * array
1D array to store matrix data
Definition: _zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
zhematrix::zhematrix ( const CPPL_INT &  _n)
inline

zhematrix constructor with size specification

Definition at line 53 of file zhematrix-constructor.hpp.

References array, darray, i, and n.

54  : m(n)
55 {CPPL_VERBOSE_REPORT;
56 #ifdef CPPL_DEBUG
57  if( _n<0 ){
58  ERROR_REPORT;
59  std::cerr << "Matrix sizes must be positive integers. " << std::endl
60  << "Your input was (" << _n << ")." << std::endl;
61  exit(1);
62  }
63 #endif//CPPL_DEBUG
64 
65  //////// initialize ////////
66  n =_n;
67  array =new comple[n*n];
68  darray =new comple*[n];
69  for(int i=0; i<n; i++){
70  darray[i] =&array[i*n];
71  }
72 }
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix::zhematrix ( const char *  filename)
inline

zhematrix constructor with filename

Definition at line 76 of file zhematrix-constructor.hpp.

References array, darray, and read().

77  : m(n)
78 {CPPL_VERBOSE_REPORT;
79  array =NULL;
80  darray =NULL;
81 
82  //// read ////
83  read(filename);
84 }
void read(const char *)
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix::~zhematrix ( )
inline

zhematrix destructor

Definition at line 92 of file zhematrix-constructor.hpp.

References array, and darray.

93 {CPPL_VERBOSE_REPORT;
94  //////// delete array ////////
95  delete [] array;
96  delete [] darray;
97 }
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13

Member Function Documentation

_zgematrix zhematrix::to_zgematrix ( ) const
inline

convert to _zgematrix

Definition at line 3 of file zhematrix-cast.hpp.

References _, i, and n.

Referenced by operator+().

4 {CPPL_VERBOSE_REPORT;
5  zgematrix newmat(n,n);
6 
7  for(CPPL_INT i=0; i<n; i++){
8  for(CPPL_INT j=0; j<n; j++){
9  newmat(i,j) =(*this)(i,j);
10  }
11  }
12 
13  return _(newmat);
14 }
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
zhecomplex zhematrix::operator() ( const CPPL_INT &  i,
const CPPL_INT &  j 
)
inline

operator() for non-const object

Definition at line 3 of file zhematrix-io.hpp.

References darray, and n.

Referenced by write().

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if( i<0 || j<0 || n<=i || n<=j ){
7  ERROR_REPORT;
8  std::cerr << "The required component is out of the matrix size." << std::endl
9  << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  if(i>=j){ return zhecomplex(i,j, darray[j][i]); }
15  else { return zhecomplex(i,j, darray[i][j]); }
16 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
(DO NOT USE) Complex-double Class for Hermitian matrices
Definition: zhecomplex.hpp:3
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple zhematrix::operator() ( const CPPL_INT &  i,
const CPPL_INT &  j 
) const
inline

operator() for const object

Definition at line 20 of file zhematrix-io.hpp.

References conj(), darray, i, and n.

21 {CPPL_VERBOSE_REPORT;
22 #ifdef CPPL_DEBUG
23  if( i<0 || j<0 || n<=i || n<=j ){
24  ERROR_REPORT;
25  std::cerr << "The required component is out of the matrix size." << std::endl
26  << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl;
27  exit(1);
28  }
29 #endif//CPPL_DEBUG
30 
31  if(i>=j){ return darray[j][i]; }
32  else { return std::conj(darray[i][j]); }
33 }
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix & zhematrix::set ( const CPPL_INT &  i,
const CPPL_INT &  j,
const comple &  v 
)
inline

set value for const object

Definition at line 41 of file zhematrix-io.hpp.

References conj(), darray, i, and n.

42 {CPPL_VERBOSE_REPORT;
43 #ifdef CPPL_DEBUG
44  if( i<0 || j<0 || n<=i || n<=j ){
45  ERROR_REPORT;
46  std::cerr << "The required component is out of the matrix size." << std::endl
47  << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl;
48  exit(1);
49  }
50 #endif//CPPL_DEBUG
51 
52  //if(i>=j){ array[i+n*j] = v; }
53  //else{ array[j+n*i] = std::conj(v); }
54  if(i>=j){ darray[j][i] = v; }
55  else{ darray[i][j] = std::conj(v); }
56 
57  return *this;
58 }
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
void zhematrix::write ( const char *  filename) const
inline

Definition at line 91 of file zhematrix-io.hpp.

References i, imag(), n, and operator()().

92 {CPPL_VERBOSE_REPORT;
93  std::ofstream ofs(filename, std::ios::trunc);
94  ofs.setf(std::cout.flags());
95  ofs.precision(std::cout.precision());
96  ofs.width(std::cout.width());
97  ofs.fill(std::cout.fill());
98 
99  ofs << "#zhematrix " << n << std::endl;
100  for(CPPL_INT i=0; i<n; i++){
101  for(CPPL_INT j=0; j<=i; j++ ){
102  ofs << operator()(i,j) << " ";
103  }
104  ofs << std::endl;
105 
106 #ifdef CPPL_DEBUG
107  if(std::fabs(std::imag(operator()(i,i))) > DBL_MIN){
108  WARNING_REPORT;
109  std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl;
110  }
111 #endif//CPPL_DEBUG
112  }
113 
114  ofs.close();
115 }
zhecomplex operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zhematrix-io.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
dcovec3 imag(const dquater &q)
void zhematrix::read ( const char *  filename)
inline

Definition at line 118 of file zhematrix-io.hpp.

References darray, i, n, and resize().

Referenced by zhematrix().

119 {CPPL_VERBOSE_REPORT;
120  std::ifstream s(filename);
121  if(!s){
122  ERROR_REPORT;
123  std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl;
124  exit(1);
125  }
126 
127  std::string id;
128  s >> id;
129  if( id != "zhematrix" && id != "#zhematrix" ){
130  ERROR_REPORT;
131  std::cerr << "The type name of the file \"" << filename << "\" is not zhematrix." << std::endl
132  << "Its type name was " << id << " ." << std::endl;
133  exit(1);
134  }
135 
136  s >> n;
137  resize(n);
138  for(CPPL_INT i=0; i<n; i++){
139  for(CPPL_INT j=0; j<=i; j++ ){
140  s >> darray[j][i];
141  //s >> operator()(i,j); //NG
142  }
143  }
144  if(s.eof()){
145  ERROR_REPORT;
146  std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
147  << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl;
148  exit(1);
149  }
150 
151  s >> id;
152  if(!s.eof()){
153  ERROR_REPORT;
154  std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
155  << "Most likely, there are extra data components." << std::endl;
156  exit(1);
157  }
158 
159  s.close();
160 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
void resize(const CPPL_INT &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
void zhematrix::complete ( ) const
inline

complete the upper-right components

Definition at line 3 of file zhematrix-misc.hpp.

References conj(), darray, i, imag(), and n.

Referenced by operator*(), and operator/().

4 {CPPL_VERBOSE_REPORT;
5  for(CPPL_INT i=0; i<n; i++){
6  for(CPPL_INT j=0; j<i; j++){
7  darray[i][j] =std::conj(darray[j][i]);
8  }
9 #ifdef CPPL_DEBUG
10  if(std::fabs(std::imag(operator()(i,i))) > DBL_MIN){
11  WARNING_REPORT;
12  std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl;
13  }
14 #endif//CPPL_DEBUG
15  }
16 }
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
dcovec3 imag(const dquater &q)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
void zhematrix::clear ( )
inline

clear all the matrix data and set the sizes 0

Definition at line 20 of file zhematrix-misc.hpp.

References array, darray, and n.

21 {CPPL_VERBOSE_REPORT;
22  n =0;
23  delete [] array;
24  array =NULL;
25  delete [] darray;
26  darray =NULL;
27 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix & zhematrix::zero ( )
inline

change the matrix into a zero matrix

Definition at line 31 of file zhematrix-misc.hpp.

References darray, i, and n.

Referenced by _zhsmatrix::to_zhematrix(), and zhsmatrix::to_zhematrix().

32 {CPPL_VERBOSE_REPORT;
33  for(CPPL_INT j=0; j<n; j++){
34  for(CPPL_INT i=j; i<n; i++){
35  darray[j][i]=comple(0.,0.);
36  }
37  }
38  return *this;
39 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix & zhematrix::identity ( )
inline

change the matrix into an identity matrix

Definition at line 43 of file zhematrix-misc.hpp.

References darray, i, and n.

44 {CPPL_VERBOSE_REPORT;
45  for(CPPL_INT j=0; j<n; j++){
46  darray[j][j] =comple(1.,0.);
47  for(CPPL_INT i=j+1; i<n; i++){
48  darray[j][i]=comple(0.,0.);
49  }
50  }
51  return *this;
52 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
void zhematrix::chsign ( )
inline

change sign(+/-) of the matrix

Definition at line 56 of file zhematrix-misc.hpp.

References darray, i, and n.

57 {CPPL_VERBOSE_REPORT;
58  for(CPPL_INT j=0; j<n; j++){
59  for(CPPL_INT i=j; i<n; i++){
60  darray[j][i] =-darray[j][i];
61  }
62  }
63 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
void zhematrix::copy ( const zhematrix mat)
inline

make a deep copy of the matrix

Definition at line 67 of file zhematrix-misc.hpp.

References array, darray, i, and n.

Referenced by operator=().

68 {CPPL_VERBOSE_REPORT;
69  n =mat.n;
70  delete [] array;
71  array =new comple[n*n];
72  delete [] darray;
73  darray =new comple*[n];
74  for(int i=0; i<n; i++){
75  darray[i] =&array[i*n];
76  }
77 
78  for(CPPL_INT j=0; j<n; j++){
79  for(CPPL_INT i=j; i<n; i++){
80  darray[j][i] =mat.darray[j][i];
81  }
82  }
83 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
void zhematrix::shallow_copy ( const _zhematrix mat)
inline

make a shallow copy of the matrix
This function is not designed to be used in project codes.

Definition at line 88 of file zhematrix-misc.hpp.

References array, _zhematrix::array, darray, _zhematrix::darray, _zhematrix::n, n, and _zhematrix::nullify().

Referenced by operator=().

89 {CPPL_VERBOSE_REPORT;
90  n =mat.n;
91  delete [] array;
92  array =mat.array;
93  delete [] darray;
94  darray =mat.darray;
95 
96  mat.nullify();
97 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
void nullify() const
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple * array
1D array to store matrix data
Definition: _zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
void zhematrix::resize ( const CPPL_INT &  _n)
inline

resize the matrix

Definition at line 101 of file zhematrix-misc.hpp.

References array, darray, i, and n.

Referenced by read().

102 {CPPL_VERBOSE_REPORT;
103 #ifdef CPPL_DEBUG
104  if( _n<0 ){
105  ERROR_REPORT;
106  std::cerr << "Matrix sizes must be positive integers." << std::endl
107  << "Your input was (" << _n << ")." << std::endl;
108  exit(1);
109  }
110 #endif//CPPL_DEBUG
111 
112  n =_n;
113  delete [] array;
114  array =new comple[n*n];
115  delete [] darray;
116  darray =new comple*[n];
117  for(int i=0; i<n; i++){
118  darray[i] =&array[i*n];
119  }
120 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
_zrovector zhematrix::row ( const CPPL_INT &  _m) const
inline

get row of the matrix

Definition at line 128 of file zhematrix-misc.hpp.

References _, m, and n.

129 {CPPL_VERBOSE_REPORT;
130 #ifdef CPPL_DEBUG
131  if( _m<0 || _m>m ){
132  ERROR_REPORT;
133  std::cerr << "Input row number must be between 0 and " << m << "." << std::endl
134  << "Your input was " << _m << "." << std::endl;
135  exit(1);
136  }
137 #endif//CPPL_DEBUG
138 
139  zrovector v(n);
140  for(CPPL_INT j=0; j<n; j++){
141  v(j)=(*this)(_m,j);
142  }
143  return _(v);
144 }
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
Complex Double-precision Row Vector Class.
Definition: zrovector.hpp:3
friend _zhematrix _(zhematrix &)
_zcovector zhematrix::col ( const CPPL_INT &  _n) const
inline

get column of the matrix

Definition at line 148 of file zhematrix-misc.hpp.

References _, i, m, and n.

149 {CPPL_VERBOSE_REPORT;
150 #ifdef CPPL_DEBUG
151  if( _n<0 || _n>n ){
152  ERROR_REPORT;
153  std::cerr << "Input row number must be between 0 and " << n << "." << std::endl
154  << "Your input was " << _n << "." << std::endl;
155  exit(1);
156  }
157 #endif//CPPL_DEBUG
158 
159  zcovector v(m);
160  for(CPPL_INT i=0; i<m; i++){
161  v(i)=(*this)(i,_n);
162  }
163  return _(v);
164 }
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT zhematrix::zhesv ( zgematrix mat)
inline

solve A*X=Y using zhesv
The argument is dmatrix Y. Y is overwritten and become the solution X. A is also overwritten.

Definition at line 6 of file zhematrix-lapack.hpp.

References zgematrix::array, array, zgematrix::n, and n.

Referenced by i().

7 {CPPL_VERBOSE_REPORT;
8 #ifdef CPPL_DEBUG
9  if(n!=mat.n){
10  ERROR_REPORT;
11  std::cerr << "These two matrices cannot be solved." << std::endl
12  << "Your input was (" << n << "x" << n << ") and (" << mat.n << "x" << mat.n << ")." << std::endl;
13  exit(1);
14  }
15 #endif//CPPL_DEBUG
16 
17  char UPLO('l');
18  CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.n), LWORK(-1), INFO(1);
19  comple *WORK(new comple[1]);
20  zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, WORK, &LWORK, &INFO);
21 
22  INFO=1;
23  LWORK = CPPL_INT(std::real(WORK[0]));
24  delete [] WORK;
25  WORK =new comple[LWORK];
26  zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, WORK, &LWORK, &INFO);
27 
28  delete [] WORK;
29  delete [] IPIV;
30 
31  if(INFO!=0){
32  WARNING_REPORT;
33  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
34  }
35  return INFO;
36 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
CPPL_INT zhematrix::zhesv ( zcovector vec)
inline

solve A*x=y using zhesv
The argument is zcovector y. y is overwritten and become the solution x. A is also overwritten.

Definition at line 43 of file zhematrix-lapack.hpp.

References zcovector::array, array, zcovector::l, and n.

44 {CPPL_VERBOSE_REPORT;
45 #ifdef CPPL_DEBUG
46  if(n!=vec.l){
47  ERROR_REPORT;
48  std::cerr << "These matrix and vector cannot be solved." << std::endl
49  << "Your input was (" << n << "x" << n << ") and (" << vec.l << ")." << std::endl;
50  exit(1);
51  }
52 #endif//CPPL_DEBUG
53 
54  char UPLO('l');
55  CPPL_INT NRHS(1), LDA(n), *IPIV(new CPPL_INT[n]), LDB(vec.l), LWORK(-1), INFO(1);
56  comple *WORK( new comple[1] );
57  zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, WORK, &LWORK, &INFO);
58 
59  INFO=1;
60  LWORK = CPPL_INT(std::real(WORK[0]));
61  delete [] WORK;
62  WORK = new comple[LWORK];
63  zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, WORK, &LWORK, &INFO);
64 
65  delete [] WORK;
66  delete [] IPIV;
67 
68  if(INFO!=0){
69  WARNING_REPORT;
70  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
71  }
72  return INFO;
73 }
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
CPPL_INT l
vector size
Definition: zcovector.hpp:9
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
CPPL_INT zhematrix::zheev ( std::vector< double > &  w,
const bool &  jobz = 0 
)
inline

calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w is overwitten and become eigenvalues. This matrix is also overwritten. if jobz=1, this matrix becomes eigenvectors.

Definition at line 86 of file zhematrix-lapack.hpp.

References array, and n.

88 {CPPL_VERBOSE_REPORT;
89  w.resize(n);
90 
91  char JOBZ, UPLO('l');
92  if(jobz==0){ JOBZ='n'; } else{ JOBZ='V'; }
93  CPPL_INT LDA(n), INFO(1), LWORK(-1);
94  double *RWORK(new double[std::max(CPPL_INT(1), 3*n-2)]);
95  comple *WORK(new comple[1]);
96  zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO);
97 
98  INFO=1;
99  LWORK = CPPL_INT(std::real(WORK[0]));
100  delete [] WORK;
101  WORK = new comple[LWORK];
102  zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO);
103 
104  delete [] RWORK;
105  delete [] WORK;
106 
107  if(INFO!=0){
108  WARNING_REPORT;
109  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
110  }
111  return INFO;
112 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
CPPL_INT zhematrix::zheev ( std::vector< double > &  w,
std::vector< zcovector > &  v 
)
inline

calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w and v are overwitten and become eigenvalues and eigenvectors, respectively. This matrix is also overwritten.

Definition at line 121 of file zhematrix-lapack.hpp.

References array, i, and n.

123 {CPPL_VERBOSE_REPORT;
124  w.resize(n);
125  v.resize(n);
126  for(CPPL_INT i=0; i<n; i++){
127  v[i].resize(n);
128  }
129 
130  char JOBZ('V'), UPLO('l');
131  CPPL_INT LDA(n), INFO(1), LWORK(-1);
132  double *RWORK(new double[std::max(CPPL_INT(1), 3*n-2)]);
133  comple *WORK(new comple[1]);
134  zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO);
135 
136  INFO=1;
137  LWORK = CPPL_INT(std::real(WORK[0]));
138  delete [] WORK;
139  WORK = new comple[LWORK];
140  zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO);
141 
142  delete [] RWORK;
143  delete [] WORK;
144 
145  //// forming ////
146  for(CPPL_INT i=0; i<n; i++){
147  for(CPPL_INT j=0; j<n; j++){
148  v[j](i) = array[i+n*j];
149  }
150  }
151 
152  if(INFO!=0){
153  WARNING_REPORT;
154  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
155  }
156  return INFO;
157 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
CPPL_INT zhematrix::zheev ( std::vector< double > &  w,
std::vector< zrovector > &  v 
)
inline

calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w and v are overwitten and become eigenvalues and eigenvectors, respectively. This matrix is also overwritten.

Definition at line 166 of file zhematrix-lapack.hpp.

References array, i, and n.

168 {CPPL_VERBOSE_REPORT;
169  w.resize(n);
170  v.resize(n);
171  for(CPPL_INT i=0; i<n; i++){
172  v[i].resize(n);
173  }
174 
175  char JOBZ('V'), UPLO('l');
176  CPPL_INT LDA(n), INFO(1), LWORK(-1);
177  double *RWORK(new double[std::max(CPPL_INT(1), 3*n-2)]);
178  comple *WORK(new comple[1]);
179  zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO);
180 
181  INFO=1;
182  LWORK = CPPL_INT(std::real(WORK[0]));
183  delete [] WORK;
184  WORK = new comple[LWORK];
185  zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO);
186 
187  delete [] RWORK;
188  delete [] WORK;
189 
190  //// forming ////
191  for(CPPL_INT i=0; i<n; i++){
192  for(CPPL_INT j=0; j<n; j++){
193  v[j](i) = array[i+n*j];
194  }
195  }
196 
197  if(INFO!=0){
198  WARNING_REPORT;
199  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
200  }
201  return INFO;
202 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
zhematrix & zhematrix::operator= ( const zhematrix mat)
inline

zhematrix=zhematrix operator

Definition at line 3 of file zhematrix-zhematrix.hpp.

References array, and copy().

4 {CPPL_VERBOSE_REPORT;
5  if(array!=mat.array){ // if it is NOT self substitution
6  copy(mat);
7  }
8  return *this;
9 }
void copy(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
zhematrix & zhematrix::operator= ( const _zhematrix mat)
inline

zhematrix=_zhematrix operator

Definition at line 3 of file zhematrix-_zhematrix.hpp.

References shallow_copy().

4 {CPPL_VERBOSE_REPORT;
5  shallow_copy(mat);
6  return *this;
7 }
void shallow_copy(const _zhematrix &)
zhematrix & zhematrix::operator+= ( const zhematrix mat)
inline

zhematrix+=zhematrix operator

Definition at line 17 of file zhematrix-zhematrix.hpp.

References darray, i, and n.

18 {CPPL_VERBOSE_REPORT;
19 #ifdef CPPL_DEBUG
20  if(n!=mat.n){
21  ERROR_REPORT;
22  std::cerr << "These two matrises can not make a summation." << std::endl
23  << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl;
24  exit(1);
25  }
26 #endif//CPPL_DEBUG
27 
28  for(CPPL_INT j=0; j<n; j++){
29  for(CPPL_INT i=j; i<n; i++){
30  darray[j][i] += mat.darray[j][i];
31  }
32  }
33 
34  return *this;
35 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix & zhematrix::operator+= ( const _zhematrix mat)
inline

zhematrix+=_zhematrix operator

Definition at line 15 of file zhematrix-_zhematrix.hpp.

References darray, _zhematrix::darray, _zhematrix::destroy(), i, n, and _zhematrix::n.

16 {CPPL_VERBOSE_REPORT;
17 #ifdef CPPL_DEBUG
18  if(n!=mat.n){
19  ERROR_REPORT;
20  std::cerr << "These two matrises can not make a summation." << std::endl
21  << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl;
22  exit(1);
23  }
24 #endif//CPPL_DEBUG
25 
26  for(CPPL_INT j=0; j<n; j++){
27  for(CPPL_INT i=j; i<n; i++){
28  darray[j][i] += mat.darray[j][i];
29  }
30  }
31 
32  mat.destroy();
33  return *this;
34 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
void destroy() const
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
zhematrix & zhematrix::operator-= ( const zhematrix mat)
inline

zhematrix operator-=

Definition at line 39 of file zhematrix-zhematrix.hpp.

References darray, i, and n.

40 {CPPL_VERBOSE_REPORT;
41 #ifdef CPPL_DEBUG
42  if(n!=mat.n){
43  ERROR_REPORT;
44  std::cerr << "These two matrises can not make a sutraction." << std::endl
45  << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl;
46  exit(1);
47  }
48 #endif//CPPL_DEBUG
49 
50  for(CPPL_INT j=0; j<n; j++){
51  for(CPPL_INT i=j; i<n; i++){
52  darray[j][i] -= mat.darray[j][i];
53  }
54  }
55 
56  return *this;
57 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
zhematrix & zhematrix::operator-= ( const _zhematrix mat)
inline

zhematrix-=_zhematrix operator

Definition at line 38 of file zhematrix-_zhematrix.hpp.

References darray, _zhematrix::darray, _zhematrix::destroy(), i, n, and _zhematrix::n.

39 {CPPL_VERBOSE_REPORT;
40 #ifdef CPPL_DEBUG
41  if(n!=mat.n){
42  ERROR_REPORT;
43  std::cerr << "These two matrises can not make a sutraction." << std::endl
44  << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl;
45  exit(1);
46  }
47 #endif//CPPL_DEBUG
48 
49  for(CPPL_INT j=0; j<n; j++){
50  for(CPPL_INT i=j; i<n; i++){
51  darray[j][i] -= mat.darray[j][i];
52  }
53  }
54 
55  mat.destroy();
56  return *this;
57 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
void destroy() const
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
zhematrix& zhematrix::operator*= ( const zhematrix )
inline
zhematrix& zhematrix::operator*= ( const _zhematrix )
inline
zhematrix & zhematrix::operator*= ( const double &  d)
inline

zhematrix*=double operator

Definition at line 3 of file zhematrix-double.hpp.

References array, and n.

4 {CPPL_VERBOSE_REPORT;
5  CPPL_INT size =n*n;
6  CPPL_INT inc =1;
7  zdscal_(&size, &d, array, &inc);
8  return *this;
9 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
zhematrix & zhematrix::operator/= ( const double &  d)
inline

zhematrix/=double operator

Definition at line 13 of file zhematrix-double.hpp.

References array, and n.

14 {CPPL_VERBOSE_REPORT;
15  CPPL_INT size =n*n;
16  double dinv =1./d;
17  CPPL_INT inc =1;
18  zdscal_(&size, &dinv, array, &inc);
19  return *this;
20 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const zhematrix mat 
)
friend

Definition at line 65 of file zhematrix-io.hpp.

66 {CPPL_VERBOSE_REPORT;
67  for(CPPL_INT i=0; i<mat.n; i++){
68  for(CPPL_INT j=0; j<mat.n; j++){
69  if(i>j){ s << " " << mat(i,j) << " "; }
70  else if(i==j){ s << " " << std::real(mat(i,i)) << " "; }
71  else{ s << "{" << std::conj(mat(j,i)) << "} "; }
72  }
73  s << std::endl;
74 
75 #ifdef CPPL_DEBUG
76  if(std::fabs(std::imag(mat(i,i))) > DBL_MIN){
77  WARNING_REPORT;
78  std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl;
79  }
80 #endif//CPPL_DEBUG
81  }
82 
83  return s;
84 }
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
dcovec3 imag(const dquater &q)
void swap ( zhematrix A,
zhematrix B 
)
friend

swap two matrices

Definition at line 172 of file zhematrix-misc.hpp.

173 {CPPL_VERBOSE_REPORT;
174  CPPL_INT A_n =A.n;
175  comple* A_array =A.array;
176  comple** A_darray =A.darray;
177  A.n=B.n; A.array=B.array; A.darray=B.darray;
178  B.n=A_n; B.array=A_array; B.darray=A_darray;
179 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
_zhematrix _ ( zhematrix mat)
friend

convert user object to smart-temporary object

Definition at line 183 of file zhematrix-misc.hpp.

Referenced by col(), row(), and to_zgematrix().

184 {CPPL_VERBOSE_REPORT;
185  _zhematrix newmat;
186 
187  //////// shallow copy ////////
188  newmat.n =mat.n;
189  newmat.array =mat.array;
190  newmat.darray =mat.darray;
191 
192  //////// nullify ////////
193  mat.n =0;
194  mat.array =NULL;
195  mat.darray =NULL;
196 
197  return newmat;
198 }
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Matrix Class
Definition: _zhematrix.hpp:3
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple * array
1D array to store matrix data
Definition: _zhematrix.hpp:12
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
_zhematrix t ( const zhematrix mat)
friend

return transposed zgematrix

Definition at line 3 of file zhematrix-calc.hpp.

4 {CPPL_VERBOSE_REPORT;
5  zhematrix newmat(mat.n);
6 
7  for(CPPL_INT j=0; j<mat.n; j++){
8  for(CPPL_INT i=j; i<mat.n; i++){
9  newmat(i,j) =mat(j,i);
10  }
11  }
12 
13  return _(newmat);
14 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_zgematrix i ( const zhematrix mat)
friend

return its inverse matrix

Definition at line 18 of file zhematrix-calc.hpp.

Referenced by chsign(), col(), complete(), copy(), identity(), operator()(), operator+=(), operator-=(), read(), resize(), set(), to_zgematrix(), write(), zero(), zheev(), and zhematrix().

19 {CPPL_VERBOSE_REPORT;
20  zhematrix mat_cp(mat);
21  zgematrix mat_inv(mat.n,mat.n);
22  mat_inv.identity();
23  mat_cp.zhesv(mat_inv);
24 
25  return _(mat_inv);
26 }
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_zhematrix conj ( const zhematrix mat)
friend

return its conjugate matrix

Definition at line 34 of file zhematrix-calc.hpp.

35 {CPPL_VERBOSE_REPORT;
36  zhematrix newmat(mat.n);
37 
38  for(CPPL_INT j=0; j<mat.n; j++){
39  for(CPPL_INT i=j; i<mat.n; i++){
40  newmat(i,j) =std::conj(mat(i,j));
41  }
42  }
43 
44  return _(newmat);
45 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_zhematrix conj(const zhematrix &mat)
_zhematrix conjt ( const zhematrix mat)
friend

return its conjugate transposed matrix

Definition at line 49 of file zhematrix-calc.hpp.

50 {CPPL_VERBOSE_REPORT;
51 #ifdef CPPL_DEBUG
52  WARNING_REPORT;
53  std::cerr << "This function call has no effect since the matrix is Hermitian." << std::endl;
54 #endif//CPPL_DEBUG
55 
56  zhematrix newmat =mat;
57  return _(newmat);
58 }
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
const zhematrix& operator+ ( const zhematrix mat)
friend

+zhematrix operator

Definition at line 3 of file zhematrix-unary.hpp.

4 {CPPL_VERBOSE_REPORT;
5  return mat;
6 }
_zhematrix operator- ( const zhematrix mat)
friend

-zgematrix operator

Definition at line 10 of file zhematrix-unary.hpp.

11 {CPPL_VERBOSE_REPORT;
12  zhematrix newmat(mat.n);
13 
14  for(CPPL_INT j=0; j<mat.n; j++){
15  for(CPPL_INT i=j; i<mat.n; i++){
16  newmat(i,j) =-mat(i,j);
17  }
18  }
19 
20  return _(newmat);
21 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_zgematrix operator+ ( const zhematrix matA,
const zgematrix matB 
)
friend

zhematrix+zgematrix operator

Definition at line 3 of file zhematrix-zgematrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.n!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat =matB;
15 
16  for(CPPL_INT i=0; i<matA.n; i++){
17  for(CPPL_INT j=0; j<matA.n; j++){
18  newmat(i,j) += matA(i,j);
19  }
20  }
21 
22  return _(newmat);
23 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator+ ( const zhematrix matA,
const _zgematrix matB 
)
friend

_zgematrix+zhematrix operator

Definition at line 3 of file zhematrix-_zgematrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.n!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  for(CPPL_INT i=0; i<matA.n; i++){
15  for(CPPL_INT j=0; j<matA.n; j++){
16  matB(i,j) += matA(i,j);
17  }
18  }
19 
20  return matB;
21 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zhematrix operator+ ( const zhematrix matA,
const zhematrix matB 
)
friend

zhematrix+zhematrix operator

Definition at line 61 of file zhematrix-zhematrix.hpp.

62 {CPPL_VERBOSE_REPORT;
63 #ifdef CPPL_DEBUG
64  if(matA.n!=matB.n){
65  ERROR_REPORT;
66  std::cerr << "These two matrises can not make a summation." << std::endl
67  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
68  exit(1);
69  }
70 #endif//CPPL_DEBUG
71 
72  zhematrix newmat(matA.n);
73 
74  for(CPPL_INT j=0; j<matA.n; j++){
75  for(CPPL_INT i=j; i<matA.n; i++){
76  newmat.darray[j][i] =matA.darray[j][i] +matB.darray[j][i];
77  }
78  }
79 
80  return _(newmat);
81 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
_zhematrix operator+ ( const zhematrix matA,
const _zhematrix matB 
)
friend

zhematrix+_zhematrix operator

Definition at line 65 of file zhematrix-_zhematrix.hpp.

66 {CPPL_VERBOSE_REPORT;
67 #ifdef CPPL_DEBUG
68  if(matA.n!=matB.n){
69  ERROR_REPORT;
70  std::cerr << "These two matrises can not make a summation." << std::endl
71  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
72  exit(1);
73  }
74 #endif//CPPL_DEBUG
75 
76  for(CPPL_INT j=0; j<matA.n; j++){
77  for(CPPL_INT i=j; i<matA.n; i++){
78  matB.darray[j][i] += matA.darray[j][i];
79  }
80  }
81 
82  return matB;
83 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
_zgematrix operator+ ( const zhematrix matA,
const zgbmatrix matB 
)
friend

zhematrix+zgbmatrix operator

Definition at line 3 of file zhematrix-zgbmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.n!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat(matA.n, matA.n);
15 
16  for(CPPL_INT i=0; i<matB.m; i++){
17  for(CPPL_INT j=0; j<matA.n; j++){
18  newmat(i,j) =matA(i,j);
19  }
20  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
21  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
22  newmat(i,j)+=matB(i,j);
23  }
24  }
25 
26  return _(newmat);
27 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
friend _zhematrix _(zhematrix &)
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix operator+ ( const zhematrix matA,
const _zgbmatrix matB 
)
friend

zhematrix+_zgbmatrix operator

Definition at line 3 of file zhematrix-_zgbmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.n!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat(matA.n, matA.n);
15 
16  for(CPPL_INT i=0; i<matB.m; i++){
17  for(CPPL_INT j=i; j<matA.n; j++){
18  newmat(i,j) =matA(i,j);
19  }
20  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
21  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
22  newmat(i,j)+=matB(i,j);
23  }
24  }
25 
26  matB.destroy();
27  return _(newmat);
28 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_zgematrix operator+ ( const zhematrix ,
const zgsmatrix  
)
friend
_zgematrix operator+ ( const zhematrix ,
const _zgsmatrix  
)
friend
_zgematrix operator+ ( const zhematrix ,
const zhsmatrix  
)
friend
_zgematrix operator+ ( const zhematrix ,
const _zhsmatrix  
)
friend
_zgematrix operator- ( const zhematrix matA,
const zgematrix matB 
)
friend

zhematrix-zgematrix operator

Definition at line 27 of file zhematrix-zgematrix.hpp.

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.n!=matB.n || matA.n!=matB.m){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a summation." << std::endl
33  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  zgematrix newmat =-matB;
39 
40  for(CPPL_INT i=0; i<matA.n; i++){
41  for(CPPL_INT j=0; j<matA.n; j++){
42  newmat(i,j) += matA(i,j);
43  }
44  }
45 
46  return _(newmat);
47 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator- ( const zhematrix matA,
const _zgematrix matB 
)
friend

_zgematrix-zgematrix operator

Definition at line 25 of file zhematrix-_zgematrix.hpp.

26 {CPPL_VERBOSE_REPORT;
27 #ifdef CPPL_DEBUG
28  if(matA.n!=matB.n || matA.n!=matB.m){
29  ERROR_REPORT;
30  std::cerr << "These two matrises can not make a subtraction." << std::endl
31  << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
32  exit(1);
33  }
34 #endif//CPPL_DEBUG
35 
36  for(CPPL_INT i=0; i<matA.n; i++){
37  for(CPPL_INT j=0; j<matA.n; j++){
38  matB(i,j) =matA(i,j)-matB(i,j);
39  }
40  }
41 
42  return matB;
43 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zhematrix operator- ( const zhematrix matA,
const zhematrix matB 
)
friend

zhematrix-zhematrix operator

Definition at line 85 of file zhematrix-zhematrix.hpp.

86 {CPPL_VERBOSE_REPORT;
87 #ifdef CPPL_DEBUG
88  if(matA.n!=matB.n){
89  ERROR_REPORT;
90  std::cerr << "These two matrises can not make a subtraction." << std::endl
91  << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
92  exit(1);
93  }
94 #endif//CPPL_DEBUG
95 
96  zhematrix newmat(matA.n);
97 
98  for(CPPL_INT j=0; j<matA.n; j++){
99  for(CPPL_INT i=j; i<matA.n; i++){
100  newmat.darray[j][i] =matA.darray[j][i] -matB.darray[j][i];
101  }
102  }
103 
104  return _(newmat);
105 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
_zhematrix operator- ( const zhematrix matA,
const _zhematrix matB 
)
friend

zhematrix-_zhematrix operator

Definition at line 87 of file zhematrix-_zhematrix.hpp.

88 {CPPL_VERBOSE_REPORT;
89 #ifdef CPPL_DEBUG
90  if(matA.n!=matB.n){
91  ERROR_REPORT;
92  std::cerr << "These two matrises can not make a subtraction." << std::endl
93  << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
94  exit(1);
95  }
96 #endif//CPPL_DEBUG
97 
98  for(CPPL_INT j=0; j<matA.n; j++){
99  for(CPPL_INT i=j; i<matA.n; i++){
100  matB.darray[j][i] =matA.darray[j][i]-matB.darray[j][i];
101  }
102  }
103 
104  return matB;
105 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
_zgematrix operator- ( const zhematrix matA,
const zgbmatrix matB 
)
friend

zhematrix-zgbmatrix operator

Definition at line 31 of file zhematrix-zgbmatrix.hpp.

32 {CPPL_VERBOSE_REPORT;
33 #ifdef CPPL_DEBUG
34  if(matA.n!=matB.n || matA.n!=matB.m){
35  ERROR_REPORT;
36  std::cerr << "These two matrises can not make a summation." << std::endl
37  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
38  exit(1);
39  }
40 #endif//CPPL_DEBUG
41 
42  zgematrix newmat(matA.n, matA.n);
43 
44  for(CPPL_INT i=0; i<matB.m; i++){
45  for(CPPL_INT j=0; j<matA.n; j++){
46  newmat(i,j) =matA(i,j);
47  }
48  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
49  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
50  newmat(i,j)-=matB(i,j);
51  }
52  }
53 
54  return _(newmat);
55 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
friend _zhematrix _(zhematrix &)
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix operator- ( const zhematrix matA,
const _zgbmatrix matB 
)
friend

zhematrix-_zgbmatrix operator

Definition at line 32 of file zhematrix-_zgbmatrix.hpp.

33 {CPPL_VERBOSE_REPORT;
34 #ifdef CPPL_DEBUG
35  if(matA.n!=matB.n || matA.n!=matB.m){
36  ERROR_REPORT;
37  std::cerr << "These two matrises can not make a summation." << std::endl
38  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
39  exit(1);
40  }
41 #endif//CPPL_DEBUG
42 
43  zgematrix newmat(matA.n, matA.n);
44 
45  for(CPPL_INT i=0; i<matB.m; i++){
46  for(CPPL_INT j=i; j<matA.n; j++){
47  newmat(i,j) =matA(i,j);
48  }
49  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
50  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
51  newmat(i,j)-=matB(i,j);
52  }
53  }
54 
55  matB.destroy();
56  return _(newmat);
57 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_zgematrix operator- ( const zhematrix ,
const zgsmatrix  
)
friend
_zgematrix operator- ( const zhematrix ,
const _zgsmatrix  
)
friend
_zgematrix operator- ( const zhematrix ,
const zhsmatrix  
)
friend
_zgematrix operator- ( const zhematrix ,
const _zhsmatrix  
)
friend
_zcovector operator* ( const zhematrix mat,
const zcovector vec 
)
friend

zhematrix*zcovector operator

Definition at line 3 of file zhematrix-zcovector.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(mat.n!=vec.l){
7  ERROR_REPORT;
8  std::cerr << "These matrix and vector can not make a product." << std::endl
9  << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zcovector newvec(mat.n);
15  char uplo ='l';
16  comple alpha =comple(1.,0.);
17  CPPL_INT inc =1;
18  comple beta =comple(0.,0.);
19 
20  zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc );
21 
22  return _(newvec);
23 }
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
CPPL_INT l
vector size
Definition: zcovector.hpp:9
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
_zcovector operator* ( const zhematrix mat,
const _zcovector vec 
)
friend

zhematrix*_zcovector operator

Definition at line 3 of file zhematrix-_zcovector.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(mat.n!=vec.l){
7  ERROR_REPORT;
8  std::cerr << "These matrix and vector can not make a product." << std::endl
9  << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zcovector newvec(mat.n);
15  char uplo ='l';
16  comple alpha =comple(1.,0.);
17  CPPL_INT inc =1;
18  comple beta =comple(0.,0.);
19 
20  zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc );
21 
22  vec.destroy();
23  return _(newvec);
24 }
void destroy() const
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store vector data
Definition: _zcovector.hpp:10
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT l
vector size
Definition: _zcovector.hpp:9
_zgematrix operator* ( const zhematrix matA,
const zgematrix matB 
)
friend

zhematrix*zgematrix operator

Definition at line 51 of file zhematrix-zgematrix.hpp.

52 {CPPL_VERBOSE_REPORT;
53 #ifdef CPPL_DEBUG
54  if(matA.n!=matB.m){
55  ERROR_REPORT;
56  std::cerr << "These two matrises can not make a product." << std::endl
57  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
58  exit(1);
59  }
60 #endif//CPPL_DEBUG
61 
62  zgematrix newmat( matA.n, matB.n );
63  char side ='l';
64  char uplo ='l';
65  comple alpha =comple(1.,0.);
66  comple beta =comple(0.,0.);
67 
68  zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m );
69 
70  return _(newmat);
71 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator* ( const zhematrix matA,
const _zgematrix matB 
)
friend

_zgematrix*zgematrix operator

Definition at line 47 of file zhematrix-_zgematrix.hpp.

48 {CPPL_VERBOSE_REPORT;
49 #ifdef CPPL_DEBUG
50  if(matA.n!=matB.m){
51  ERROR_REPORT;
52  std::cerr << "These two matrises can not make a product." << std::endl
53  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
54  exit(1);
55  }
56 #endif//CPPL_DEBUG
57 
58  zgematrix newmat( matA.n, matB.n );
59  char side ='l';
60  char uplo ='l';
61  comple alpha =comple(1.,0.);
62  comple beta =comple(0.,0.);
63 
64  zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m );
65 
66  matB.destroy();
67  return _(newmat);
68 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
void destroy() const
friend _zhematrix _(zhematrix &)
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator* ( const zhematrix matA,
const zhematrix matB 
)
friend

zhematrix*zhematrix operator

Definition at line 109 of file zhematrix-zhematrix.hpp.

110 {CPPL_VERBOSE_REPORT;
111 #ifdef CPPL_DEBUG
112  if(matA.n!=matB.n){
113  ERROR_REPORT;
114  std::cerr << "These two matrises can not make a product." << std::endl
115  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
116  exit(1);
117  }
118 #endif//CPPL_DEBUG
119 
120  matB.complete();
121 
122  zgematrix newmat( matA.n, matB.n );
123  char side ='l';
124  char uplo ='l';
125  comple alpha =comple(1.,0.);
126  comple beta =comple(0.,0.);
127 
128  zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.n, &beta, newmat.array, &newmat.m );
129 
130  return _(newmat);
131 }
void complete() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
_zgematrix operator* ( const zhematrix matA,
const _zhematrix matB 
)
friend

zhematrix*_zhematrix operator

Definition at line 109 of file zhematrix-_zhematrix.hpp.

110 {CPPL_VERBOSE_REPORT;
111 #ifdef CPPL_DEBUG
112  if(matA.n!=matB.n){
113  ERROR_REPORT;
114  std::cerr << "These two matrises can not make a product." << std::endl
115  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
116  exit(1);
117  }
118 #endif//CPPL_DEBUG
119 
120  matB.complete();
121 
122  zgematrix newmat( matA.n, matB.n );
123  char side ='l';
124  char uplo ='l';
125  comple alpha =comple(1.,0.);
126  comple beta =comple(0.,0.);
127 
128  zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.n, &beta, newmat.array, &newmat.m );
129 
130  matB.destroy();
131  return _(newmat);
132 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
void complete() const
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple * array
1D array to store matrix data
Definition: _zhematrix.hpp:12
void destroy() const
friend _zhematrix _(zhematrix &)
_zgematrix operator* ( const zhematrix matA,
const zgbmatrix matB 
)
friend

zhematrix*zgbmatrix operator

Definition at line 59 of file zhematrix-zgbmatrix.hpp.

60 {CPPL_VERBOSE_REPORT;
61 #ifdef CPPL_DEBUG
62  if(matA.n!=matB.m){
63  ERROR_REPORT;
64  std::cerr << "These two matrises can not make a product." << std::endl
65  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
66  exit(1);
67  }
68 #endif//CPPL_DEBUG
69 
70  zgematrix newmat( matA.n, matB.n );
71  newmat.zero();
72 
73  for(CPPL_INT i=0; i<newmat.m; i++){
74  for(CPPL_INT j=0; j<newmat.n; j++){
75  const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1);
76  for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){
77  newmat(i,j)+=matA(i,k)*matB(k,j);
78  }
79  }
80  }
81 
82  return _(newmat);
83 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
friend _zhematrix _(zhematrix &)
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix operator* ( const zhematrix matA,
const _zgbmatrix matB 
)
friend

zhematrix*_zgbmatrix operator

Definition at line 61 of file zhematrix-_zgbmatrix.hpp.

62 {CPPL_VERBOSE_REPORT;
63 #ifdef CPPL_DEBUG
64  if(matA.n!=matB.m){
65  ERROR_REPORT;
66  std::cerr << "These two matrises can not make a product." << std::endl
67  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
68  exit(1);
69  }
70 #endif//CPPL_DEBUG
71 
72  zgematrix newmat( matA.n, matB.n );
73  newmat.zero();
74 
75  for(CPPL_INT i=0; i<newmat.m; i++){
76  for(CPPL_INT j=0; j<newmat.n; j++){
77  const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1);
78  for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){
79  newmat(i,j)+=matA(i,k)*matB(k,j);
80  }
81  }
82  }
83 
84  matB.destroy();
85  return _(newmat);
86 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
friend _zhematrix _(zhematrix &)
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_zgematrix operator* ( const zhematrix ,
const zgsmatrix  
)
friend
_zgematrix operator* ( const zhematrix ,
const _zgsmatrix  
)
friend
_zgematrix operator* ( const zhematrix ,
const zhsmatrix  
)
friend
_zgematrix operator* ( const zhematrix ,
const _zhsmatrix  
)
friend
_zhematrix operator* ( const zhematrix mat,
const double &  d 
)
friend

zhematrix*double operator

Definition at line 28 of file zhematrix-double.hpp.

29 {CPPL_VERBOSE_REPORT;
30  zhematrix newmat(mat.n);
31 
32  const CPPL_INT size =mat.n*mat.n;
33  for(CPPL_INT i=0; i<size; i++){
34  newmat.array[i] =mat.array[i]*d;
35  }
36 
37  return _(newmat);
38 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_zgematrix operator* ( const zhematrix mat,
const comple &  d 
)
friend

zhematrix*comple operator

Definition at line 3 of file zhematrix-complex.hpp.

4 {CPPL_VERBOSE_REPORT;
5  mat.complete();
6  zgematrix newmat(mat.n, mat.n);
7 
8  const CPPL_INT size =mat.n*mat.n;
9  for(CPPL_INT i=0; i<size; i++){
10  newmat.array[i] =mat.array[i]*d;
11  }
12 
13  return _(newmat);
14 }
void complete() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
_zhematrix operator/ ( const zhematrix mat,
const double &  d 
)
friend

zhematrix/double operator

Definition at line 42 of file zhematrix-double.hpp.

43 {CPPL_VERBOSE_REPORT;
44  zhematrix newmat(mat.n);
45 
46  const CPPL_INT size =mat.n*mat.n;
47  for(CPPL_INT i=0; i<size; i++){
48  newmat.array[i] =mat.array[i]/d;
49  }
50 
51  return _(newmat);
52 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_zgematrix operator/ ( const zhematrix mat,
const comple &  d 
)
friend

zhematrix/comple operator

Definition at line 18 of file zhematrix-complex.hpp.

19 {CPPL_VERBOSE_REPORT;
20  mat.complete();
21  zgematrix newmat(mat.n, mat.n);
22 
23  const CPPL_INT size =mat.n*mat.n;
24  for(CPPL_INT i=0; i<size; i++){
25  newmat.array[i] =mat.array[i]/d;
26  }
27 
28  return _(newmat);
29 }
void complete() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
_zhematrix operator* ( const double &  d,
const zhematrix mat 
)
friend

double*zhematrix operator

Definition at line 3 of file double-zhematrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5  zhematrix newmat(mat.n);
6 
7  const CPPL_INT size =mat.n*mat.n;
8  for(CPPL_INT i=0; i<size; i++){
9  newmat.array[i] =d*mat.array[i];
10  }
11 
12  return _(newmat);
13 }
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_zgematrix operator* ( const comple &  d,
const zhematrix mat 
)
friend

comple*zhematrix operator

Definition at line 3 of file complex-zhematrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5  mat.complete();
6  zgematrix newmat(mat.n, mat.n);
7 
8  const CPPL_INT size =mat.n*mat.n;
9  for(CPPL_INT i=0; i<size; i++){
10  newmat.array[i] =d*mat.array[i];
11  }
12 
13  return _(newmat);
14 }
void complete() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
friend _zgematrix i(const zhematrix &)
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
friend _zhematrix _(zhematrix &)

Member Data Documentation

CPPL_INT const& zhematrix::m

matrix row size

Definition at line 10 of file zhematrix.hpp.

Referenced by col(), operator*(), operator+(), operator-(), row(), and zhematrix_small< n >::zhematrix_small().

CPPL_INT zhematrix::n
comple* zhematrix::array
comple** zhematrix::darray

array of pointers of column head addresses

Definition at line 13 of file zhematrix.hpp.

Referenced by _(), chsign(), clear(), complete(), copy(), identity(), operator()(), operator+(), operator+=(), operator-(), operator-=(), read(), resize(), set(), shallow_copy(), swap(), zero(), zhematrix(), and ~zhematrix().


The documentation for this class was generated from the following files: