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

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

#include <zgbmatrix.hpp>

Public Member Functions

 zgbmatrix ()
 
 zgbmatrix (const zgbmatrix &)
 
 zgbmatrix (const _zgbmatrix &)
 
 zgbmatrix (const CPPL_INT &, const CPPL_INT &, const CPPL_INT &, const CPPL_INT &)
 
 zgbmatrix (const char *)
 
 ~zgbmatrix ()
 
_zgematrix to_zgematrix () const
 
comple & operator() (const CPPL_INT &, const CPPL_INT &)
 
comple operator() (const CPPL_INT &, const CPPL_INT &) const
 
zgbmatrixset (const CPPL_INT &, const CPPL_INT &, const comple &)
 
void write (const char *) const
 
void read (const char *)
 
void clear ()
 
zgbmatrixzero ()
 
zgbmatrixidentity ()
 
void chsign ()
 
void copy (const zgbmatrix &)
 
void shallow_copy (const _zgbmatrix &)
 
void resize (const CPPL_INT &, const CPPL_INT &, const CPPL_INT &, const CPPL_INT &)
 
_zrovector row (const CPPL_INT &) const
 
_zcovector col (const CPPL_INT &) const
 
CPPL_INT zgbsv (zgematrix &)
 
CPPL_INT zgbsv (zcovector &)
 
zgbmatrixoperator= (const zgbmatrix &)
 
zgbmatrixoperator= (const _zgbmatrix &)
 
zgbmatrixoperator+= (const zgbmatrix &)
 
zgbmatrixoperator+= (const _zgbmatrix &)
 
zgbmatrixoperator-= (const zgbmatrix &)
 
zgbmatrixoperator-= (const _zgbmatrix &)
 
zgbmatrixoperator*= (const zgbmatrix &)
 
zgbmatrixoperator*= (const _zgbmatrix &)
 
zgbmatrixoperator*= (const double &)
 
zgbmatrixoperator*= (const comple &)
 
zgbmatrixoperator/= (const double &)
 
zgbmatrixoperator/= (const comple &)
 

Public Attributes

CPPL_INT m
 matrix row size More...
 
CPPL_INT n
 matrix column size More...
 
CPPL_INT kl
 lower band width More...
 
CPPL_INT ku
 upper band width 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 zgbmatrix &)
 
void swap (zgbmatrix &, zgbmatrix &)
 
_zgbmatrix _ (zgbmatrix &)
 
_zgbmatrix t (const zgbmatrix &)
 
_zgematrix i (const zgbmatrix &)
 
_zgbmatrix conj (const zgbmatrix &)
 
_zgbmatrix conjt (const zgbmatrix &)
 
const zgbmatrixoperator+ (const zgbmatrix &)
 
_zgbmatrix operator- (const zgbmatrix &)
 
_zgematrix operator+ (const zgbmatrix &, const zgematrix &)
 
_zgematrix operator+ (const zgbmatrix &, const _zgematrix &)
 
_zgematrix operator+ (const zgbmatrix &, const zhematrix &)
 
_zgematrix operator+ (const zgbmatrix &, const _zhematrix &)
 
_zgbmatrix operator+ (const zgbmatrix &, const zgbmatrix &)
 
_zgbmatrix operator+ (const zgbmatrix &, const _zgbmatrix &)
 
_zgematrix operator+ (const zgbmatrix &, const zgsmatrix &)
 
_zgematrix operator+ (const zgbmatrix &, const _zgsmatrix &)
 
_zgematrix operator+ (const zgbmatrix &, const zhsmatrix &)
 
_zgematrix operator+ (const zgbmatrix &, const _zhsmatrix &)
 
_zgematrix operator- (const zgbmatrix &, const zgematrix &)
 
_zgematrix operator- (const zgbmatrix &, const _zgematrix &)
 
_zgematrix operator- (const zgbmatrix &, const zhematrix &)
 
_zgematrix operator- (const zgbmatrix &, const _zhematrix &)
 
_zgbmatrix operator- (const zgbmatrix &, const zgbmatrix &)
 
_zgbmatrix operator- (const zgbmatrix &, const _zgbmatrix &)
 
_zgematrix operator- (const zgbmatrix &, const zgsmatrix &)
 
_zgematrix operator- (const zgbmatrix &, const _zgsmatrix &)
 
_zgematrix operator- (const zgbmatrix &, const zhsmatrix &)
 
_zgematrix operator- (const zgbmatrix &, const _zhsmatrix &)
 
_zcovector operator* (const zgbmatrix &, const zcovector &)
 
_zcovector operator* (const zgbmatrix &, const _zcovector &)
 
_zgematrix operator* (const zgbmatrix &, const zgematrix &)
 
_zgematrix operator* (const zgbmatrix &, const _zgematrix &)
 
_zgematrix operator* (const zgbmatrix &, const zhematrix &)
 
_zgematrix operator* (const zgbmatrix &, const _zhematrix &)
 
_zgbmatrix operator* (const zgbmatrix &, const zgbmatrix &)
 
_zgbmatrix operator* (const zgbmatrix &, const _zgbmatrix &)
 
_zgematrix operator* (const zgbmatrix &, const zgsmatrix &)
 
_zgematrix operator* (const zgbmatrix &, const _zgsmatrix &)
 
_zgematrix operator* (const zgbmatrix &, const zhsmatrix &)
 
_zgematrix operator* (const zgbmatrix &, const _zhsmatrix &)
 
_zgbmatrix operator* (const zgbmatrix &, const double &)
 
_zgbmatrix operator* (const zgbmatrix &, const comple &)
 
_zgbmatrix operator/ (const zgbmatrix &, const double &)
 
_zgbmatrix operator/ (const zgbmatrix &, const comple &)
 
