//============================================================================
/*! zgsmatrix constructor without arguments */
inline zgsmatrix::zgsmatrix()
: m(M), n(N), cap(CAP), vol(VOL), array(Array), indx(Indx), jndx(Jndx), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] zgsmatrix::zgsmatrix()" << std::endl;
#endif//CPPL_VERBOSE
//////// initialize ////////
M =N =0;
CAP =VOL =0;
Array =NULL;
Indx =Jndx =NULL;
Rows =Cols =NULL;
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] zgsmatrix::zgsmatrix()" << " A new 0x0 matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//============================================================================
/*! zgsmatrix copy constructor */
inline zgsmatrix::zgsmatrix(const zgsmatrix& mat)
: m(M), n(N), cap(CAP), vol(VOL), array(Array), indx(Indx), jndx(Jndx), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] zgsmatrix::zgsmatrix(const zgsmatrix&)" << std::endl;
#endif//CPPL_VERBOSE
Array =NULL;
Indx =Jndx =NULL;
Rows =Cols =NULL;
copy(mat);
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] zgsmatrix::zgsmatrix(const zgsmatrix&)" << " A new matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
//============================================================================
/*! zgsmatrix constructor to cast _zgsmatrix */
inline zgsmatrix::zgsmatrix(const _zgsmatrix& mat)
: m(M), n(N), cap(CAP), vol(VOL), array(Array), indx(Indx), jndx(Jndx), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] zgsmatrix::zgsmatrix(const _zgsmatrix&)" << std::endl;
#endif//CPPL_VERBOSE
M =mat.M;
N =mat.N;
CAP =mat.CAP;
VOL =mat.VOL;
Array =mat.Array;
Indx =mat.Indx;
Jndx =mat.Jndx;
Rows =mat.Rows;
Cols =mat.Cols;
mat.nullify();
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] zgsmatrix::zgsmatrix(const _zgsmatrix&)" << " A new matrix pointing at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//============================================================================
/*! zgsmatrix constructor with size specification */
inline zgsmatrix::zgsmatrix(const long& _m, const long& _n, const long _c)
: m(M), n(N), cap(CAP), vol(VOL), array(Array), indx(Indx), jndx(Jndx), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] zgsmatrix::zgsmatrix(const long&, const long&, const long&)" << std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if( _m<0 || _n<0 || _c<0 ){
std::cerr << "[ERROR] zgsmatrix::zgsmatrix(const long&, const long&, const long&)" << std::endl
<< "Matrix sizes and the length of arrays must be positive integers. " << std::endl
<< "Your input was (" << _m << "," << _n << "," << _c << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
//////// initialize ////////
M =_m; N =_n;
CAP =_c;
VOL =0;
Array =new std::complex<double>[CAP];
Indx =new long[CAP];
Jndx =new long[CAP];
Rows =new std::vector< std::pair<long,long> >[M];
Cols =new std::vector< std::pair<long,long> >[N];
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] zgsmatrix(const long&, const long&, const long&)" << " A new matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
//============================================================================
/*! zgsmatrix constructor with filename */
inline zgsmatrix::zgsmatrix(const char* filename)
: m(M), n(N), cap(CAP), vol(VOL), array(Array), indx(Indx), jndx(Jndx), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] zgsmatrix::zgsmatrix(const char*)" << std::endl;
#endif//CPPL_VERBOSE
Array =NULL;
Indx =Jndx =NULL;
Rows =Cols =NULL;
//// read ////
read(filename);
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] zgsmatrix::zgsmatrix(const char*)" << " A new matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//============================================================================
/*! zgsmatrix destructor */
inline zgsmatrix::~zgsmatrix()
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] zgsmatrix::~zgsmatrix()" << std::endl;
std::cerr << "# [NOTE] zgsmatrix::~zgsmatrix()" << " A matrix at " << Array << " is going to be deleted." << std::endl;
#endif//CPPL_VERBOSE
delete [] Array;
delete [] Indx;
delete [] Jndx;
delete [] Rows;
delete [] Cols;
}