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

Complex Double-precision General Dence Matrix Class. More...

#include <zgematrix.hpp>

Public Member Functions

 zgematrix ()
 
 zgematrix (const zgematrix &)
 
 zgematrix (const _zgematrix &)
 
 zgematrix (const CPPL_INT &, const CPPL_INT &)
 
 zgematrix (const char *)
 
 ~zgematrix ()
 
comple & operator() (const CPPL_INT &, const CPPL_INT &)
 
comple operator() (const CPPL_INT &, const CPPL_INT &) const
 
zgematrixset (const CPPL_INT &, const CPPL_INT &, const comple &)
 
void write (const char *) const
 
void read (const char *)
 
void clear ()
 
zgematrixzero ()
 
zgematrixidentity ()
 
void chsign ()
 
void copy (const zgematrix &)
 
void shallow_copy (const _zgematrix &)
 
void resize (const CPPL_INT &, const CPPL_INT &)
 
_zrovector row (const CPPL_INT &) const
 
_zcovector col (const CPPL_INT &) const
 
CPPL_INT zgesv (zgematrix &)
 
CPPL_INT zgesv (zcovector &)
 
CPPL_INT zgels (zgematrix &)
 
CPPL_INT zgels (zcovector &)
 
CPPL_INT zgels (zgematrix &, drovector &)
 
CPPL_INT zgels (zcovector &, double &)
 
CPPL_INT zgelss (zcovector &, dcovector &, CPPL_INT &, const double)
 
CPPL_INT zgelss (zgematrix &, dcovector &, CPPL_INT &, const double)
 
CPPL_INT zgeev (std::vector< comple > &)
 
CPPL_INT zgeev (std::vector< comple > &, std::vector< zcovector > &)
 
CPPL_INT zgeev (std::vector< comple > &, std::vector< zrovector > &)
 
CPPL_INT zgesvd (dcovector &, zgematrix &, zgematrix &)
 
zgematrixoperator= (const zgematrix &)
 
zgematrixoperator= (const _zgematrix &)
 
zgematrixoperator+= (const zgematrix &)
 
zgematrixoperator+= (const _zgematrix &)
 
zgematrixoperator+= (const zhematrix &)
 
zgematrixoperator+= (const _zhematrix &)
 
zgematrixoperator+= (const zgbmatrix &)
 
zgematrixoperator+= (const _zgbmatrix &)
 
zgematrixoperator+= (const zgsmatrix &)
 
zgematrixoperator+= (const _zgsmatrix &)
 
zgematrixoperator+= (const zhsmatrix &)
 
zgematrixoperator+= (const _zhsmatrix &)
 
zgematrixoperator-= (const zgematrix &)
 
zgematrixoperator-= (const _zgematrix &)
 
zgematrixoperator-= (const zhematrix &)
 
zgematrixoperator-= (const _zhematrix &)
 
zgematrixoperator-= (const zgbmatrix &)
 
zgematrixoperator-= (const _zgbmatrix &)
 
zgematrixoperator-= (const zgsmatrix &)
 
zgematrixoperator-= (const _zgsmatrix &)
 
zgematrixoperator-= (const zhsmatrix &)
 
zgematrixoperator-= (const _zhsmatrix &)
 
zgematrixoperator*= (const zgematrix &)
 
zgematrixoperator*= (const _zgematrix &)
 
zgematrixoperator*= (const zhematrix &)
 
zgematrixoperator*= (const _zhematrix &)
 
zgematrixoperator*= (const zgbmatrix &)
 
zgematrixoperator*= (const _zgbmatrix &)
 
zgematrixoperator*= (const zgsmatrix &)
 
zgematrixoperator*= (const _zgsmatrix &)
 
zgematrixoperator*= (const zhsmatrix &)
 
zgematrixoperator*= (const _zhsmatrix &)
 
zgematrixoperator*= (const double &)
 
zgematrixoperator*= (const comple &)
 
zgematrixoperator/= (const double &)
 
zgematrixoperator/= (const comple &)
 

Public Attributes

CPPL_INT 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 zgematrix &)
 
void swap (zgematrix &, zgematrix &)
 
_zgematrix _ (zgematrix &)
 
_zgematrix t (const zgematrix &)
 
_zgematrix i (const zgematrix &)
 
_zgematrix conj (const zgematrix &)
 
_zgematrix conjt (const zgematrix &)
 
void idamax (CPPL_INT &, CPPL_INT &, const zgematrix &)
 
comple damax (const zgematrix &)
 
const zgematrixoperator+ (const zgematrix &)
 
_zgematrix operator- (const zgematrix &)
 
_zgematrix operator+ (const zgematrix &, const zgematrix &)
 
_zgematrix operator+ (const zgematrix &, const _zgematrix &)
 
_zgematrix operator+ (const zgematrix &, const zhematrix &)
 
_zgematrix operator+ (const zgematrix &, const _zhematrix &)
 
_zgematrix operator+ (const zgematrix &, const zgbmatrix &)
 
_zgematrix operator+ (const zgematrix &, const _zgbmatrix &)
 
_zgematrix operator+ (const zgematrix &, const zgsmatrix &)
 
_zgematrix operator+ (const zgematrix &, const _zgsmatrix &)
 
_zgematrix operator+ (const zgematrix &, const zhsmatrix &)
 
_zgematrix operator+ (const zgematrix &, const _zhsmatrix &)
 
_zgematrix operator- (const zgematrix &, const zgematrix &)
 
_zgematrix operator- (const zgematrix &, const _zgematrix &)
 
_zgematrix operator- (const zgematrix &, const zhematrix &)
 
_zgematrix operator- (const zgematrix &, const _zhematrix &)
 
_zgematrix operator- (const zgematrix &, const zgbmatrix &)
 
_zgematrix operator- (const zgematrix &, const _zgbmatrix &)
 
_zgematrix operator- (const zgematrix &, const zgsmatrix &)
 
_zgematrix operator- (const zgematrix &, const _zgsmatrix &)
 
_zgematrix operator- (const zgematrix &, const zhsmatrix &)
 
_zgematrix operator- (const zgematrix &, const _zhsmatrix &)
 
_zcovector operator* (const zgematrix &, const zcovector &)
 
_zcovector operator* (const zgematrix &, const _zcovector &)
 
_zgematrix operator* (const zgematrix &, const zgematrix &)
 
_zgematrix operator* (const zgematrix &, const _zgematrix &)
 
_zgematrix operator* (const zgematrix &, const zhematrix &)
 
_zgematrix operator* (const zgematrix &, const _zhematrix &)
 
_zgematrix operator* (const zgematrix &, const zgbmatrix &)
 
_zgematrix operator* (const zgematrix &, const _zgbmatrix &)
 
_zgematrix operator* (const zgematrix &, const zgsmatrix &)
 
_zgematrix operator* (const zgematrix &, const _zgsmatrix &)
 
_zgematrix operator* (const zgematrix &, const zhsmatrix &)
 
_zgematrix operator* (const zgematrix &, const _zhsmatrix &)
 
_zgematrix operator* (const zgematrix &, const double &)
 
_zgematrix operator* (const zgematrix &, const comple &)
 
_zgematrix operator/ (const zgematrix &, const double &)
 
_zgematrix operator/ (const zgematrix &, const comple &)
 
_zgematrix operator* (const double &, const zgematrix &)
 
_zgematrix operator* (const comple &, const zgematrix &)
 
_zgematrix hadamard (const zgematrix &, const zgematrix &)
 

Detailed Description

Complex Double-precision General Dence Matrix Class.

Definition at line 3 of file zgematrix.hpp.

Constructor & Destructor Documentation

zgematrix::zgematrix ( )
inline

zgematrix constructor without arguments

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

References array, darray, m, and n.

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

zgematrix copy constructor

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

References array, darray, i, m, and n.

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

zgematrix constructor to cast _zgematrix

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

References array, _zgematrix::array, _zgematrix::darray, darray, m, _zgematrix::m, _zgematrix::n, n, and _zgematrix::nullify().

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

zgematrix constructor with size specification

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

References array, darray, i, m, and n.

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

zgematrix constructor with filename

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

References array, darray, and read().

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

zgematrix destructor

Definition at line 91 of file zgematrix-constructor.hpp.

References array, and darray.

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

Member Function Documentation

comple & zgematrix::operator() ( const CPPL_INT &  i,
const CPPL_INT &  j 
)
inline

operator() for non-const object

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

References darray, i, m, and n.

Referenced by identity(), operator*=(), operator+=(), operator-=(), read(), and write().

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if( i<0 || j<0 || m<=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 " << m << "x" << n << "." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  //return array[i+m*j];
15  return darray[j][i];
16 }
comple ** darray
array of pointers of column head addresses
Definition: zgematrix.hpp:12
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
comple zgematrix::operator() ( const CPPL_INT &  i,
const CPPL_INT &  j 
) const
inline

operator() for const object

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

References darray, i, m, and n.

21 {CPPL_VERBOSE_REPORT;
22 #ifdef CPPL_DEBUG
23  if( i<0 || j<0 || m<=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 " << m << "x" << n << "." << std::endl;
27  exit(1);
28  }
29 #endif//CPPL_DEBUG
30 
31  //return array[i+m*j];
32  return darray[j][i];
33 }
comple ** darray
array of pointers of column head addresses
Definition: zgematrix.hpp:12
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
zgematrix & zgematrix::set ( const CPPL_INT &  i,
const CPPL_INT &  j,
const comple &  v 
)
inline