_zgbmatrix operator* (const double &, const zgbmatrix &)
 
_zgbmatrix operator* (const comple &, const zgbmatrix &)
 

Detailed Description

Complex Double-precision General Band Matrix Class.

Definition at line 3 of file zgbmatrix.hpp.

Constructor & Destructor Documentation

zgbmatrix::zgbmatrix ( )
inline

zgbmatrix constructor

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

References array, darray, kl, ku, m, and n.

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

zgbmatrix copy constructor

Definition at line 20 of file zgbmatrix-constructor.hpp.

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

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

zgbmatrix constructor to cast _zgbmatrix

Definition at line 41 of file zgbmatrix-constructor.hpp.

References array, _zgbmatrix::array, darray, _zgbmatrix::darray, kl, _zgbmatrix::kl, _zgbmatrix::ku, ku, m, _zgbmatrix::m, _zgbmatrix::n, n, and _zgbmatrix::nullify().

42 {CPPL_VERBOSE_REPORT;
43  m =mat.m;
44  n =mat.n;
45  kl =mat.kl;
46  ku =mat.ku;
47  array =mat.array;
48  darray =mat.darray;
49 
50  mat.nullify();
51 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
comple * array
1D array to store matrix data
Definition: _zgbmatrix.hpp:13
void nullify() const
comple ** darray
array of pointers of column head addresses
Definition: _zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
zgbmatrix::zgbmatrix ( const CPPL_INT &  _m,
const CPPL_INT &  _n,
const CPPL_INT &  _kl,
const CPPL_INT &  _ku 
)
inline

zgbmatrix constructor with size specification

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

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

61 {CPPL_VERBOSE_REPORT;
62 #ifdef CPPL_DEBUG
63  if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
64  ERROR_REPORT;
65  std::cerr << "It is impossible to make a matrix you ordered. " << std::endl
66  << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl;
67  exit(1);
68  }
69 #endif//CPPL_DEBUG
70 
71  //////// initialize ////////
72  m =_m;
73  n =_n;
74  kl =_kl;
75  ku =_ku;
76  array =new comple[(kl+ku+1)*n];
77  darray =new comple*[n];
78  for(int i=0; i<n; i++){
79  darray[i] =&array[i*(kl+ku+1)];
80  }
81 }
friend _zgematrix i(const zgbmatrix &)
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
zgbmatrix::zgbmatrix ( const char *  filename)
inline

zgbmatrix constructor with filename

Definition at line 85 of file zgbmatrix-constructor.hpp.

References array, darray, and read().

86 {CPPL_VERBOSE_REPORT;
87  array =NULL;
88  darray =NULL;
89 
90  //// read ////
91  read(filename);
92 }
void read(const char *)
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
zgbmatrix::~zgbmatrix ( )
inline

zgbmatrix destructor

Definition at line 100 of file zgbmatrix-constructor.hpp.

References array, and darray.

101 {CPPL_VERBOSE_REPORT;
102  //////// delete array ////////
103  delete [] array;
104  delete [] darray;
105 }
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13

Member Function Documentation

_zgematrix zgbmatrix::to_zgematrix ( ) const
inline

convert to _zgematrix

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

References _, i, kl, ku, m, n, and zero().

4 {CPPL_VERBOSE_REPORT;
5  zgematrix newmat( zgematrix(m,n).zero() );
6 
7  for(CPPL_INT i=0; i<m; i++){
8  const CPPL_INT jmax =std::min(n,i+ku+1);
9  for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){
10  newmat(i,j) =(*this)(i,j);
11  }
12  }
13 
14  return _(newmat);
15 }
zgbmatrix & zero()
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
comple & zgbmatrix::operator() ( const CPPL_INT &  i,
const CPPL_INT &  j 
)
inline

operator() for non-const object

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

References darray, i, kl, ku, m, and n.

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

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

operator() for const object

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

References darray, i, kl, ku, m, and n.

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

set value for const object

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

References darray, i, kl, ku, m, and n.

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

Definition at line 81 of file zgbmatrix-io.hpp.

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

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

Definition at line 102 of file zgbmatrix-io.hpp.

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

Referenced by zgbmatrix().

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

clear all the matrix data and set the sizes 0

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

References array, darray, kl, ku, m, and n.

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

change the matrix into a zero matrix

Definition at line 18 of file zgbmatrix-misc.hpp.

References array, i, kl, ku, and n.

Referenced by operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), and to_zgematrix().

19 {CPPL_VERBOSE_REPORT;
20  const CPPL_INT size =(kl+ku+1)*n;
21  for(CPPL_INT i=0; i<size; i++){
22  array[i] =comple(0.,0.);
23  }
24  return *this;
25 }
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
zgbmatrix & zgbmatrix::identity ( )
inline

change the matrix into an identity matrix

Definition at line 29 of file zgbmatrix-misc.hpp.

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

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

change sign(+/-) of the matrix

Definition at line 53 of file zgbmatrix-misc.hpp.

References array, i, kl, ku, and n.

54 {CPPL_VERBOSE_REPORT;
55  const CPPL_INT size =(kl+ku+1)*n;
56  for(CPPL_INT i=0; i<size; i++){
57  array[i] =-array[i];
58  }
59 }
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
void zgbmatrix::copy ( const zgbmatrix mat)
inline

make a deep copy of the matrix

Definition at line 63 of file zgbmatrix-misc.hpp.

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

Referenced by operator=().

