6 std::cerr <<
"# [MARK] dssmatrix::clear()"
11 std::cerr <<
"# [NOTE] dssmatrix::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] dssmatrix::zero()"
39 std::cerr <<
"# [MARK] dssmatrix::chsign()"
43 for(
long i=0; i<VOL; i++){
Array[i] =-
Array[i]; }
51 std::cerr <<
"# [MARK] dssmatrix::copy(const dssmatrix&)"
56 std::cerr <<
"# [NOTE] dssmatrix::copy(const dssmatrix&) "
57 <<
"A dssmatrix at " <<
Array <<
" is going to be deleted.";
60 resize(mat.M, mat.N, mat.CAP);
62 dcopy_(VOL, mat.Array, 1, Array, 1);
63 for(
long i=0; i<VOL; i++){
69 std::cerr <<
" Then, a COPY of a dssmatrix has been cleated at "
70 << Array <<
"." << std::endl;
80 std::cerr <<
"# [MARK] dssmatrix::shallow_copy(const _dssmatrix&)"
85 std::cerr <<
"# [NOTE] dssmatrix:shallow_copy(const _dssmatrix&) "
86 <<
"A dssmatrix at " << Array <<
" is going to be deleted, "
87 <<
"and point at " << mat.
Array <<
" instead." << std::endl;
107 std::cerr <<
"# [MARK] dssmatrix::resize(const long&, const long&, const long&)"
112 if( _m<0 || _n<0 || _c<0 ){
113 std::cerr <<
"[ERROR] dssmatrix::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 double[CAP];
139 std::cerr <<
"# [MARK] dssmatrix::expand(const long&)"
145 std::cerr <<
"[ERROR] dssmatrix::expand(const long&)" << std::endl
146 <<
"The argument must be a positive integer. " << std::endl
147 <<
"Your input was (" << dc <<
")." << std::endl;
153 double* newArray(
new 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] dssmatrix::isListed(const long&, const long&)"
180 if( i<0 || j<0 || M<=i || N<=j ){
181 std::cerr <<
"[ERROR] dssmatrix::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] dssmatrix::number(const long&, const long&)"
208 if( i<0 || j<0 || M<=i || N<=j ){
209 std::cerr <<
"[ERROR] dssmatrix::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(dssmatrix&, dssmatrix&)"
235 long A_M(A.M), A_N(A.N), A_CAP(A.CAP), A_VOL(A.VOL);
236 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] _(dssmatrix&)"
259 newmat.
Array =mat.Array;
260 newmat.
Indx =mat.Indx;
261 newmat.
Jndx =mat.Jndx;
285 std::cerr <<
"# [MARK] dssmatrix::checkup()"
291 std::cerr <<
"[ERROR] dssmatrix::checkup()" << std::endl
292 <<
"The cap is not valid." << std::endl
293 <<
"CAP was " << CAP <<
"." << std::endl;
298 if(VOL<0 || VOL>CAP){
299 std::cerr <<
"[ERROR] dssmatrix::checkup()" << std::endl
300 <<
"The vol is not valid." << std::endl
301 <<
"VOL was " << VOL <<
"while CAP is " << CAP <<
"."
307 for(
long c=0; c<VOL; c++){
309 if(Indx[c]<0 || Indx[c]>=M){
310 std::cerr <<
"[ERROR] dssmatrix::checkup()" << std::endl
311 <<
"The indx of the " << c
312 <<
"th element is out of the matrix size." << std::endl
313 <<
"Indx[" << c <<
"] was " << Indx[c] <<
"." << std::endl;
318 if(Jndx[c]<0 || Jndx[c]>=N){
319 std::cerr <<
"[ERROR] dssmatrix::checkup()" << std::endl
320 <<
"The jndx of the " << c
321 <<
"th element is out of the matrix size." << std::endl
322 <<
"Jndx[" << c <<
"] was " << Jndx[c] <<
"." << std::endl;
327 for(
long C=c+1; C<VOL; C++){
328 if(Indx[c]==Indx[C] && Jndx[c]==Jndx[C]){
329 std::cerr <<
"[ERROR] dssmatrix::checkup()" << std::endl
330 <<
"The (" << Indx[c] <<
", " << Jndx[c]
331 <<
") component is double-listed at the "
332 << c <<
"th and the" << C <<
"the elements."<< std::endl;
339 std::cerr <<
"# [NOTE] dssmatrix::checkup() "
340 <<
"This sparse matrix is fine." << std::endl;
double * Array
1D array to store non-zero matrix data
Definition: _dssmatrix.hpp:11
void zero()
Definition: dssmatrix-misc.hpp:24
void copy(const dssmatrix &)
Definition: dssmatrix-misc.hpp:48
void checkup()
Definition: dssmatrix-misc.hpp:282
(DO NOT USE) Smart-temporary Real Double-precision Sparse Matrix Class
Definition: _dssmatrix.hpp:3
void chsign()
Definition: dssmatrix-misc.hpp:36
double * Array
1D Array to store vector data
Definition: _drovector.hpp:8
long M
matrix row size
Definition: _dssmatrix.hpp:7
long CAP
the length of data arrays
Definition: _dssmatrix.hpp:9
void shallow_copy(const _dssmatrix &)
Definition: dssmatrix-misc.hpp:77
bool isListed(const long &, const long &)
Definition: dssmatrix-misc.hpp:172
long * Jndx
1D array to store the j-index of non-zero matrix components
Definition: _dssmatrix.hpp:13
void clear()
Definition: dssmatrix-misc.hpp:3
long VOL
the number of non-zero components
Definition: _dssmatrix.hpp:10
long number(const long &, const long &)
Definition: dssmatrix-misc.hpp:200
long N
matrix column size
Definition: _dssmatrix.hpp:8
Real Double-precision Sparse Matrix Class.
Definition: dssmatrix.hpp:3
long * Indx
1D array to store the i-index of non-zero matrix components
Definition: _dssmatrix.hpp:12
void resize(const long &, const long &, const long &)
Definition: dssmatrix-misc.hpp:104
void expand(const long &)
Definition: dssmatrix-misc.hpp:136