set value for const object

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

References darray, i, m, and n.

42 {CPPL_VERBOSE_REPORT;
43 #ifdef CPPL_DEBUG
44  if( i<0 || j<0 || m<=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 " << m << "x" << n << "." << std::endl;
48  exit(1);
49  }
50 #endif//CPPL_DEBUG
51 
52  //array[i+m*j] =v;
53  darray[j][i] =v;
54 
55  return *this;
56 }
comple ** darray
array of pointers of column head addresses
Definition: zgematrix.hpp:12
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void zgematrix::write ( const char *  filename) const
inline

Definition at line 79 of file zgematrix-io.hpp.

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

80 {CPPL_VERBOSE_REPORT;
81  std::ofstream ofs(filename, std::ios::trunc);
82  ofs.setf(std::cout.flags());
83  ofs.precision(std::cout.precision());
84  ofs.width(std::cout.width());
85  ofs.fill(std::cout.fill());
86 
87  ofs << "#zgematrix" << " " << m << " " << n << std::endl;
88  for(CPPL_INT i=0; i<m; i++){
89  for(CPPL_INT j=0; j<n; j++ ){
90  ofs << operator()(i,j) << " ";
91  }
92  ofs << std::endl;
93  }
94 
95  ofs.close();
96 }
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void zgematrix::read ( const char *  filename)
inline

Definition at line 99 of file zgematrix-io.hpp.

References i, m, n, operator()(), and resize().

Referenced by zgematrix().

100 {CPPL_VERBOSE_REPORT;
101  std::ifstream s( filename );
102  if(!s){
103  ERROR_REPORT;
104  std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl;
105  exit(1);
106  }
107 
108  std::string id;
109  s >> id;
110  if( id != "zgematrix" && id != "#zgematrix" ){
111  ERROR_REPORT;
112  std::cerr << "The type name of the file \"" << filename << "\" is not zgematrix." << std::endl
113  << "Its type name was " << id << " ." << std::endl;
114  exit(1);
115  }
116 
117  s >> m >> n;
118  resize(m, n);
119  for(CPPL_INT i=0; i<m; i++){
120  for(CPPL_INT j=0; j<n; j++ ){
121  s >> operator()(i,j);
122  }
123  }
124  if(s.eof()){
125  ERROR_REPORT;
126  std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
127  << "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;
128  exit(1);
129  }
130 
131  s >> id;
132  if(!s.eof()){
133  ERROR_REPORT;
134  std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
135  << "Most likely, there are extra data components." << std::endl;
136  exit(1);
137  }
138 
139 
140  s.close();
141 }
void resize(const CPPL_INT &, const CPPL_INT &)
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void zgematrix::clear ( )
inline

clear all the matrix data and set the sizes 0

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

References array, darray, m, and n.

Referenced by zgels(), and zgelss().

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

change the matrix into a zero matrix

Definition at line 15 of file zgematrix-misc.hpp.

References array, i, m, and n.

Referenced by operator*(), operator*=(), and _zgsmatrix::to_zgematrix().

16 {CPPL_VERBOSE_REPORT;
17  const CPPL_INT size =m*n;
18  for(CPPL_INT i=0; i<size; i++){
19  array[i] =comple(0.,0.);
20  }
21  return *this;
22 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
zgematrix & zgematrix::identity ( )
inline

change the matrix into an identity matrix

Definition at line 26 of file zgematrix-misc.hpp.

References array, i, m, n, and operator()().

Referenced by i().

27 {CPPL_VERBOSE_REPORT;
28 #ifdef CPPL_DEBUG
29  if(m!=n){
30  ERROR_REPORT;
31  std::cerr << "Only square matrix can be a identity matrix." << std::endl
32  << "The matrix size was " << m << "x" << n << "." << std::endl;
33  exit(1);
34  }
35 #endif//CPPL_DEBUG
36 
37  const CPPL_INT size =m*n;
38  for(CPPL_INT i=0; i<size; i++){
39  array[i] =comple(0.,0.);
40  }
41  for(CPPL_INT i=0; i<m; i++){
42  operator()(i,i) =comple(1.,0.);
43  }
44 
45  return *this;
46 }
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void zgematrix::chsign ( )
inline

change sign(+/-) of the matrix

Definition at line 50 of file zgematrix-misc.hpp.

References array, i, m, and n.

51 {CPPL_VERBOSE_REPORT;
52  const CPPL_INT size =m*n;
53  for(CPPL_INT i=0; i<size; i++){
54  array[i] =-array[i];
55  }
56 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void zgematrix::copy ( const zgematrix mat)
inline

make a deep copy of the matrix

Definition at line 60 of file zgematrix-misc.hpp.

References array, darray, i, m, and n.

Referenced by operator=().

61 {CPPL_VERBOSE_REPORT;
62  m =mat.m;
63  n =mat.n;
64  delete [] array;
65  array =new comple[m*n];
66  delete [] darray;
67  darray =new comple*[n];
68  for(int i=0; i<n; i++){
69  darray[i] =&array[i*m];
70  }
71 
72  CPPL_INT size =mat.m*mat.n;
73  CPPL_INT inc =1;
74  zcopy_(&size, mat.array, &inc, array, &inc);
75 }
comple ** darray
array of pointers of column head addresses
Definition: zgematrix.hpp:12
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void zgematrix::shallow_copy ( const _zgematrix mat)
inline

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

Definition at line 80 of file zgematrix-misc.hpp.

References array, _zgematrix::array, _zgematrix::darray, darray, m, _zgematrix::m, _zgematrix::n, n, and _zgematrix::nullify().

Referenced by operator=().

81 {CPPL_VERBOSE_REPORT;
82  m =mat.m;
83  n =mat.n;
84  delete [] array;
85  array =mat.array;
86  delete [] darray;
87  darray =mat.darray;
88 
89  mat.nullify();
90 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
comple ** darray
array of pointers of column head addresses
Definition: zgematrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void nullify() const
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
comple ** darray
array of pointers of column head addresses
Definition: _zgematrix.hpp:12
void zgematrix::resize ( const CPPL_INT &  _m,
const CPPL_INT &  _n 
)
inline

resize the matrix

Definition at line 94 of file zgematrix-misc.hpp.

References array, darray, i, m, and n.

Referenced by read(), and zgesvd().

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

get row of the matrix

Definition at line 122 of file zgematrix-misc.hpp.

References _, m, and n.

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

get column of the matrix

Definition at line 142 of file zgematrix-misc.hpp.

References _, i, m, and n.

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

solve A*X=Y using zgesv
The argument is zgematrix Y. Y is overwritten and become the solution X. A is also overwritten and become P*l*U.

Definition at line 5 of file zgematrix-lapack.hpp.

References array, m, and n.

Referenced by i().

6 {CPPL_VERBOSE_REPORT;
7 #ifdef CPPL_DEBUG
8  if(m!=n || m!=mat.m){
9  ERROR_REPORT;
10  std::cerr << "These two matrices cannot be solved." << std::endl
11  << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl;
12  exit(1);
13  }
14 #endif//CPPL_DEBUG
15 
16  CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1);
17  zgesv_(&n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, &INFO);
18  delete [] IPIV;
19 
20  if(INFO!=0){
21  WARNING_REPORT;
22  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
23  }
24  return INFO;
25 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT zgematrix::zgesv ( zcovector vec)
inline

solve A*x=y using zgesv
The argument is zcovector y. y is overwritten and become the solution x. A is also overwritten and become P*l*U.

Definition at line 31 of file zgematrix-lapack.hpp.

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

32 {CPPL_VERBOSE_REPORT;
33 #ifdef CPPL_DEBUG
34  if(m!=n || m!=vec.l){
35  ERROR_REPORT;
36  std::cerr << "These matrix and vector cannot be solved." << std::endl
37  << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl;
38  exit(1);
39  }
40 #endif//CPPL_DEBUG
41 
42  CPPL_INT NRHS(1), LDA(n), *IPIV(new CPPL_INT[n]), LDB(vec.l), INFO(1);
43  zgesv_(&n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, &INFO);
44  delete [] IPIV;
45 
46  if(INFO!=0){
47  WARNING_REPORT;
48  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
49  }
50  return INFO;
51 }
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: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT zgematrix::zgels ( zgematrix mat)
inline

solve overdetermined or underdetermined A*X=Y using zgels

Definition at line 59 of file zgematrix-lapack.hpp.

References array, clear(), i, m, n, and swap.

60 {CPPL_VERBOSE_REPORT;
61 #ifdef CPPL_DEBUG
62  if(m!=mat.m){
63  ERROR_REPORT;
64  std::cerr << "These two matrices cannot be solved." << std::endl
65  << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl;
66  exit(1);
67  }
68 #endif//CPPL_DEBUG
69 
70  if(m<n){ //underdetermined
71  zgematrix tmp(n,mat.n);
72  for(CPPL_INT i=0; i<mat.m; i++){
73  for(CPPL_INT j=0; j<mat.n; j++){
74  tmp(i,j) =mat(i,j);
75  }
76  }
77  mat.clear();
78  swap(mat,tmp);
79  }
80 
81  char TRANS('n');
82  CPPL_INT NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1);
83  comple *WORK(new comple[LWORK]);
84  zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, mat.array, &LDB, WORK, &LWORK, &INFO);
85  delete [] WORK;
86 
87  if(m>n){ //overdetermined
88  zgematrix tmp(n,mat.n);
89  for(CPPL_INT i=0; i<tmp.m; i++){
90  for(CPPL_INT j=0; j<tmp.n; j++){
91  tmp(i,j) =mat(i,j);
92  }
93  }
94  mat.clear();
95  swap(mat,tmp);
96  }
97 
98  if(INFO!=0){
99  WARNING_REPORT;
100  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
101  }
102  return INFO;
103 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void clear()
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
CPPL_INT zgematrix::zgels ( zcovector vec)
inline

solve overdetermined or underdetermined A*x=y using zgels

Definition at line 107 of file zgematrix-lapack.hpp.

References zcovector::array, array, zcovector::clear(), i, zcovector::l, m, n, and swap.

108 {CPPL_VERBOSE_REPORT;
109 #ifdef CPPL_DEBUG
110  if(m!=vec.l){
111  ERROR_REPORT;
112  std::cerr << "These matrix and vector cannot be solved." << std::endl
113  << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl;
114  exit(1);
115  }
116 #endif//CPPL_DEBUG
117 
118  if(m<n){ //underdetermined
119  zcovector tmp(n);
120  for(CPPL_INT i=0; i<vec.l; i++){
121  tmp(i)=vec(i);
122  }
123  vec.clear();
124  swap(vec,tmp);
125  }
126 
127  char TRANS('n');
128  CPPL_INT NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1);
129  comple *WORK(new comple[LWORK]);
130  zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, vec.array, &LDB, WORK, &LWORK, &INFO);
131  delete [] WORK;
132 
133  if(m>n){ //overdetermined
134  zcovector tmp(n);
135  for(CPPL_INT i=0; i<tmp.l; i++){
136  tmp(i)=vec(i);
137  }
138  vec.clear();
139  swap(vec,tmp);
140  }
141 
142  if(INFO!=0){
143  WARNING_REPORT;
144  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
145  }
146  return INFO;
147 }
void clear()
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
CPPL_INT l
vector size
Definition: zcovector.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT zgematrix::zgels ( zgematrix mat,
drovector residual 
)
inline