64 {CPPL_VERBOSE_REPORT;
65  m =mat.m;
66  n =mat.n;
67  kl =mat.kl;
68  ku =mat.ku;
69  delete [] array;
70  array =new comple[(mat.kl+mat.ku+1)*mat.n];
71  delete [] darray;
72  darray =new comple*[n];
73  for(int i=0; i<n; i++){
74  darray[i] =&array[i*(kl+ku+1)];
75  }
76 
77  CPPL_INT size =(mat.kl+mat.ku+1)*mat.n;
78  CPPL_INT inc =1;
79  zcopy_(&size, mat.array, &inc, array, &inc);
80 }
friend _zgematrix i(const zgbmatrix &)
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
void zgbmatrix::shallow_copy ( const _zgbmatrix mat)
inline

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

Definition at line 85 of file zgbmatrix-misc.hpp.

References array, _zgbmatrix::array, darray, _zgbmatrix::darray, kl, _zgbmatrix::kl, _zgbmatrix::ku, ku, m, _zgbmatrix::m, _zgbmatrix::n, n, and _zgbmatrix::nullify().

Referenced by operator=().

86 {CPPL_VERBOSE_REPORT;
87  m =mat.m;
88  n =mat.n;
89  kl =mat.kl;
90  ku =mat.ku;
91  delete [] array;
92  array =mat.array;
93  delete [] darray;
94  darray =mat.darray;
95 
96  mat.nullify();
97 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
comple * array
1D array to store matrix data
Definition: _zgbmatrix.hpp:13
void nullify() const
comple ** darray
array of pointers of column head addresses
Definition: _zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
void zgbmatrix::resize ( const CPPL_INT &  _m,
const CPPL_INT &  _n,
const CPPL_INT &  _kl,
const CPPL_INT &  _ku 
)
inline

resize the matrix

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

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

Referenced by read().

103 {CPPL_VERBOSE_REPORT;
104 #ifdef CPPL_DEBUG
105  if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
106  ERROR_REPORT;
107  std::cerr << "It is impossible to make a matrix you ordered. " << std::endl
108  << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl;
109  exit(1);
110  }
111 #endif//CPPL_DEBUG
112 
113  m =_m;
114  n =_n;
115  kl =_kl;
116  ku =_ku;
117  delete [] array;
118  array =new comple[(kl+ku+1)*n];
119  delete [] darray;
120  darray =new comple*[n];
121  for(int i=0; i<n; i++){
122  darray[i] =&array[i*(kl+ku+1)];
123  }
124 }
friend _zgematrix i(const zgbmatrix &)
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zrovector zgbmatrix::row ( const CPPL_INT &  _m) const
inline

get row of the matrix

Definition at line 132 of file zgbmatrix-misc.hpp.

References _, kl, ku, m, n, and zrovector::zero().

133 {CPPL_VERBOSE_REPORT;
134 #ifdef CPPL_DEBUG
135  if( _m<0 || _m>m ){
136  ERROR_REPORT;
137  std::cerr << "Input row number must be between 0 and " << m << "." << std::endl
138  << "Your input was " << _m << "." << std::endl;
139  exit(1);
140  }
141 #endif//CPPL_DEBUG
142 
143  zrovector v =zrovector(n).zero();
144 
145  const CPPL_INT jmax =std::min(n,_m+ku+1);
146  for(CPPL_INT j=std::max(CPPL_INT(0),_m-kl); j<jmax; j++){
147  v(j)=(*this)(_m,j);
148  }
149 
150  return _(v);
151 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision Row Vector Class.
Definition: zrovector.hpp:3
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
zrovector & zero()
_zcovector zgbmatrix::col ( const CPPL_INT &  _n) const
inline

get column of the matrix

Definition at line 155 of file zgbmatrix-misc.hpp.

References _, i, kl, ku, m, n, and zcovector::zero().

156 {CPPL_VERBOSE_REPORT;
157 #ifdef CPPL_DEBUG
158  if( _n<0 || _n>n ){
159  ERROR_REPORT;
160  std::cerr << "Input row number must be between 0 and " << n << "." << std::endl
161  << "Your input was " << _n << "." << std::endl;
162  exit(1);
163  }
164 #endif//CPPL_DEBUG
165 
166  zcovector v =zcovector(m).zero();
167 
168  const CPPL_INT imax =std::min(m,_n+kl+1);
169  for(CPPL_INT i=std::max(CPPL_INT(0),_n-ku); i<imax; i++){
170  v(i)=(*this)(i,_n);
171  }
172 
173  return _(v);
174 }
zcovector & zero()
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
friend _zgbmatrix _(zgbmatrix &)
CPPL_INT zgbmatrix::zgbsv ( zgematrix mat)
inline

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

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

References zgematrix::array, array, i, kl, ku, m, zgematrix::m, n, zgematrix::n, operator()(), and swap.

Referenced by i().

6 {CPPL_VERBOSE_REPORT;
7 #ifdef CPPL_DEBUG
8  if(m!=n || n!=mat.m){
9  ERROR_REPORT;
10  std::cerr << "These matrix and vector 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  zgbmatrix newmat(m,n,kl,ku+kl);
17  for(CPPL_INT i=0; i<m; i++){
18  const CPPL_INT jmax =std::min(n,i+ku+1);
19  for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){
20  newmat(i,j) =operator()(i,j);
21  }
22  }
23 
24  CPPL_INT NRHS(mat.n), LDAB(2*kl+ku+1), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1);
25  zgbsv_(&n, &kl, &ku, &NRHS, newmat.array, &LDAB, IPIV, mat.array, &LDB, &INFO);
26  delete [] IPIV;
27 
28  swap(*this,newmat);
29 
30  if(INFO!=0){
31  WARNING_REPORT;
32  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
33  }
34  return INFO;
35 }
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
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
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend void swap(zgbmatrix &, zgbmatrix &)
CPPL_INT zgbmatrix::zgbsv ( zcovector vec)
inline

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

Definition at line 41 of file zgbmatrix-lapack.hpp.

References zcovector::array, array, i, kl, ku, zcovector::l, m, n, operator()(), and swap.

