//=============================================================================
/*! dgsmatrix constructor without arguments */
inline dgsmatrix::dgsmatrix()
: m(M), n(N), data(Data), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] dgsmatrix::dgsmatrix()" << std::endl;
#endif//CPPL_VERBOSE
//////// initialize ////////
M =0;
N =0;
Data.clear();
Rows.clear();
Cols.clear();
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] dgsmatrix::dgsmatrix()" << " A new 0x0 matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
/*! dgsmatrix copy constructor */
inline dgsmatrix::dgsmatrix(const dgsmatrix& mat)
: m(M), n(N), data(Data), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] dgsmatrix::dgsmatrix(const dgsmatrix&)" << std::endl;
#endif//CPPL_VERBOSE
M =mat.M;
N =mat.N;
Data.clear();
Rows.clear();
Cols.clear();
copy(mat);
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] dgsmatrix::dgsmatrix(const dgsmatrix&)" << " A new matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
//=============================================================================
/*! dgsmatrix constructor to cast _dgsmatrix */
inline dgsmatrix::dgsmatrix(const _dgsmatrix& mat)
: m(M), n(N), data(Data), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] dgsmatrix::dgsmatrix(const _dgsmatrix&)" << std::endl;
#endif//CPPL_VERBOSE
M =mat.M;
N =mat.N;
Data.clear();
Rows.clear();
Cols.clear();
Data.swap(mat.Data);
Rows.swap(mat.Rows);
Cols.swap(mat.Cols);
mat.nullify();
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] dgsmatrix::dgsmatrix(const _dgsmatrix&)" << " A new matrix pointing at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
/*! dgsmatrix constructor with size specification */
inline dgsmatrix::dgsmatrix(const long& _m, const long& _n, const long _c)
: m(M), n(N), data(Data), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] dgsmatrix::dgsmatrix(const long&, const long&, const long&)" << std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if( _m<0 || _n<0 || _c<0 ){
std::cerr << "[ERROR] dgsmatrix::dgsmatrix(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;
Data.resize(0);
Data.reserve(_c);
Rows.resize(M);
Cols.resize(N);
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] dgsmatrix(const long&, const long&, const long&)" << " A new matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
//=============================================================================
/*! dgsmatrix constructor with filename */
inline dgsmatrix::dgsmatrix(const char* filename)
: m(M), n(N), data(Data), rows(Rows), cols(Cols)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] dgsmatrix::dgsmatrix(const char*)" << std::endl;
#endif//CPPL_VERBOSE
Data.clear();
Rows.clear();
Cols.clear();
//// read ////
read(filename);
#ifdef CPPL_VERBOSE
std::cerr << "# [NOTE] dgsmatrix::dgsmatrix(const char*)" << " A new matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_VERBOSE
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
/*! dgsmatrix destructor */
inline dgsmatrix::~dgsmatrix()
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] dgsmatrix::~dgsmatrix()" << std::endl;
std::cerr << "# [NOTE] dgsmatrix::~dgsmatrix()" << " A matrix at " << Array << " is going to be deleted." << std::endl;
#endif//CPPL_VERBOSE
Data.clear();
Rows.clear();
Cols.clear();
}