//=============================================================================
/*! operator() for object */
inline std::complex<double>& _zgematrix::operator()(const long& i, const long& j) const
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] _zgematrix::operator()(const long&, const long&) const"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if( i<0 || j<0 || M<=i || N<=j ){
std::cerr << "[ERROR] _zgematrix::operator()(long, long)" << std::endl
<< "The required component is out of the matrix size."
<< std::endl
<< "Your input was (" << i << "," << j << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
//return Array[i+M*j];
return Darray[j][i];
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
inline std::ostream& operator<<(std::ostream& s, const _zgematrix& mat)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator<<(std::ostream&, const _zgematrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
for(long i=0; i<mat.M; i++){
for(long j=0; j<mat.N; j++){
s << " " << mat(i,j);
}
s << std::endl;
}
mat.destroy();
return s;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
inline void _zgematrix::write(const char *filename) const
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] _zgematrix::write(const char*) const"
<< std::endl;
#endif//CPPL_VERBOSE
std::ofstream s(filename, std::ios::trunc);
s << "zgematrix" << " " << M << " " << N << std::endl;
for(long i=0; i<M; i++){
for(long j=0; j<N; j++){
s << operator()(i,j) << " ";
}
s << std::endl;
}
s.close();
destroy();
}