42 {CPPL_VERBOSE_REPORT;
43 #ifdef CPPL_DEBUG
44  if(m!=n || n!=vec.l){
45  ERROR_REPORT;
46  std::cerr << "These matrix and vector cannot be solved." << std::endl
47  << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl;
48  exit(1);
49  }
50 #endif//CPPL_DEBUG
51 
52  zgbmatrix newmat(m,n,kl,ku+kl);
53  for(CPPL_INT i=0; i<m; i++){
54  const CPPL_INT jmax =std::min(n,i+ku+1);
55  for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){
56  newmat(i,j) =operator()(i,j);
57  }
58  }
59 
60  CPPL_INT NRHS(1), LDAB(2*kl+ku+1), *IPIV(new CPPL_INT[n]), LDB(vec.l), INFO(1);
61  zgbsv_(&n, &kl, &ku, &NRHS, newmat.array, &LDAB, IPIV, vec.array, &LDB, &INFO);
62  delete [] IPIV;
63 
64  swap(*this,newmat);
65 
66  if(INFO!=0){
67  WARNING_REPORT;
68  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
69  }
70  return INFO;
71 }
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
CPPL_INT l
vector size
Definition: zcovector.hpp:9
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend void swap(zgbmatrix &, zgbmatrix &)
zgbmatrix & zgbmatrix::operator= ( const zgbmatrix mat)
inline

zgbmatrix=zgbmatrix operator
The left side matrix is overwritten thoroughly including band width.

Definition at line 4 of file zgbmatrix-zgbmatrix.hpp.

References array, and copy().

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

zgbmatrix=_zgbmatrix operator

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

References shallow_copy().

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

zgbmatrix+=zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

Definition at line 19 of file zgbmatrix-zgbmatrix.hpp.

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

20 {CPPL_VERBOSE_REPORT;
21 #ifdef CPPL_DEBUG
22  if(n!=mat.n || m!=mat.m){
23  ERROR_REPORT;
24  std::cerr << "These two matrises can not make a summation." << std::endl
25  << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
26  exit(1);
27  }
28 #endif//CPPL_DEBUG
29 
30  if(kl>=mat.kl && ku>=mat.ku){
31  for(CPPL_INT i=0; i<m; i++){
32  const CPPL_INT jmax =std::min(n,i+mat.ku+1);
33  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
34  operator()(i,j) += mat(i,j);
35  }
36  }
37 
38  return *this;
39  }
40 
41  else{
42  zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
43  newmat.zero();
44  for(CPPL_INT i=0; i<m; i++){
45  const CPPL_INT jmax1 =std::min(n,i+ku+1);
46  for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){
47  newmat(i,j) += operator()(i,j);
48  }
49  const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1);
50  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){
51  newmat(i,j) += mat(i,j);
52  }
53  }
54 
55  swap(*this,newmat);
56  return *this;
57  }
58 }
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend void swap(zgbmatrix &, zgbmatrix &)
zgbmatrix & zgbmatrix::operator+= ( const _zgbmatrix mat)
inline

zgbmatrix+=_zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

Definition at line 16 of file zgbmatrix-_zgbmatrix.hpp.

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

17 {CPPL_VERBOSE_REPORT;
18 #ifdef CPPL_DEBUG
19  if(n!=mat.n || m!=mat.m){
20  ERROR_REPORT;
21  std::cerr << "These two matrises can not make a summation." << std::endl
22  << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
23  exit(1);
24  }
25 #endif//CPPL_DEBUG
26 
27  if(kl>=mat.kl && ku>=mat.ku){
28  for(CPPL_INT i=0; i<m; i++){
29  const CPPL_INT jmax =std::min(n,i+mat.ku+1);
30  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
31  operator()(i,j) += mat(i,j);
32  }
33  }
34 
35  mat.destroy();
36  return *this;
37  }
38  else{
39  zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
40  newmat.zero();
41  for(CPPL_INT i=0; i<m; i++){
42  const CPPL_INT jmax1 =std::min(n,i+ku+1);
43  for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){
44  newmat(i,j) += operator()(i,j);
45  }
46  const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1);
47  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){
48  newmat(i,j) += mat(i,j);
49  }
50  }
51 
52  swap(*this,newmat);
53  mat.destroy();
54  return *this;
55  }
56 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
friend void swap(zgbmatrix &, zgbmatrix &)
zgbmatrix & zgbmatrix::operator-= ( const zgbmatrix mat)
inline

zgbmatrix-=zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

Definition at line 63 of file zgbmatrix-zgbmatrix.hpp.

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

64 {CPPL_VERBOSE_REPORT;
65 #ifdef CPPL_DEBUG
66  if(n!=mat.n || m!=mat.m){
67  ERROR_REPORT;
68  std::cerr << "These two matrises can not make a subtraction." << std::endl
69  << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
70  exit(1);
71  }
72 #endif//CPPL_DEBUG
73 
74  if(kl>=mat.kl && ku>=mat.ku){
75  for(CPPL_INT i=0; i<m; i++){
76  const CPPL_INT jmax =std::min(n,i+mat.ku+1);
77  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
78  operator()(i,j) -= mat(i,j);
79  }
80  }
81 
82  return *this;
83  }
84 
85  else{
86  zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
87  newmat.zero();
88  for(CPPL_INT i=0; i<m; i++){
89  const CPPL_INT jmax1 =std::min(n,i+ku+1);
90  for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){
91  newmat(i,j) += operator()(i,j);
92  }
93  const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1);
94  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){
95  newmat(i,j) -= mat(i,j);
96  }
97  }
98 
99  swap(*this,newmat);
100  return *this;
101  }
102 }
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend void swap(zgbmatrix &, zgbmatrix &)
zgbmatrix & zgbmatrix::operator-= ( const _zgbmatrix mat)
inline