solve overdetermined or underdetermined A*X=Y using zgels with the sum of residual squares output
The residual is set as the columnwise sum of residual squares for overdetermined problems while it is always zero for underdetermined problems.

Definition at line 156 of file zgematrix-lapack.hpp.

References array, clear(), i, drovector::l, m, n, drovector::resize(), swap, and drovector::zero().

157 {CPPL_VERBOSE_REPORT;
158 #ifdef CPPL_DEBUG
159  if(m!=mat.m){
160  ERROR_REPORT;
161  std::cerr << "These two matrices cannot be solved." << std::endl
162  << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl;
163  exit(1);
164  }
165 #endif//CPPL_DEBUG
166 
167  residual.resize(mat.n);
168  residual.zero();
169 
170  if(m<n){ //underdetermined
171  zgematrix tmp(n,mat.n);
172  for(CPPL_INT i=0; i<mat.m; i++){
173  for(CPPL_INT j=0; j<mat.n; j++){
174  tmp(i,j) =mat(i,j);
175  }
176  }
177  mat.clear();
178  swap(mat,tmp);
179  }
180 
181  char TRANS('n');
182  CPPL_INT NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1);
183  comple *WORK(new comple[LWORK]);
184  zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, mat.array, &LDB, WORK, &LWORK, &INFO);
185  delete [] WORK;
186 
187  if(m>n){ //overdetermined
188  for(CPPL_INT i=0; i<residual.l; i++){
189  for(CPPL_INT j=0; j<m-n; j++){
190  residual(i) += std::norm(mat(n+j,i));
191  }
192  }
193 
194  zgematrix tmp(n,mat.n);
195  for(CPPL_INT i=0; i<tmp.m; i++){
196  for(CPPL_INT j=0; j<tmp.n; j++){
197  tmp(i,j) =mat(i,j);
198  }
199  }
200  mat.clear();
201  swap(mat,tmp);
202  }
203 
204  if(INFO!=0){
205  WARNING_REPORT;
206  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
207  }
208  return INFO;
209 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT l
vector size
Definition: drovector.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
drovector & zero()
void clear()
drovector & resize(const CPPL_INT &, const CPPL_INT=0)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
CPPL_INT zgematrix::zgels ( zcovector vec,
double &  residual 
)
inline

solve overdetermined or underdetermined A*x=y using zgels with the sum of residual squares output
The residual is set as the sum of residual squares for overdetermined problems while it is always zero for underdetermined problems.

Definition at line 217 of file zgematrix-lapack.hpp.

References zcovector::array, array, zcovector::clear(), i, zcovector::l, m, n, and swap.

218 {CPPL_VERBOSE_REPORT;
219 #ifdef CPPL_DEBUG
220  if(m!=vec.l){
221  ERROR_REPORT;
222  std::cerr << "These matrix and vector cannot be solved." << std::endl
223  << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl;
224  exit(1);
225  }
226 #endif//CPPL_DEBUG
227 
228  residual=0.0;
229 
230  if(m<n){ //underdetermined
231  zcovector tmp(n);
232  for(CPPL_INT i=0; i<vec.l; i++){
233  tmp(i)=vec(i);
234  }
235  vec.clear();
236  swap(vec,tmp);
237  }
238 
239  char TRANS('n');
240  CPPL_INT NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1);
241  comple *WORK(new comple[LWORK]);
242  zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, vec.array, &LDB, WORK, &LWORK, &INFO);
243  delete [] WORK;
244 
245  if(m>n){ //overdetermined
246  for(CPPL_INT i=0; i<m-n; i++){
247  residual += std::norm(vec(n+i));
248  }
249 
250  zcovector tmp(n);
251  for(CPPL_INT i=0; i<tmp.l; i++){
252  tmp(i) =vec(i);
253  }
254  vec.clear();
255  swap(vec,tmp);
256  }
257 
258  if(INFO!=0){
259  WARNING_REPORT;
260  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
261  }
262  return INFO;
263 }
void clear()
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
CPPL_INT l
vector size
Definition: zcovector.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT zgematrix::zgelss ( zcovector B,
dcovector S,
CPPL_INT &  RANK,
const double  RCOND = -1. 
)
inline

calculate the least-squares-least-norm solution for overdetermined or underdetermined A*x=y using zgelss

Definition at line 272 of file zgematrix-lapack.hpp.

References zcovector::array, array, dcovector::array, zcovector::clear(), i, zcovector::l, m, n, dcovector::resize(), and swap.

274 {CPPL_VERBOSE_REPORT;
275 #ifdef CPPL_DEBUG
276  if(m!=B.l){
277  ERROR_REPORT;
278  std::cerr << "These matrix and vector cannot be solved." << std::endl
279  << "Your input was (" << m << "x" << n << ") and (" << B.l << ")." << std::endl;
280  exit(1);
281  }
282 #endif//CPPL_DEBUG
283 
284  if(m<n){ //underdetermined
285  zcovector tmp(n);
286  for(CPPL_INT i=0; i<B.l; i++){
287  tmp(i)=B(i);
288  }
289  B.clear();
290  swap(B,tmp);
291  }
292 
293  S.resize(std::min(m,n));
294 
295  CPPL_INT NRHS(1), LDA(m), LDB(B.l), LWORK(2*std::min(m,n) +std::max(std::max(m,n),NRHS)), INFO(1);
296  double *RWORK(new double[5*std::min(m,n)]);
297  comple *WORK(new comple[LWORK]);
298  zgelss_(&m, &n, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, WORK, &LWORK, RWORK, &INFO);
299  delete [] RWORK;
300  delete [] WORK;
301 
302  if(INFO!=0){
303  WARNING_REPORT;
304  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
305  }
306  return INFO;
307 }
void clear()
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
CPPL_INT l
vector size
Definition: zcovector.hpp:9
dcovector & resize(const CPPL_INT &, const CPPL_INT=0)
friend _zgematrix i(const zgematrix &)
double * array
1D array to store vector data
Definition: dcovector.hpp:11
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT zgematrix::zgelss ( zgematrix B,
dcovector S,
CPPL_INT &  RANK,
const double  RCOND = -1. 
)
inline

calculate the least-squares-least-norm solution for overdetermined or underdetermined A*x=y using zgelss

Definition at line 312 of file zgematrix-lapack.hpp.

References array, dcovector::array, clear(), i, m, n, dcovector::resize(), and swap.

314 {CPPL_VERBOSE_REPORT;
315 #ifdef CPPL_DEBUG
316  if(m!=B.m){
317  ERROR_REPORT;
318  std::cerr << "These matrix and vector cannot be solved." << std::endl
319  << "Your input was (" << m << "x" << n << ") and (" << B.m << "x" << B.n << ")." << std::endl;
320  exit(1);
321  }
322 #endif//CPPL_DEBUG
323 
324  if(m<n){ //underdetermined
325  zgematrix tmp(n,B.n);
326  for(CPPL_INT i=0; i<B.m; i++){
327  for(CPPL_INT j=0; j<B.n; j++){
328  tmp(i,j)=B(i,j);
329  }
330  }
331  B.clear();
332  swap(B,tmp);
333  }
334 
335  S.resize(std::min(m,n));
336 
337  CPPL_INT NRHS(B.n), LDA(m), LDB(B.m), LWORK(2*std::min(m,n) +std::max(std::max(m,n),NRHS)), INFO(1);
338  double *RWORK(new double[5*std::min(m,n)]);
339  comple *WORK(new comple[LWORK]);
340  zgelss_(&m, &n, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, WORK, &LWORK, RWORK, &INFO);
341  delete [] RWORK;
342  delete [] WORK;
343 
344  if(INFO!=0){
345  WARNING_REPORT;
346  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
347  }
348  return INFO;
349 }
dcovector & resize(const CPPL_INT &, const CPPL_INT=0)
friend _zgematrix i(const zgematrix &)
double * array
1D array to store vector data
Definition: dcovector.hpp:11
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void clear()
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
CPPL_INT zgematrix::zgeev ( std::vector< comple > &  w)
inline

