6 std::cerr <<
"# [MARK] zssmatrix::clear()"
11 std::cerr <<
"# [NOTE] zssmatrix::clear() "
12 <<
" An array at " <<
Array
13 <<
" is going to be cleared." << std::endl;
18 delete [] Indx; Indx =NULL;
19 delete [] Jndx; Jndx =NULL;
27 std::cerr <<
"# [MARK] zssmatrix::zero()"
39 std::cerr <<
"# [MARK] zssmatrix::chsign()"
43 for(
long i=0; i<VOL; i++){
Array[i] =-
Array[i]; }
51 std::cerr <<
"# [MARK] zssmatrix::copy(const zssmatrix&)"
56 std::cerr <<
"# [NOTE] zssmatrix::copy(const zssmatrix&) "
57 <<
"A zssmatrix at " <<
Array <<
" is going to be deleted.";
60 resize(mat.M, mat.N, mat.CAP);
62 zcopy_(VOL, mat.Array, 1, Array, 1);
63 for(
long i=0; i<VOL; i++){
69 std::cerr <<
" Then, a COPY of a zssmatrix has been cleated at "
70 << Array <<
"." << std::endl;
80 std::cerr <<
"# [MARK] zssmatrix::shallow_copy(const _zssmatrix&)"
85 std::cerr <<
"# [NOTE] zssmatrix:shallow_copy(const _zssmatrix&) "
86 <<
"A zssmatrix at " <<
Array <<
" is going to be deleted, "
87 <<
"and point at " << mat.
Array <<
" instead." << std::endl;
107 std::cerr <<
"# [MARK] zssmatrix::resize(const long&, const long&, const long&)"
112 if( _m<0 || _n<0 || _c<0 ){
113 std::cerr <<
"[ERROR] zssmatrix::resize"
114 <<
"(const long&, const long&, const long&)"
116 <<
"Matrix sizes and the length of arrays "
117 <<
"must be positive integers. " << std::endl
118 <<
"Your input was (" << _m <<
"," << _n <<
"," << _c <<
")."
129 Array =
new std::complex<double>[CAP];
139 std::cerr <<
"# [MARK] zssmatrix::expand(const long&)"
145 std::cerr <<
"[ERROR] zssmatrix::expand(const long&)" << std::endl
146 <<
"The argument must be a positive integer. " << std::endl
147 <<
"Your input was (" << dc <<
")." << std::endl;
153 std::complex<double>* newArray(
new std::complex<double>[CAP]);
154 long *newIndx(
new long[CAP]), *newJndx(
new long[CAP]);
156 for(
int c=0; c<VOL; c++){
157 newArray[c] =
Array[c];
175 std::cerr <<
"# [MARK] zssmatrix::isListed(const long&, const long&)"
180 if( i<0 || j<0 || M<=i || N<=j ){
181 std::cerr <<
"[ERROR] zssmatrix::isListed(const long&, const long&)"
183 <<
"The required component is out of the matrix size."
185 <<
"Your input was (" << i <<
"," << j <<
")." << std::endl;
190 for(
int c=0; c<VOL; c++){
191 if(Indx[c]==i && Jndx[c]==j){
return 1; }
203 std::cerr <<
"# [MARK] zssmatrix::number(const long&, const long&)"
208 if( i<0 || j<0 || M<=i || N<=j ){
209 std::cerr <<
"[ERROR] zssmatrix::number(const long&, const long&)"
211 <<
"The required component is out of the matrix size."
213 <<
"Your input was (" << i <<
"," << j <<
")." << std::endl;
218 for(
long c=0; c<VOL; c++){
219 if(Indx[c]==i && Jndx[c]==j){
return c; }
231 std::cerr <<
"# [MARK] swap(zssmatrix&, zssmatrix&)"
235 long A_M(A.M), A_N(A.N), A_CAP(A.CAP), A_VOL(A.VOL);
236 std::complex<double>* A_Array(A.Array);
237 long *A_Indx(A.Indx), *A_Jndx(A.Jndx);
238 A.M=B.M; A.N=B.N; A.CAP=B.CAP; A.VOL=B.VOL;
239 A.Array=B.Array; A.Indx=B.Indx; A.Jndx=B.Jndx;
240 B.M=A_M; B.N=A_N; B.CAP=A_CAP; B.VOL=A_VOL;
241 B.Array=A_Array; B.Indx=A_Indx; B.Jndx=A_Jndx;
249 std::cerr <<
"# [MARK] _(zssmatrix&)"
259 newmat.
Array =mat.Array;
260 newmat.
Indx =mat.Indx;
261 newmat.
Jndx =mat.Jndx;
283 std::cerr <<
"# [MARK] zssmatrix::checkup()"
289 std::cerr <<
"[ERROR] zssmatrix::checkup()" << std::endl
290 <<
"The cap is not valid." << std::endl
291 <<
"CAP was " << CAP <<
"." << std::endl;
296 if(VOL<0 || VOL==CAP){
297 std::cerr <<
"[ERROR] zssmatrix::checkup()" << std::endl
298 <<
"The vol is not valid." << std::endl
299 <<
"VOL was " << VOL <<
"while CAP is " << CAP <<
"."
305 for(
long c=0; c<VOL; c++){
307 if(Indx[c]<0 || Indx[c]>=M){
308 std::cerr <<
"[ERROR] zssmatrix::checkup()" << std::endl
309 <<
"The indx of the " << c
310 <<
"th element is out of the matrix size." << std::endl
311 <<
"Indx[" << c <<
"] was " << Indx[c] <<
"." << std::endl;
316 if(Jndx[c]<0 || Jndx[c]>=N){
317 std::cerr <<
"[ERROR] zssmatrix::checkup()" << std::endl
318 <<
"The jndx of the " << c
319 <<
"th element is out of the matrix size." << std::endl
320 <<
"Jndx[" << c <<
"] was " << Jndx[c] <<
"." << std::endl;
325 for(
long C=c+1; C<VOL; C++){
326 if(Indx[c]==Indx[C] && Jndx[c]==Jndx[C]){
327 std::cerr <<
"[ERROR] zssmatrix::checkup()" << std::endl
328 <<
"The (" << Indx[c] <<
", " << Jndx[c]
329 <<
") component is std::complex<double>-listed at the "
330 << c <<
"th and the" << C <<
"the elements."<< std::endl;
337 std::cerr <<
"# [NOTE] zssmatrix::checkup() "
338 <<
"This sparse matrix is fine." << std::endl;
void checkup()
Definition: zssmatrix-misc.hpp:280
void clear()
Definition: zssmatrix-misc.hpp:3
long M
matrix row size
Definition: _zssmatrix.hpp:7
long VOL
the number of non-zero components
Definition: _zssmatrix.hpp:10
void zero()
Definition: zssmatrix-misc.hpp:24
bool isListed(const long &, const long &)
Definition: zssmatrix-misc.hpp:172
(DO NOT USE) Smart-temporary Complex Double-precision Sparse Matrix Class
Definition: _zssmatrix.hpp:3
void expand(const long &)
Definition: zssmatrix-misc.hpp:136
void chsign()
Definition: zssmatrix-misc.hpp:36
void copy(const zssmatrix &)
Definition: zssmatrix-misc.hpp:48
long * Jndx
1D array to store the j-index of non-zero matrix components
Definition: _zssmatrix.hpp:13
void shallow_copy(const _zssmatrix &)
Definition: zssmatrix-misc.hpp:77
long CAP
the length of data arrays
Definition: _zssmatrix.hpp:9
long number(const long &, const long &)
Definition: zssmatrix-misc.hpp:200
std::complex< double > * Array
1D array to store non-zero matrix data
Definition: _zssmatrix.hpp:11
void resize(const long &, const long &, const long &)
Definition: zssmatrix-misc.hpp:104
std::complex< double > * Array
1D Array to store vector data
Definition: _zrovector.hpp:8
long N
matrix column size
Definition: _zssmatrix.hpp:8
Complex Double-precision Sparse Matrix Class.
Definition: zssmatrix.hpp:3
long * Indx
1D array to store the i-index of non-zero matrix components
Definition: _zssmatrix.hpp:12