zgbmatrix-=_zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

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

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

62 {CPPL_VERBOSE_REPORT;
63 #ifdef CPPL_DEBUG
64  if(n!=mat.n || m!=mat.m){
65  ERROR_REPORT;
66  std::cerr << "These two matrises can not make a subtraction." << std::endl
67  << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
68  exit(1);
69  }
70 #endif//CPPL_DEBUG
71 
72  if(kl>=mat.kl && ku>=mat.ku){
73  for(CPPL_INT i=0; i<m; i++){
74  const CPPL_INT jmax =std::min(n,i+mat.ku+1);
75  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
76  operator()(i,j) -= mat(i,j);
77  }
78  }
79 
80  mat.destroy();
81  return *this;
82  }
83  else{
84  zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
85  newmat.zero();
86  for(CPPL_INT i=0; i<m; i++){
87  const CPPL_INT jmax1 =std::min(n,i+ku+1);
88  for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){
89  newmat(i,j) += operator()(i,j);
90  }
91  const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1);
92  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){
93  newmat(i,j) -= mat(i,j);
94  }
95  }
96 
97  swap(*this,newmat);
98  mat.destroy();
99  return *this;
100  }
101 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
friend void swap(zgbmatrix &, zgbmatrix &)
zgbmatrix & zgbmatrix::operator*= ( const zgbmatrix mat)
inline

zgbmatrix*=zgbmatrix operator

Definition at line 106 of file zgbmatrix-zgbmatrix.hpp.

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

107 {CPPL_VERBOSE_REPORT;
108 #ifdef CPPL_DEBUG
109  if(n!=mat.m){
110  ERROR_REPORT;
111  std::cerr << "These two matrises can not make a product." << std::endl
112  << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
113  exit(1);
114  }
115 #endif//CPPL_DEBUG
116 
117  zgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) );
118  newmat.zero();
119 
120  for(CPPL_INT i=0; i<newmat.m; i++){
121  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
122  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
123  const CPPL_INT kmax =std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) );
124  for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-kl), std::max(CPPL_INT(0),j-mat.ku) ); k<kmax; k++){
125  newmat(i,j)+= operator()(i,k)*mat(k,j);
126  }
127  }
128  }
129 
130  swap(*this,newmat);
131  return *this;
132 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend void swap(zgbmatrix &, zgbmatrix &)
zgbmatrix & zgbmatrix::operator*= ( const _zgbmatrix mat)
inline

zgbmatrix*=_zgbmatrix operator

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

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