calculate eigenvalues
The argument need not to be initialized. w is overwitten and become eigenvalues. This matrix is also overwritten.

Definition at line 360 of file zgematrix-lapack.hpp.

References array, m, and n.

361 {CPPL_VERBOSE_REPORT;
362 #ifdef CPPL_DEBUG
363  if(m!=n){
364  ERROR_REPORT;
365  std::cerr << "This matrix cannot have eigenvalues." << std::endl
366  << "Your input was (" << m << "x" << n << ")." << std::endl;
367  exit(1);
368  }
369 #endif//CPPL_DEBUG
370 
371  w.resize(n);
372 
373  char JOBVL('n'), JOBVR('n');
374  CPPL_INT LDA(n), LDVL(1), LDVR(1), LWORK(4*n), INFO(1);
375  double *RWORK(new double[2*n]);
376  comple *VL(NULL), *VR(NULL), *WORK(new comple[LWORK]);
377  zgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &w[0], VL, &LDVL, VR, &LDVR, WORK, &LWORK, RWORK, &INFO);
378  delete [] RWORK;
379  delete [] WORK;
380  delete [] VL;
381  delete [] VR;
382 
383  if(INFO!=0){
384  WARNING_REPORT;
385  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
386  }
387  return INFO;
388 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT zgematrix::zgeev ( std::vector< comple > &  w,
std::vector< zcovector > &  vr 
)
inline

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

Definition at line 396 of file zgematrix-lapack.hpp.

References array, i, m, and n.

398 {CPPL_VERBOSE_REPORT;
399 #ifdef CPPL_DEBUG
400  if(m!=n){
401  ERROR_REPORT;
402  std::cerr << "This matrix cannot have eigenvalues." << std::endl
403  << "Your input was (" << m << "x" << n << ")." << std::endl;
404  exit(1);
405  }
406 #endif//CPPL_DEBUG
407 
408  w.resize(n);
409  vr.resize(n);
410  for(CPPL_INT i=0; i<n; i++){
411  vr[i].resize(n);
412  }
413 
414  zgematrix VR(n,n);
415  char JOBVL('n'), JOBVR('V');
416  CPPL_INT LDA(n), LDVL(1), LDVR(n), LWORK(4*n), INFO(1);
417  double *RWORK(new double[2*n]);
418  comple *VL(NULL), *WORK(new comple[LWORK]);
419  zgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &w[0], VL, &LDVL, VR.array, &LDVR, WORK, &LWORK, RWORK, &INFO);
420  delete [] RWORK;
421  delete [] WORK;
422  delete [] VL;
423 
424  //// forming ////
425  for(CPPL_INT j=0; j<n; j++){
426  for(CPPL_INT i=0; i<n; i++){
427  vr[j](i) = VR(i,j);
428  }
429  }
430 
431  if(INFO!=0){
432  WARNING_REPORT;
433  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
434  }
435  return INFO;
436 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT zgematrix::zgeev ( std::vector< comple > &  w,
std::vector< zrovector > &  vl 
)
inline

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

Definition at line 444 of file zgematrix-lapack.hpp.

References array, conj(), i, m, and n.

446 {CPPL_VERBOSE_REPORT;
447 #ifdef CPPL_DEBUG
448  if(m!=n){
449  ERROR_REPORT;
450  std::cerr << "This matrix cannot have eigenvalues." << std::endl
451  << "Your input was (" << m << "x" << n << ")." << std::endl;
452  exit(1);
453  }
454 #endif//CPPL_DEBUG
455 
456  w.resize(n);
457  vl.resize(n);
458  for(CPPL_INT i=0; i<n; i++){
459  vl[i].resize(n);
460  }
461  zgematrix VL(n,n);
462 
463  char JOBVL('V'), JOBVR('n');
464  CPPL_INT LDA(n), LDVL(n), LDVR(1), LWORK(4*n), INFO(1);
465  double *RWORK(new double[2*n]);
466  comple *VR(NULL), *WORK(new comple[LWORK]);
467  zgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &w[0], VL.array, &LDVL, VR, &LDVR, WORK, &LWORK, RWORK, &INFO);
468  delete [] RWORK;
469  delete [] WORK;
470  delete [] VR;
471 
472  //// forming ////
473  for(CPPL_INT j=0; j<n; j++){
474  for(CPPL_INT i=0; i<n; i++){
475  vl[j](i) = std::conj(VL(i,j));
476  }
477  }
478 
479  if(INFO!=0){
480  WARNING_REPORT;
481  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
482  }
483  return INFO;
484 }
friend _zgematrix i(const zgematrix &)
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT zgematrix::zgesvd ( dcovector S,
zgematrix U,
zgematrix VT 
)
inline

compute the singular value decomposition (SVD)
The arguments are zcocector S, zgematrix U and VT. All of them need not to be initialized. S, U and VT are overwitten and become singular values, left singular vectors, and right singular vectors respectively. This matrix also overwritten.

Definition at line 507 of file zgematrix-lapack.hpp.

References array, dcovector::array, m, n, resize(), and dcovector::resize().

508 {CPPL_VERBOSE_REPORT;
509  char JOBU('A'), JOBVT('A');
510  CPPL_INT LDA(m), LDU(m), LDVT(n), LWORK(std::max(3*std::min(m,n)+std::max(m,n),5*std::min(m,n))), INFO(1);
511  double *RWORK(new double[5*std::min(m,n)]);
512  comple *WORK(new comple[LWORK]);
513  S.resize(std::min(m,n));
514  U.resize(LDU,m);
515  VT.resize(LDVT,n);
516 
517  zgesvd_(&JOBU, &JOBVT, &m, &n, array, &LDA, S.array, U.array, &LDU, VT.array, &LDVT, WORK, &LWORK, RWORK, &INFO);
518  delete [] RWORK;
519  delete [] WORK;
520 
521  if(INFO!=0){
522  WARNING_REPORT;
523  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
524  }
525  return INFO;
526 }
void resize(const CPPL_INT &, const CPPL_INT &)
dcovector & resize(const CPPL_INT &, const CPPL_INT=0)
double * array
1D array to store vector data
Definition: dcovector.hpp:11
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
zgematrix & zgematrix::operator= ( const zgematrix mat)
inline

zgematrix=zgematrix operator

Definition at line 3 of file zgematrix-zgematrix.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 zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
zgematrix & zgematrix::operator= ( const _zgematrix mat)
inline

zgematrix=_zgematrix operator

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

References shallow_copy().

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

zgematrix+=zgematrix operator

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

References array, i, m, and n.

18 {CPPL_VERBOSE_REPORT;
19 #ifdef CPPL_DEBUG
20  if(n!=mat.n || m!=mat.m){
21  ERROR_REPORT;
22  std::cerr << "These two matrises can not make a summation." << std::endl
23  << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl;
24  exit(1);
25  }
26 #endif//CPPL_DEBUG
27 
28  const CPPL_INT size =m*n;
29  for(CPPL_INT i=0; i<size; i++){
30  array[i]+=mat.array[i];
31  }
32  return *this;
33 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
zgematrix & zgematrix::operator+= ( const _zgematrix mat)
inline

zgematrix+=_zgematrix operator

Definition at line 15 of file zgematrix-_zgematrix.hpp.

References array, _zgematrix::array, _zgematrix::destroy(), i, _zgematrix::m, m, n, and _zgematrix::n.

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

zgematrix+=zhematrix operator

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

References i, m, n, zhematrix::n, and operator()().

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

zgematrix+=_zhematrix operator

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

References _zhematrix::destroy(), i, m, n, _zhematrix::n, and operator()().

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

zgematrix+=zgbmatrix operator

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

References i, zgbmatrix::kl, zgbmatrix::ku, m, zgbmatrix::m, zgbmatrix::n, n, and operator()().

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(n!=mat.n || m!=mat.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  for(CPPL_INT i=0; i<mat.m; i++){
15  const CPPL_INT jmax =std::min(n,i+mat.ku+1);
16  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
17  operator()(i,j) += mat(i,j);
18  }
19  }
20 
21  return *this;
22 }
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
zgematrix & zgematrix::operator+= ( const _zgbmatrix mat)
inline

zgematrix+=_zgbmatrix operator

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

References _zgbmatrix::destroy(), i, _zgbmatrix::kl, _zgbmatrix::ku, m, _zgbmatrix::m, _zgbmatrix::n, n, and operator()().

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

zgematrix operator-=

Definition at line 37 of file zgematrix-zgematrix.hpp.

References array, i, m, and n.