106 {CPPL_VERBOSE_REPORT;
107 #ifdef CPPL_DEBUG
108  if(n!=mat.m){
109  ERROR_REPORT;
110  std::cerr << "These two matrises can not make a product." << std::endl
111  << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
112  exit(1);
113  }
114 #endif//CPPL_DEBUG
115 
116  zgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) );
117  newmat.zero();
118 
119  for(CPPL_INT i=0; i<newmat.m; i++){
120  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
121  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
122  const CPPL_INT kmax =std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) );
123  for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-kl), std::max(CPPL_INT(0),j-mat.ku) ); k<kmax; k++){
124  newmat(i,j) += operator()(i,k)*mat(k,j);
125  }
126  }
127  }
128 
129  swap(*this,newmat);
130  mat.destroy();
131  return *this;
132 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
comple & operator()(const CPPL_INT &, const CPPL_INT &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
friend void swap(zgbmatrix &, zgbmatrix &)
zgbmatrix & zgbmatrix::operator*= ( const double &  d)
inline

zgbmatrix*=double operator

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

References array, kl, ku, and n.

4 {CPPL_VERBOSE_REPORT;
5  CPPL_INT size =(kl+ku+1)*n;
6  CPPL_INT inc =1;
7  zdscal_(&size, &d, array, &inc);
8  return *this;
9 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
zgbmatrix & zgbmatrix::operator*= ( const comple &  d)
inline

zgbmatrix*=comple operator

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

References array, kl, ku, and n.

4 {CPPL_VERBOSE_REPORT;
5  CPPL_INT size =(kl+ku+1)*n;
6  CPPL_INT inc =1;
7  zscal_(&size, &d, array, &inc);
8  return *this;
9 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
zgbmatrix & zgbmatrix::operator/= ( const double &  d)
inline

zgbmatrix/=double operator

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

References array, kl, ku, and n.

14 {CPPL_VERBOSE_REPORT;
15  CPPL_INT size =(kl+ku+1)*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: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
zgbmatrix & zgbmatrix::operator/= ( const comple &  d)
inline

zgbmatrix/=comple operator

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

References array, kl, ku, and n.

14 {CPPL_VERBOSE_REPORT;
15  CPPL_INT size =(kl+ku+1)*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: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13

Friends And Related Function Documentation

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

Definition at line 63 of file zgbmatrix-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  if( i-j>mat.kl || j-i>mat.ku ){ s << " x"; }
68  else{ s << " " << mat(i,j); }
69  }
70  s << std::endl;
71  }
72 
73  return s;
74 }
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
void swap ( zgbmatrix A,
zgbmatrix B 
)
friend

swap two matrices

Definition at line 182 of file zgbmatrix-misc.hpp.

Referenced by operator*=(), operator+=(), operator-=(), and zgbsv().

183 {CPPL_VERBOSE_REPORT;
184  CPPL_INT A_m =A.m, A_n =A.n, A_kl =A.kl, A_ku =A.ku;
185  comple* A_array =A.array;
186  comple** A_darray =A.darray;
187 
188  A.m=B.m; A.n=B.n; A.kl=B.kl; A.ku=B.ku; A.array=B.array; A.darray=B.darray;
189  B.m=A_m; B.n=A_n; B.kl=A_kl; B.ku=A_ku; B.array=A_array; B.darray=A_darray;
190 }
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgbmatrix _ ( zgbmatrix mat)
friend

convert user object to smart-temporary object

Definition at line 194 of file zgbmatrix-misc.hpp.

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

195 {CPPL_VERBOSE_REPORT;
196  _zgbmatrix newmat;
197 
198  //////// shallow copy ////////
199  newmat.m =mat.m;
200  newmat.n =mat.n;
201  newmat.kl =mat.kl;
202  newmat.ku =mat.ku;
203  newmat.array =mat.array;
204  newmat.darray =mat.darray;
205 
206  //////// nullify ////////
207  mat.m =0;
208  mat.n =0;
209  mat.kl =0;
210  mat.ku =0;
211  mat.array =NULL;
212  mat.darray =NULL;
213 
214  return newmat;
215 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
(DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class
Definition: _zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
comple * array
1D array to store matrix data
Definition: _zgbmatrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgbmatrix t ( const zgbmatrix mat)
friend

return transposed zgbmatrix

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

4 {CPPL_VERBOSE_REPORT;
5  zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
6 
7  for(CPPL_INT i=0; i<newmat.m; i++){
8  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
9  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
10  newmat(i,j) =mat(j,i);
11  }
12  }
13 
14  return _(newmat);
15 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
_zgematrix i ( const zgbmatrix mat)
friend

return its inverse matrix

Definition at line 19 of file zgbmatrix-calc.hpp.

Referenced by chsign(), col(), copy(), identity(), operator()(), operator*=(), operator+=(), operator-=(), read(), resize(), set(), to_zgematrix(), write(), zero(), zgbmatrix(), and zgbsv().

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

return its conjugate matrix

Definition at line 44 of file zgbmatrix-calc.hpp.

45 {CPPL_VERBOSE_REPORT;
46  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
47 
48  for(CPPL_INT i=0; i<mat.m; i++){
49  const CPPL_INT jmax =std::min(mat.n,i+mat.ku+1);
50  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
51  newmat(i,j) =std::conj(mat(i,j));
52  }
53  }
54 
55  return _(newmat);
56 }
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgbmatrix conj(const zgbmatrix &mat)
friend _zgbmatrix _(zgbmatrix &)
_zgbmatrix conjt ( const zgbmatrix mat)
friend

return its conjugate transposed zgbmatrix

Definition at line 60 of file zgbmatrix-calc.hpp.

61 {CPPL_VERBOSE_REPORT;
62  zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
63 
64  for(CPPL_INT i=0; i<newmat.m; i++){
65  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
66  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
67  newmat(i,j) =std::conj(mat(j,i));
68  }
69  }
70 
71  return _(newmat);
72 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgbmatrix conj(const zgbmatrix &mat)
friend _zgbmatrix _(zgbmatrix &)
const zgbmatrix& operator+ ( const zgbmatrix mat)
friend

+zgbmatrix operator

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

4 {CPPL_VERBOSE_REPORT;
5  return mat;
6 }
_zgbmatrix operator- ( const zgbmatrix mat)
friend

-zgbmatrix operator

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

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

zgbmatrix+zgematrix operator

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

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.m!=matB.m){
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(matB);
15 
16  for(CPPL_INT i=0; i<matA.m; i++){
17  const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1);
18  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){
19  newmat(i,j)+=matA(i,j);
20  }
21  }
22 
23  return _(newmat);
24 }
friend _zgematrix i(const zgbmatrix &)
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 _zgbmatrix _(zgbmatrix &)
_zgematrix operator+ ( const zgbmatrix matA,
const _zgematrix matB 
)
friend

zgbmatrix+_zgematrix operator

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

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.m!=matB.m){
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  for(CPPL_INT i=0; i<matA.m; i++){
15  const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1);
16  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){
17  matB(i,j)+=matA(i,j);
18  }
19  }
20 
21  return matB;
22 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator+ ( const zgbmatrix matA,
const zhematrix matB 
)
friend

zgbmatrix+zhematrix operator

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

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

zgbmatrix+_zhematrix operator

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

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

zgbmatrix+zgbmatrix operator

Definition at line 140 of file zgbmatrix-zgbmatrix.hpp.

141 {CPPL_VERBOSE_REPORT;
142 #ifdef CPPL_DEBUG
143  if(matA.n!=matB.n || matA.m!=matB.m){
144  ERROR_REPORT;
145  std::cerr << "These two matrises can not make a summation." << std::endl
146  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
147  exit(1);
148  }
149 #endif//CPPL_DEBUG
150 
151  zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
152  newmat.zero();
153 
154  for(CPPL_INT i=0; i<matA.m; i++){
155  const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1);
156  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){
157  newmat(i,j) += matA(i,j);
158  }
159  const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1);
160  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){
161  newmat(i,j) += matB(i,j);
162  }
163  }
164 
165  return _(newmat);
166 }
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
_zgbmatrix operator+ ( const zgbmatrix matA,
const _zgbmatrix matB 
)
friend

zgbmatrix+_zgbmatrix operator

Definition at line 140 of file zgbmatrix-_zgbmatrix.hpp.

141 {CPPL_VERBOSE_REPORT;
142 #ifdef CPPL_DEBUG
143  if(matA.n!=matB.n || matA.m!=matB.m){
144  ERROR_REPORT;
145  std::cerr << "These two matrises can not make a summation." << std::endl
146  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
147  exit(1);
148  }
149 #endif//CPPL_DEBUG
150 
151  if(matB.kl>matA.kl && matB.ku>matA.ku){
152  for(CPPL_INT i=0; i<matA.m; i++){
153  const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1);
154  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){
155  matB(i,j) += matA(i,j);
156  }
157  }
158  return matB;
159  }
160 
161  else{
162  zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
163  newmat.zero();
164 
165  for(CPPL_INT i=0; i<matA.m; i++){
166  const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1);
167  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){
168  newmat(i,j) += matA(i,j);
169  }
170  const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1);
171  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){
172  newmat(i,j) += matB(i,j);
173  }
174  }
175 
176  matB.destroy();
177  return _(newmat);
178  }
179 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
friend _zgematrix i(const zgbmatrix &)
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
friend _zgbmatrix _(zgbmatrix &)
_zgematrix operator+ ( const zgbmatrix ,
const zgsmatrix  
)
friend
_zgematrix operator+ ( const zgbmatrix ,
const _zgsmatrix  
)
friend
_zgematrix operator+ ( const zgbmatrix ,
const zhsmatrix  
)
friend
_zgematrix operator+ ( const zgbmatrix ,
const _zhsmatrix  
)
friend
_zgematrix operator- ( const zgbmatrix matA,
const zgematrix matB 
)
friend

zgbmatrix-zgematrix operator

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

29 {CPPL_VERBOSE_REPORT;
30 #ifdef CPPL_DEBUG
31  if(matA.n!=matB.n || matA.m!=matB.m){
32  ERROR_REPORT;
33  std::cerr << "These two matrises can not make a summation." << std::endl
34  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
35  exit(1);
36  }
37 #endif//CPPL_DEBUG
38 
39  zgematrix newmat(-matB);
40 
41  for(CPPL_INT i=0; i<matA.m; i++){
42  const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1);
43  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){
44  newmat(i,j)+=matA(i,j);
45  }
46  }
47 
48  return _(newmat);
49 }
friend _zgematrix i(const zgbmatrix &)
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 _zgbmatrix _(zgbmatrix &)
_zgematrix operator- ( const zgbmatrix matA,
const _zgematrix matB 
)
friend

zgbmatrix-_zgematrix operator

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

27 {CPPL_VERBOSE_REPORT;
28 #ifdef CPPL_DEBUG
29  if(matA.n!=matB.n || matA.m!=matB.m){
30  ERROR_REPORT;
31  std::cerr << "These two matrises can not make a summation." << std::endl
32  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
33  exit(1);
34  }
35 #endif//CPPL_DEBUG
36 
37  //// change sign ////
38  for(CPPL_INT i=0; i<matB.m*matB.n; i++){
39  matB.array[i] = -matB.array[i];
40  }
41 
42  //// add ////
43  for(CPPL_INT i=0; i<matA.m; i++){
44  const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1);
45  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){
46  matB(i,j) +=matA(i,j);
47  }
48  }
49 
50  return matB;
51 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator- ( const zgbmatrix matA,
const zhematrix matB 
)
friend

zgbmatrix-zhematrix operator

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

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

zgbmatrix-_zhematrix operator

Definition at line 32 of file zgbmatrix-_zhematrix.hpp.

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

zgbmatrix-zgbmatrix operator

Definition at line 170 of file zgbmatrix-zgbmatrix.hpp.

171 {CPPL_VERBOSE_REPORT;
172 #ifdef CPPL_DEBUG
173  if(matA.n!=matB.n || matA.m!=matB.m){
174  ERROR_REPORT;
175  std::cerr << "These two matrises can not make a subtraction." << std::endl
176  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
177  exit(1);
178  }
179 #endif//CPPL_DEBUG
180 
181  zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
182  newmat.zero();
183 
184  for(CPPL_INT i=0; i<matA.m; i++){
185  const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1);
186  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){
187  newmat(i,j) += matA(i,j);
188  }
189  const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1);
190  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){
191  newmat(i,j) -= matB(i,j);
192  }
193  }
194 
195  return _(newmat);
196 }
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
_zgbmatrix operator- ( const zgbmatrix matA,
const _zgbmatrix matB 
)
friend

zgbmatrix-_zgbmatrix operator

Definition at line 183 of file zgbmatrix-_zgbmatrix.hpp.

184 {CPPL_VERBOSE_REPORT;
185 #ifdef CPPL_DEBUG
186  if(matA.n!=matB.n || matA.m!=matB.m){
187  ERROR_REPORT;
188  std::cerr << "These two matrises can not make a subtraction." << std::endl
189  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
190  exit(1);
191  }
192 #endif//CPPL_DEBUG
193 
194  zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
195  newmat.zero();
196 
197  for(CPPL_INT i=0; i<matA.m; i++){
198  const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1);
199  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){
200  newmat(i,j) += matA(i,j);
201  }
202  const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1);
203  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){
204  newmat(i,j) -= matB(i,j);
205  }
206  }
207 
208  matB.destroy();
209  return _(newmat);
210 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
friend _zgematrix i(const zgbmatrix &)
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
friend _zgbmatrix _(zgbmatrix &)
_zgematrix operator- ( const zgbmatrix ,
const zgsmatrix  
)
friend
_zgematrix operator- ( const zgbmatrix ,
const _zgsmatrix  
)
friend
_zgematrix operator- ( const zgbmatrix ,
const zhsmatrix  
)
friend
_zgematrix operator- ( const zgbmatrix ,
const _zhsmatrix  
)
friend
_zcovector operator* ( const zgbmatrix mat,
const zcovector vec 
)
friend

zgbmatrix*zcovector operator

Definition at line 3 of file zgbmatrix-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 lda =mat.kl+mat.ku+1;
18  CPPL_INT inc =1;
19  comple beta =comple(0.,0.);
20 
21  zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc );
22 
23  return _(newvec);
24 }
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: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zcovector operator* ( const zgbmatrix mat,
const _zcovector vec 
)
friend

zgbmatrix*_zcovector operator