38 {CPPL_VERBOSE_REPORT;
39 #ifdef CPPL_DEBUG
40  if(n!=mat.n || m!=mat.m){
41  ERROR_REPORT;
42  std::cerr << "These two matrises can not make a sutraction." << std::endl
43  << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl;
44  exit(1);
45  }
46 #endif//CPPL_DEBUG
47 
48  const CPPL_INT size =m*n;
49  for(CPPL_INT i=0; i<size; i++){
50  array[i]-=mat.array[i];
51  }
52  return *this;
53 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
zgematrix & zgematrix::operator-= ( const _zgematrix mat)
inline

zgematrix-=_zgematrix operator

Definition at line 37 of file zgematrix-_zgematrix.hpp.

References array, _zgematrix::array, _zgematrix::destroy(), i, _zgematrix::m, m, n, and _zgematrix::n.

38 {CPPL_VERBOSE_REPORT;
39 #ifdef CPPL_DEBUG
40  if(n!=mat.n || m!=mat.m){
41  ERROR_REPORT;
42  std::cerr << "These two matrises can not make a sutraction." << std::endl
43  << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl;
44  exit(1);
45  }
46 #endif//CPPL_DEBUG
47 
48  const CPPL_INT size =m*n;
49  for(CPPL_INT i=0; i<size; i++){
50  array[i] -= mat.array[i];
51  }
52 
53  mat.destroy();
54  return *this;
55 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void destroy() const
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
zgematrix & zgematrix::operator-= ( const zhematrix mat)
inline

zgematrix-=zhematrix operator

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

References i, m, n, zhematrix::n, and operator()().

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

zgematrix-=_zhematrix operator

Definition at line 26 of file zgematrix-_zhematrix.hpp.

References _zhematrix::destroy(), i, m, n, _zhematrix::n, and operator()().

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

zgematrix-=zgbmatrix operator

Definition at line 26 of file zgematrix-zgbmatrix.hpp.

References i, zgbmatrix::kl, zgbmatrix::ku, m, zgbmatrix::m, zgbmatrix::n, n, and operator()().

27 {CPPL_VERBOSE_REPORT;
28 #ifdef CPPL_DEBUG
29  if(n!=mat.n || m!=mat.m){
30  ERROR_REPORT;
31  std::cerr << "These two matrises can not make a subtraction." << std::endl
32  << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl;
33  exit(1);
34  }
35 #endif//CPPL_DEBUG
36 
37  for(CPPL_INT i=0; i<mat.m; i++){
38  const CPPL_INT jmax =std::min(n,i+mat.ku+1);
39  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
40  operator()(i,j) -= mat(i,j);
41  }
42  }
43 
44  return *this;
45 }
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
zgematrix & zgematrix::operator-= ( const _zgbmatrix mat)
inline

zgematrix-=_zgbmatrix operator

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

References _zgbmatrix::destroy(), i, _zgbmatrix::kl, _zgbmatrix::ku, m, _zgbmatrix::m, _zgbmatrix::n, n, and operator()().

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(n!=mat.n || m!=mat.m){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a subtraction." << std::endl
33  << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  for(CPPL_INT i=0; i<mat.m; i++){
39  const CPPL_INT jmax =std::min(n,i+mat.ku+1);
40  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
41  operator()(i,j) -= mat(i,j);
42  }
43  }
44 
45  mat.destroy();
46  return *this;
47 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
void destroy() const
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
zgematrix& zgematrix::operator-= ( const zgsmatrix )
inline
zgematrix& zgematrix::operator-= ( const _zgsmatrix )
inline
zgematrix& zgematrix::operator-= ( const zhsmatrix )
inline
zgematrix& zgematrix::operator-= ( const _zhsmatrix )
inline
zgematrix & zgematrix::operator*= ( const zgematrix mat)
inline

zgematrix operator*=

Definition at line 57 of file zgematrix-zgematrix.hpp.

References array, m, n, and swap.

58 {CPPL_VERBOSE_REPORT;
59 #ifdef CPPL_DEBUG
60  if(n!=mat.m){
61  ERROR_REPORT;
62  std::cerr << "These two matrises can not make a product." << std::endl
63  << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl;
64  exit(1);
65  }
66 #endif//CPPL_DEBUG
67 
68  zgematrix newmat( m, mat.n );
69  char transa ='n';
70  char transb ='n';
71  comple alpha =comple(1.,0.);
72  comple beta =comple(0.,0.);
73 
74  zgemm_( &transa, &transb, &m, &mat.n, &n, &alpha, array, &m, mat.array, &mat.m, &beta, newmat.array, &m );
75 
76  swap(*this,newmat);
77  return *this;
78 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
zgematrix & zgematrix::operator*= ( const _zgematrix mat)
inline

zgematrix*=_zgematrix operator

Definition at line 59 of file zgematrix-_zgematrix.hpp.

References array, _zgematrix::array, _zgematrix::destroy(), _zgematrix::m, m, _zgematrix::n, n, and swap.

60 {CPPL_VERBOSE_REPORT;
61 #ifdef CPPL_DEBUG
62  if(n!=mat.m){
63  ERROR_REPORT;
64  std::cerr << "These two matrises can not make a product." << std::endl
65  << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl;
66  exit(1);
67  }
68 #endif//CPPL_DEBUG
69 
70  zgematrix newmat( m, mat.n );
71  char transa ='n';
72  char transb ='n';
73  comple alpha =comple(1.,0.);
74  comple beta =comple(0.,0.);
75 
76  zgemm_( &transa, &transb, &m, &mat.n, &n, &alpha, array, &m, mat.array, &mat.m, &beta, newmat.array, &m );
77 
78  swap(*this,newmat);
79  mat.destroy();
80  return *this;
81 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void destroy() const
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
zgematrix & zgematrix::operator*= ( const zhematrix mat)
inline

zgematrix*=zhematrix operator

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

References array, zhematrix::array, m, n, zhematrix::n, and swap.

48 {CPPL_VERBOSE_REPORT;
49 #ifdef CPPL_DEBUG
50  if(n!=mat.n){
51  ERROR_REPORT;
52  std::cerr << "These two matrises can not make a product." << std::endl
53  << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl;
54  exit(1);
55  }
56 #endif//CPPL_DEBUG
57 
58  zgematrix newmat( m, mat.n );
59  char side ='R';
60  char uplo ='l';
61  comple alpha =comple(1.,0.);
62  comple beta =comple(0.,0.);
63 
64  zhemm_( &side, &uplo, &mat.n, &n, &alpha, mat.array, &mat.n, array, &m, &beta, newmat.array, &newmat.m );
65 
66  swap(*this,newmat);
67  return *this;
68 }
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
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
zgematrix & zgematrix::operator*= ( const _zhematrix mat)
inline

zgematrix*=_zhematrix operator

Definition at line 49 of file zgematrix-_zhematrix.hpp.

References array, _zhematrix::array, _zhematrix::destroy(), m, n, _zhematrix::n, and swap.

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

zgematrix*=zgbmatrix operator

Definition at line 48 of file zgematrix-zgbmatrix.hpp.

References i, zgbmatrix::kl, zgbmatrix::ku, m, zgbmatrix::m, n, zgbmatrix::n, operator()(), swap, and zero().

49 {CPPL_VERBOSE_REPORT;
50 #ifdef CPPL_DEBUG
51  if(n!=mat.m){
52  ERROR_REPORT;
53  std::cerr << "These two matrises can not make a product." << std::endl
54  << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl;
55  exit(1);
56  }
57 #endif//CPPL_DEBUG
58  zgematrix newmat(m,mat.n);
59  newmat.zero();
60 
61  for(CPPL_INT i=0; i<newmat.m; i++){
62  for(CPPL_INT j=0; j<newmat.n; j++){
63  const CPPL_INT kmax =std::min(mat.m,j+mat.kl+1);
64  for(CPPL_INT k=std::max(CPPL_INT(0),j-mat.ku); k<kmax; k++){
65  newmat(i,j) += operator()(i,k)*mat(k,j);
66  }
67  }
68  }
69 
70  swap(*this,newmat);
71  return *this;
72 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend void swap(zgematrix &, zgematrix &)
zgematrix & zgematrix::operator*= ( const _zgbmatrix mat)
inline

zgematrix*=_zgbmatrix operator

Definition at line 50 of file zgematrix-_zgbmatrix.hpp.

References _zgbmatrix::destroy(), i, _zgbmatrix::kl, _zgbmatrix::ku, m, _zgbmatrix::m, n, _zgbmatrix::n, operator()(), swap, and zero().

51 {CPPL_VERBOSE_REPORT;
52 #ifdef CPPL_DEBUG
53  if(n!=mat.m){
54  ERROR_REPORT;
55  std::cerr << "These two matrises can not make a product." << std::endl
56  << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl;
57  exit(1);
58  }
59 #endif//CPPL_DEBUG
60 
61  zgematrix newmat(m,mat.n);
62  newmat.zero();
63 
64  for(CPPL_INT i=0; i<newmat.m; i++){
65  for(CPPL_INT j=0; j<newmat.n; j++){
66  const CPPL_INT kmax =std::min(mat.m,j+mat.kl+1);
67  for(CPPL_INT k=std::max(CPPL_INT(0),j-mat.ku); k<kmax; k++){
68  newmat(i,j) += operator()(i,k)*mat(k,j);
69  }
70  }
71  }
72 
73  swap(*this,newmat);
74  mat.destroy();
75  return *this;
76 }
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
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgematrix-io.hpp:3
void destroy() const
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
friend void swap(zgematrix &, zgematrix &)
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
zgematrix& zgematrix::operator*= ( const zgsmatrix )
inline
zgematrix& zgematrix::operator*= ( const _zgsmatrix )
inline
zgematrix& zgematrix::operator*= ( const zhsmatrix )
inline
zgematrix& zgematrix::operator*= ( const _zhsmatrix )
inline
zgematrix & zgematrix::operator*= ( const double &  d)
inline

zgematrix*=double operator

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

References array, m, and n.

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

zgematrix*=comple operator

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

References array, m, and n.

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

zgematrix/=double operator

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

References array, m, and n.

14 {CPPL_VERBOSE_REPORT;
15  CPPL_INT size =m*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: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
zgematrix & zgematrix::operator/= ( const comple &  d)
inline

zgematrix/=comple operator

Definition at line 13 of file zgematrix-complex.hpp.

References array, m, and n.

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

Friends And Related Function Documentation

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

Definition at line 63 of file zgematrix-io.hpp.

64 {CPPL_VERBOSE_REPORT;
65  for(CPPL_INT i=0; i<mat.m; i++){
66  for(CPPL_INT j=0; j<mat.n; j++){
67  s << " " << mat(i,j);
68  }
69  s << std::endl;
70  }
71  return s;
72 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void swap ( zgematrix A,
zgematrix B 
)
friend

swap two matrices

Definition at line 166 of file zgematrix-misc.hpp.

Referenced by operator*=(), zgels(), and zgelss().

167 {CPPL_VERBOSE_REPORT;
168  CPPL_INT A_m =A.m, A_n =A.n;
169  comple* A_array =A.array;
170  comple** A_darray =A.darray;
171  A.m=B.m; A.n=B.n; A.array=B.array; A.darray=B.darray;
172  B.m=A_m; B.n=A_n; B.array=A_array; B.darray=A_darray;
173 }
comple ** darray
array of pointers of column head addresses
Definition: zgematrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix _ ( zgematrix mat)
friend

convert user object to smart-temporary object

Definition at line 177 of file zgematrix-misc.hpp.

Referenced by col(), and row().

178 {CPPL_VERBOSE_REPORT;
179  _zgematrix newmat;
180 
181  //////// shallow copy ////////
182  newmat.m =mat.m;
183  newmat.n =mat.n;
184  newmat.array =mat.array;
185  newmat.darray =mat.darray;
186 
187  //////// nullify ////////
188  mat.m =0;
189  mat.n =0;
190  mat.array =NULL;
191  mat.darray =NULL;
192 
193  return newmat;
194 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
comple ** darray
array of pointers of column head addresses
Definition: zgematrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
(DO NOT USE) Smart-temporary Complex Double-precision General Dence Matrix Class
Definition: _zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
comple ** darray
array of pointers of column head addresses
Definition: _zgematrix.hpp:12
_zgematrix t ( const zgematrix mat)
friend

return transposed zgematrix

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

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

return its inverse matrix

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

Referenced by chsign(), col(), copy(), identity(), operator()(), operator*=(), operator+=(), operator-=(), read(), resize(), set(), write(), zero(), zgeev(), zgels(), zgelss(), and zgematrix().

19 {CPPL_VERBOSE_REPORT;
20 #ifdef CPPL_DEBUG
21  if(mat.m!=mat.n){
22  ERROR_REPORT;
23  std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
24  << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
25  exit(1);
26  }
27 #endif//CPPL_DEBUG
28 
29  zgematrix mat_cp(mat), mat_inv(mat.m,mat.n);
30  mat_inv.identity();
31  mat_cp.zgesv(mat_inv);
32 
33  return _(mat_inv);
34 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix conj ( const zgematrix mat)
friend

return its conjugate matrix

Definition at line 42 of file zgematrix-calc.hpp.

43 {CPPL_VERBOSE_REPORT;
44  zgematrix newmat(mat.m,mat.n);
45 
46  for(CPPL_INT i=0; i<mat.m; i++){
47  for(CPPL_INT j=0; j<mat.n; j++){
48  newmat(i,j) =std::conj(mat(i,j));
49  }
50  }
51 
52  return _(newmat);
53 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
_zgematrix conj(const zgematrix &mat)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix conjt ( const zgematrix mat)
friend

return its conjugate transposed matrix

Definition at line 57 of file zgematrix-calc.hpp.

58 {CPPL_VERBOSE_REPORT;
59  zgematrix newmat(mat.n,mat.m);
60 
61  for(CPPL_INT i=0; i<newmat.m; i++){
62  for(CPPL_INT j=0; j<newmat.n; j++){
63  newmat(i,j) =std::conj(mat(j,i));
64  }
65  }
66 
67  return _(newmat);
68 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
_zgematrix conj(const zgematrix &mat)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
void idamax ( CPPL_INT &  i,
CPPL_INT &  j,
const zgematrix mat 
)
friend

search the index of element having the largest absolute value in 0-based numbering system

Definition at line 77 of file zgematrix-calc.hpp.

78 {CPPL_VERBOSE_REPORT;
79  CPPL_INT size =mat.m*mat.n;
80  CPPL_INT inc =1;
81  CPPL_INT index =izamax_(&size, mat.array, &inc) -1;
82  i =index%mat.m;
83  j =index/mat.m;
84 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
comple damax ( const zgematrix mat)
friend

return its largest absolute value

Definition at line 88 of file zgematrix-calc.hpp.

89 {CPPL_VERBOSE_REPORT;
90  CPPL_INT size =mat.m*mat.n;
91  CPPL_INT inc =1;
92  return mat.array[izamax_(&size, mat.array, &inc) -1];
93 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
const zgematrix& operator+ ( const zgematrix mat)
friend

+zgematrix operator

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

4 {CPPL_VERBOSE_REPORT;
5  return mat;
6 }
_zgematrix operator- ( const zgematrix mat)
friend

-zgematrix operator

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

11 {CPPL_VERBOSE_REPORT;
12  zgematrix newmat(mat.m,mat.n);
13  for(CPPL_INT i=0; i<newmat.m*newmat.n; i++){ newmat.array[i]=-mat.array[i]; }
14 
15  return _(newmat);
16 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator+ ( const zgematrix matA,
const zgematrix matB 
)
friend

zgematrix+zgematrix operator

Definition at line 86 of file zgematrix-zgematrix.hpp.

87 {CPPL_VERBOSE_REPORT;
88 #ifdef CPPL_DEBUG
89  if(matA.n!=matB.n || matA.m!=matB.m){
90  ERROR_REPORT;
91  std::cerr << "These two matrises can not make a summation." << std::endl
92  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
93  exit(1);
94  }
95 #endif//CPPL_DEBUG
96 
97  zgematrix newmat(matA.m,matA.n);
98 
99  const CPPL_INT size =matA.m*matA.n;
100  for(CPPL_INT i=0; i<size; i++){
101  newmat.array[i] =matA.array[i]+matB.array[i];
102  }
103 
104  return _(newmat);
105 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator+ ( const zgematrix matA,
const _zgematrix matB 
)
friend

zgematrix+_zgematrix operator

Definition at line 89 of file zgematrix-_zgematrix.hpp.

90 {CPPL_VERBOSE_REPORT;
91 #ifdef CPPL_DEBUG
92  if(matA.n!=matB.n || matA.m!=matB.m){
93  ERROR_REPORT;
94  std::cerr << "These two matrises can not make a summation." << std::endl
95  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
96  exit(1);
97  }
98 #endif//CPPL_DEBUG
99 
100  const CPPL_INT size =matA.m*matA.n;
101  for(CPPL_INT i=0; i<size; i++){
102  matB.array[i] +=matA.array[i];
103  }
104 
105  return matB;
106 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator+ ( const zgematrix matA,
const zhematrix matB 
)
friend

zgematrix+zhematrix operator

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

77 {CPPL_VERBOSE_REPORT;
78 #ifdef CPPL_DEBUG
79  if(matA.n!=matB.n || matA.m!=matB.n){
80  ERROR_REPORT;
81  std::cerr << "These two matrises can not make a summation." << std::endl
82  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
83  exit(1);
84  }
85 #endif//CPPL_DEBUG
86 
87  zgematrix newmat =matA;
88 
89  for(CPPL_INT i=0; i<matA.m; i++){
90  for(CPPL_INT j=0; j<matA.n; j++){
91  newmat(i,j) += matB(i,j);
92  }
93  }
94 
95  return _(newmat);
96 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator+ ( const zgematrix matA,
const _zhematrix matB 
)
friend

zgematrix+_zhematrix operator

Definition at line 79 of file zgematrix-_zhematrix.hpp.

80 {CPPL_VERBOSE_REPORT;
81 #ifdef CPPL_DEBUG
82  if(matA.n!=matB.n || matA.m!=matB.n){
83  ERROR_REPORT;
84  std::cerr << "These two matrises can not make a summation." << std::endl
85  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
86  exit(1);
87  }
88 #endif//CPPL_DEBUG
89 
90  zgematrix newmat =matA;
91 
92  for(CPPL_INT i=0; i<matA.m; i++){
93  for(CPPL_INT j=0; j<matA.n; j++){
94  newmat(i,j) +=matB(i,j);
95  }
96  }
97 
98  matB.destroy();
99  return _(newmat);
100 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
void destroy() const
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator+ ( const zgematrix matA,
const zgbmatrix matB 
)
friend

zgematrix+zgbmatrix operator

Definition at line 80 of file zgematrix-zgbmatrix.hpp.

81 {CPPL_VERBOSE_REPORT;
82 #ifdef CPPL_DEBUG
83  if(matA.n!=matB.n || matA.m!=matB.m){
84  ERROR_REPORT;
85  std::cerr << "These two matrises can not make a summation." << std::endl
86  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
87  exit(1);
88  }
89 #endif//CPPL_DEBUG
90 
91  zgematrix newmat(matA);
92 
93  for(CPPL_INT i=0; i<matB.m; i++){
94  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
95  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
96  newmat(i,j) += matB(i,j);
97  }
98  }
99 
100  return _(newmat);
101 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix operator+ ( const zgematrix matA,
const _zgbmatrix matB 
)
friend

zgematrix+_zgbmatrix operator

Definition at line 84 of file zgematrix-_zgbmatrix.hpp.

85 {CPPL_VERBOSE_REPORT;
86 #ifdef CPPL_DEBUG
87  if(matA.n!=matB.n || matA.m!=matB.m){
88  ERROR_REPORT;
89  std::cerr << "These two matrises can not make a summation." << std::endl
90  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
91  exit(1);
92  }
93 #endif//CPPL_DEBUG
94 
95  zgematrix newmat(matA);
96 
97  for(CPPL_INT i=0; i<matB.m; i++){
98  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
99  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
100  newmat(i,j)+=matB(i,j);
101  }
102  }
103 
104  matB.destroy();
105  return _(newmat);
106 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_zgematrix operator+ ( const zgematrix matA,
const zgsmatrix matB 
)
friend

zgematrix+zgsmatrix operator

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

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.m || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat(matA);
15 
16  const size_t matB_data_size =matB.data.size();
17  for(size_t c=0; c<matB_data_size; c++){
18  const zcomponent& z =matB.data[c];
19  newmat(z.i,z.j) += z.v;
20  }
21 
22  return _(newmat);
23 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_zgematrix operator+ ( const zgematrix matA,
const _zgsmatrix matB 
)
friend

zgematrix+_zgsmatrix operator

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

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.m || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat(matA);
15  const size_t matB_data_size =matB.data.size();
16  for(size_t c=0; c<matB_data_size; c++){
17  const zcomponent& z =matB.data[c];
18  newmat(z.i,z.j) += z.v;
19  }
20 
21  matB.destroy();
22  return _(newmat);
23 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator+ ( const zgematrix ,
const zhsmatrix  
)
friend
_zgematrix operator+ ( const zgematrix ,
const _zhsmatrix  
)
friend
_zgematrix operator- ( const zgematrix matA,
const zgematrix matB 
)
friend

zgematrix-zgematrix operator

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

110 {CPPL_VERBOSE_REPORT;
111 #ifdef CPPL_DEBUG
112  if(matA.n!=matB.n || matA.m!=matB.m){
113  ERROR_REPORT;
114  std::cerr << "These two matrises can not make a subtraction." << std::endl
115  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
116  exit(1);
117  }
118 #endif//CPPL_DEBUG
119 
120  zgematrix newmat(matA.m,matA.n);
121 
122  const CPPL_INT size =matA.m*matA.n;
123  for(CPPL_INT i=0; i<size; i++){
124  newmat.array[i] =matA.array[i]-matB.array[i];
125  }
126 
127  return _(newmat);
128 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator- ( const zgematrix matA,
const _zgematrix matB 
)
friend

zgematrix-_zgematrix operator

Definition at line 110 of file zgematrix-_zgematrix.hpp.

111 {CPPL_VERBOSE_REPORT;
112 #ifdef CPPL_DEBUG
113  if(matA.n!=matB.n || matA.m!=matB.m){
114  ERROR_REPORT;
115  std::cerr << "These two matrises can not make a subtraction." << std::endl
116  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
117  exit(1);
118  }
119 #endif//CPPL_DEBUG
120 
121  const CPPL_INT size =matA.m*matA.n;
122  for(CPPL_INT i=0; i<size; i++){
123  matB.array[i] =matA.array[i]-matB.array[i];
124  }
125 
126  return matB;
127 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator- ( const zgematrix matA,
const zhematrix matB 
)
friend

zgematrix-zhematrix operator

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

101 {CPPL_VERBOSE_REPORT;
102 #ifdef CPPL_DEBUG
103  if(matA.n!=matB.n || matA.m!=matB.n){
104  ERROR_REPORT;
105  std::cerr << "These two matrises can not make a subtraction." << std::endl
106  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
107  exit(1);
108  }
109 #endif//CPPL_DEBUG
110 
111  zgematrix newmat =matA;
112 
113  for(CPPL_INT i=0; i<matA.m; i++){
114  for(CPPL_INT j=0; j<matA.n; j++){
115  newmat(i,j) -= matB(i,j);
116  }
117  }
118 
119  return _(newmat);
120 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator- ( const zgematrix matA,
const _zhematrix matB 
)
friend

zgematrix-_zhematrix operator

Definition at line 104 of file zgematrix-_zhematrix.hpp.

105 {CPPL_VERBOSE_REPORT;
106 #ifdef CPPL_DEBUG
107  if(matA.n!=matB.n || matA.m!=matB.n){
108  ERROR_REPORT;
109  std::cerr << "These two matrises can not make a subtraction." << std::endl
110  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
111  exit(1);
112  }
113 #endif//CPPL_DEBUG
114 
115  zgematrix newmat =matA;
116 
117  for(CPPL_INT i=0; i<matA.m; i++){
118  for(CPPL_INT j=0; j<matA.n; j++){
119  newmat(i,j) -=matB(i,j);
120  }
121  }
122 
123  matB.destroy();
124  return _(newmat);
125 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
void destroy() const
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator- ( const zgematrix matA,
const zgbmatrix matB 
)
friend

zgematrix-zgbmatrix operator

Definition at line 105 of file zgematrix-zgbmatrix.hpp.

106 {CPPL_VERBOSE_REPORT;
107 #ifdef CPPL_DEBUG
108  if(matA.n!=matB.n || matA.m!=matB.m){
109  ERROR_REPORT;
110  std::cerr << "These two matrises can not make a summation." << std::endl
111  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
112  exit(1);
113  }
114 #endif//CPPL_DEBUG
115 
116  zgematrix newmat(matA);
117 
118  for(CPPL_INT i=0; i<matB.m; i++){
119  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
120  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
121  newmat(i,j) -= matB(i,j);
122  }
123  }
124 
125  return _(newmat);
126 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix operator- ( const zgematrix matA,
const _zgbmatrix matB 
)
friend

zgematrix-_zgbmatrix operator

Definition at line 110 of file zgematrix-_zgbmatrix.hpp.

111 {CPPL_VERBOSE_REPORT;
112 #ifdef CPPL_DEBUG
113  if(matA.n!=matB.n || matA.m!=matB.m){
114  ERROR_REPORT;
115  std::cerr << "These two matrises can not make a summation." << std::endl
116  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
117  exit(1);
118  }
119 #endif//CPPL_DEBUG
120 
121  zgematrix newmat(matA);
122 
123  for(CPPL_INT i=0; i<matB.m; i++){
124  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
125  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
126  newmat(i,j)-=matB(i,j);
127  }
128  }
129 
130  matB.destroy();
131  return _(newmat);
132 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_zgematrix operator- ( const zgematrix matA,
const zgsmatrix matB 
)
friend

zgematrix-zgsmatrix operator

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

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.m!=matB.m || matA.n!=matB.n){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a subtraction." << std::endl
33  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  zgematrix newmat(matA);
39 
40  const size_t matB_data_size =matB.data.size();
41  for(size_t c=0; c<matB_data_size; c++){
42  const zcomponent& z =matB.data[c];
43  newmat(z.i,z.j) -= z.v;
44  }
45 
46  return _(newmat);
47 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_zgematrix operator- ( const zgematrix matA,
const _zgsmatrix matB 
)
friend

zgematrix-_zgsmatrix operator

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

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.m!=matB.m || matA.n!=matB.n){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a subtraction." << std::endl
33  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  zgematrix newmat(matA);
39 
40  const size_t matB_data_size =matB.data.size();
41  for(size_t c=0; c<matB_data_size; c++){
42  const zcomponent& z =matB.data[c];
43  newmat(z.i,z.j) -= z.v;
44  }
45 
46  matB.destroy();
47  return _(newmat);
48 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator- ( const zgematrix ,
const zhsmatrix  
)
friend
_zgematrix operator- ( const zgematrix ,
const _zhsmatrix  
)
friend
_zcovector operator* ( const zgematrix mat,
const zcovector vec 
)
friend

zgematrix*zcovector operator

Definition at line 3 of file zgematrix-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.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zcovector newvec(mat.m);
15  char trans ='n';
16  comple alpha =comple(1.,0.);
17  CPPL_INT inc =1;
18  comple beta =comple(0.,0.);
19 
20  zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, 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: zgematrix.hpp:10
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
_zcovector operator* ( const zgematrix mat,
const _zcovector vec 
)
friend

zgematrix*_zcovector operator

Definition at line 3 of file zgematrix-_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.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zcovector newvec(mat.m);
15  char trans ='n';
16  comple alpha =comple(1.,0.);
17  CPPL_INT inc =1;
18  comple beta =comple(0.,0.);
19 
20  zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc );
21 
22  vec.destroy();
23  return _(newvec);
24 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
void destroy() const
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store vector data
Definition: _zcovector.hpp:10
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT l
vector size
Definition: _zcovector.hpp:9
_zgematrix operator* ( const zgematrix matA,
const zgematrix matB 
)
friend

zgematrix*zgematrix operator

Definition at line 132 of file zgematrix-zgematrix.hpp.

133 {CPPL_VERBOSE_REPORT;
134 #ifdef CPPL_DEBUG
135  if(matA.n!=matB.m){
136  ERROR_REPORT;
137  std::cerr << "These two matrises can not make a product." << std::endl
138  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
139  exit(1);
140  }
141 #endif//CPPL_DEBUG
142 
143  zgematrix newmat( matA.m, matB.n );
144  char transa ='n';
145  char transb ='n';
146  comple alpha =comple(1.,0.);
147  comple beta =comple(0.,0.);
148 
149  zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m );
150 
151  return _(newmat);
152 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator* ( const zgematrix matA,
const _zgematrix matB 
)
friend

zgematrix*_zgematrix operator

Definition at line 131 of file zgematrix-_zgematrix.hpp.

132 {CPPL_VERBOSE_REPORT;
133 #ifdef CPPL_DEBUG
134  if(matA.n!=matB.m){
135  ERROR_REPORT;
136  std::cerr << "These two matrises can not make a product." << std::endl
137  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
138  exit(1);
139  }
140 #endif//CPPL_DEBUG
141 
142  zgematrix newmat( matA.m, matB.n );
143  char transa ='n';
144  char transb ='n';
145  comple alpha =comple(1.,0.);
146  comple beta =comple(0.,0.);
147 
148  zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m );
149 
150  matB.destroy();
151  return _(newmat);
152 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void destroy() const
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator* ( const zgematrix matA,
const zhematrix matB 
)
friend

zgematrix*zhematrix operator

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

125 {CPPL_VERBOSE_REPORT;
126 #ifdef CPPL_DEBUG
127  if(matA.n!=matB.n){
128  ERROR_REPORT;
129  std::cerr << "These two matrises can not make a product." << std::endl
130  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
131  exit(1);
132  }
133 #endif//CPPL_DEBUG
134 
135  zgematrix newmat( matA.m, matA.n );
136  char side ='R';
137  char uplo ='l';
138  comple alpha =comple(1.,0.);
139  comple beta =comple(0.,0.);
140 
141  zhemm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m );
142 
143  return _(newmat);
144 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
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 m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator* ( const zgematrix matA,
const _zhematrix matB 
)
friend

zgematrix*_zhematrix operator

Definition at line 129 of file zgematrix-_zhematrix.hpp.

130 {CPPL_VERBOSE_REPORT;
131 #ifdef CPPL_DEBUG
132  if(matA.n!=matB.n){
133  ERROR_REPORT;
134  std::cerr << "These two matrises can not make a product." << std::endl
135  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
136  exit(1);
137  }
138 #endif//CPPL_DEBUG
139 
140  zgematrix newmat( matA.n, matB.n );
141  char side ='R';
142  char uplo ='l';
143  comple alpha =comple(1.,0.);
144  comple beta =comple(0.,0.);
145 
146  zhemm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m );
147 
148  matB.destroy();
149  return _(newmat);
150 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store matrix data
Definition: _zhematrix.hpp:12
void destroy() const
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator* ( const zgematrix matA,
const zgbmatrix matB 
)
friend

zgematrix*zgbmatrix operator

Definition at line 130 of file zgematrix-zgbmatrix.hpp.

131 {CPPL_VERBOSE_REPORT;
132 #ifdef CPPL_DEBUG
133  if(matA.n!=matB.m){
134  ERROR_REPORT;
135  std::cerr << "These two matrises can not make a product." << std::endl
136  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
137  exit(1);
138  }
139 #endif//CPPL_DEBUG
140 
141  zgematrix newmat( matA.m, matB.n );
142  newmat.zero();
143 
144  for(CPPL_INT i=0; i<newmat.m; i++){
145  for(CPPL_INT j=0; j<newmat.n; j++){
146  const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1);
147  for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){
148  newmat(i,j) += matA(i,k)*matB(k,j);
149  }
150  }
151  }
152 
153  return _(newmat);
154 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix operator* ( const zgematrix matA,
const _zgbmatrix matB 
)
friend

zgematrix*_zgbmatrix operator

Definition at line 136 of file zgematrix-_zgbmatrix.hpp.

137 {CPPL_VERBOSE_REPORT;
138 #ifdef CPPL_DEBUG
139  if(matA.n!=matB.m){
140  ERROR_REPORT;
141  std::cerr << "These two matrises can not make a product." << std::endl
142  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
143  exit(1);
144  }
145 #endif//CPPL_DEBUG
146 
147  zgematrix newmat( matA.m, matB.n );
148  newmat.zero();
149 
150  for(CPPL_INT i=0; i<newmat.m; i++){
151  for(CPPL_INT j=0; j<newmat.n; j++){
152  const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1);
153  for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){
154  newmat(i,j)+=matA(i,k)*matB(k,j);
155  }
156  }
157  }
158 
159  matB.destroy();
160  return _(newmat);
161 }
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
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_zgematrix operator* ( const zgematrix matA,
const zgsmatrix matB 
)
friend

zgematrix*zgsmatrix operator

Definition at line 51 of file zgematrix-zgsmatrix.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.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
58  exit(1);
59  }
60 #endif//CPPL_DEBUG
61 
62  zgematrix newmat(matA.m, matB.n);
63  newmat.zero();
64 
65  const size_t matB_data_size =matB.data.size();
66  for(size_t c=0; c<matB_data_size; c++){
67  const zcomponent& z =matB.data[c];
68  for(CPPL_INT i=0; i<matA.m; i++){
69  newmat(i,z.j) += matA(i,z.i)*z.v;
70  }
71  }
72 
73  return _(newmat);
74 }
comple v
value of the component
Definition: zcomponent.hpp:11
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_zgematrix operator* ( const zgematrix matA,
const _zgsmatrix matB 
)
friend

zgematrix*_zgsmatrix operator

Definition at line 52 of file zgematrix-_zgsmatrix.hpp.

53 {CPPL_VERBOSE_REPORT;
54 #ifdef CPPL_DEBUG
55  if(matA.n!=matB.m){
56  ERROR_REPORT;
57  std::cerr << "These two matrises can not make a product." << std::endl
58  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
59  exit(1);
60  }
61 #endif//CPPL_DEBUG
62 
63  zgematrix newmat(matA.m, matB.n);
64  newmat.zero();
65 
66  const size_t matB_data_size =matB.data.size();
67  for(size_t c=0; c<matB_data_size; c++){
68  const zcomponent& z =matB.data[c];
69  for(CPPL_INT i=0; i<matA.m; i++){
70  newmat(i,z.j) += matA(i,z.i)*z.v;
71  }
72  }
73 
74  matB.destroy();
75  return _(newmat);
76 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator* ( const zgematrix ,
const zhsmatrix  
)
friend
_zgematrix operator* ( const zgematrix ,
const _zhsmatrix  
)
friend
_zgematrix operator* ( const zgematrix mat,
const double &  d 
)
friend

zgematrix*double operator

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

29 {CPPL_VERBOSE_REPORT;
30  zgematrix newmat(mat.m, mat.n);
31 
32  const CPPL_INT size =mat.m*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 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator* ( const zgematrix mat,
const comple &  d 
)
friend

zgematrix*comple operator

Definition at line 28 of file zgematrix-complex.hpp.

29 {CPPL_VERBOSE_REPORT;
30  zgematrix newmat(mat.m, mat.n);
31 
32  const CPPL_INT size =mat.m*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 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator/ ( const zgematrix mat,
const double &  d 
)
friend

zgematrix/double operator

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

43 {CPPL_VERBOSE_REPORT;
44  zgematrix newmat(mat.m, mat.n);
45 
46  const CPPL_INT size =mat.m*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 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator/ ( const zgematrix mat,
const comple &  d 
)
friend

zgematrix/comple operator

Definition at line 42 of file zgematrix-complex.hpp.

43 {CPPL_VERBOSE_REPORT;
44  zgematrix newmat(mat.m, mat.n);
45 
46  const CPPL_INT size =mat.m*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 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator* ( const double &  d,
const zgematrix mat 
)
friend

double*zgematrix operator

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

4 {CPPL_VERBOSE_REPORT;
5  zgematrix newmat(mat.m, mat.n);
6 
7  const CPPL_INT size =mat.m*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 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator* ( const comple &  d,
const zgematrix mat 
)
friend

comple*zgematrix operator

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

4 {CPPL_VERBOSE_REPORT;
5  zgematrix newmat(mat.m, mat.n);
6 
7  const CPPL_INT size =mat.m*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 }
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zgematrix _(zgematrix &)
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix hadamard ( const zgematrix ,
const zgematrix  
)
friend

Member Data Documentation

CPPL_INT zgematrix::m
CPPL_INT zgematrix::n
comple* zgematrix::array
comple** zgematrix::darray

array of pointers of column head addresses

Definition at line 12 of file zgematrix.hpp.

Referenced by _(), clear(), copy(), operator()(), resize(), set(), shallow_copy(), swap(), zgematrix(), and ~zgematrix().


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