Definition at line 3 of file zgbmatrix-_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 lda =mat.kl+mat.ku+1;
18  CPPL_INT inc =1;
19  comple beta =comple(0.,0.);
20 
21  zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc );
22 
23  vec.destroy();
24  return _(newvec);
25 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
void destroy() const
comple * array
1D array to store vector data
Definition: _zcovector.hpp:10
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT l
vector size
Definition: _zcovector.hpp:9
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgematrix operator* ( const zgbmatrix matA,
const zgematrix matB 
)
friend

zgbmatrix*zgematrix operator

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

54 {CPPL_VERBOSE_REPORT;
55 #ifdef CPPL_DEBUG
56  if(matA.n!=matB.m){
57  ERROR_REPORT;
58  std::cerr << "These two matrises can not make a product." << std::endl
59  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
60  exit(1);
61  }
62 #endif//CPPL_DEBUG
63 
64  zgematrix newmat( matA.m, matB.n );
65  newmat.zero();
66 
67  for(CPPL_INT i=0; i<newmat.m; i++){
68  for(CPPL_INT j=0; j<newmat.n; j++){
69  const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1);
70  for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){
71  newmat(i,j)+=matA(i,k)*matB(k,j);
72  }
73  }
74  }
75 
76  return _(newmat);
77 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgbmatrix &)
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 _zgbmatrix _(zgbmatrix &)
_zgematrix operator* ( const zgbmatrix matA,
const _zgematrix matB 
)
friend

zgbmatrix*_zgematrix operator

Definition at line 55 of file zgbmatrix-_zgematrix.hpp.

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

zgbmatrix*zhematrix operator

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

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

zgbmatrix*_zhematrix operator

Definition at line 61 of file zgbmatrix-_zhematrix.hpp.

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

zgbmatrix*zgbmatrix operator

Definition at line 200 of file zgbmatrix-zgbmatrix.hpp.

201 {CPPL_VERBOSE_REPORT;
202 #ifdef CPPL_DEBUG
203  if(matA.n!=matB.m){
204  ERROR_REPORT;
205  std::cerr << "These two matrises can not make a product." << std::endl
206  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
207  exit(1);
208  }
209 #endif//CPPL_DEBUG
210 
211  zgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) );
212  newmat.zero();
213 
214  for(CPPL_INT i=0; i<newmat.m; i++){
215  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
216  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
217  const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) );
218  for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){
219  newmat(i,j) += matA(i,k)*matB(k,j);
220  }
221  }
222  }
223 
224  return _(newmat);
225 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
_zgbmatrix operator* ( const zgbmatrix matA,
const _zgbmatrix matB 
)
friend

zgbmatrix*_zgbmatrix operator

Definition at line 214 of file zgbmatrix-_zgbmatrix.hpp.

215 {CPPL_VERBOSE_REPORT;
216 #ifdef CPPL_DEBUG
217  if(matA.n!=matB.m){
218  ERROR_REPORT;
219  std::cerr << "These two matrises can not make a product." << std::endl
220  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
221  exit(1);
222  }
223 #endif//CPPL_DEBUG
224 
225  zgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) );
226  newmat.zero();
227 
228  for(CPPL_INT i=0; i<newmat.m; i++){
229  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
230  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
231  const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) );
232  for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){
233  newmat(i,j) += matA(i,k)*matB(k,j);
234  }
235  }
236  }
237 
238  matB.destroy();
239  return _(newmat);
240 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
friend _zgematrix i(const zgbmatrix &)
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
void destroy() const
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
friend _zgbmatrix _(zgbmatrix &)
_zgematrix operator* ( const zgbmatrix ,
const zgsmatrix  
)
friend
_zgematrix operator* ( const zgbmatrix ,
const _zgsmatrix  
)
friend
_zgematrix operator* ( const zgbmatrix ,
const zhsmatrix  
)
friend
_zgematrix operator* ( const zgbmatrix ,
const _zhsmatrix  
)
friend
_zgbmatrix operator* ( const zgbmatrix mat,
const double &  d 
)
friend

zgbmatrix*double operator

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

29 {CPPL_VERBOSE_REPORT;
30  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
31 
32  const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.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 zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgbmatrix operator* ( const zgbmatrix mat,
const comple &  d 
)
friend

zgbmatrix*comple operator

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

29 {CPPL_VERBOSE_REPORT;
30  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
31 
32  const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.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 zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgbmatrix operator/ ( const zgbmatrix mat,
const double &  d 
)
friend

zgbmatrix/double operator

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

43 {CPPL_VERBOSE_REPORT;
44  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
45 
46  const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.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 zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgbmatrix operator/ ( const zgbmatrix mat,
const comple &  d 
)
friend

zgbmatrix/comple operator

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

43 {CPPL_VERBOSE_REPORT;
44  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
45 
46  const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.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 zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgbmatrix operator* ( const double &  d,
const zgbmatrix mat 
)
friend

double*zgbmatrix operator

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

4 {CPPL_VERBOSE_REPORT;
5  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
6 
7  const CPPL_INT size =(mat.kl+mat.ku+1)*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 zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13
_zgbmatrix operator* ( const comple &  d,
const zgbmatrix mat 
)
friend

comple*zgbmatrix operator

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

4 {CPPL_VERBOSE_REPORT;
5  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
6 
7  const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.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 zgbmatrix &)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
friend _zgbmatrix _(zgbmatrix &)
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13

Member Data Documentation

CPPL_INT zgbmatrix::m
CPPL_INT zgbmatrix::n
CPPL_INT zgbmatrix::kl
CPPL_INT zgbmatrix::ku
comple* zgbmatrix::array
comple** zgbmatrix::darray

array of pointers of column head addresses

Definition at line 14 of file zgbmatrix.hpp.

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


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