CPPLapack
Public Member Functions | Public Attributes | Friends
zgematrix_small< m, n > Class Template Reference

Samll Complex Double-precision General Dence Matrix Class. More...

#include <zgematrix_small.hpp>

List of all members.

Public Member Functions

 zgematrix_small ()
 zgematrix_small (const zgematrix &)
 zgematrix_small (const comple &)
 ~zgematrix_small ()
_zgematrix to_zgematrix () const
comple & operator() (const long &i, const long &j)
comple operator() (const long &i, const long &j) const
zgematrix_small< m, n > & set (const long &i, const long &j, const comple &v)
void read (const char *filename)
void write (const char *filename) const
zgematrix_small< m, n > & zero ()
zgematrix_small< m, n > & identity ()
zcovector_small< m > col (const long &j) const
zrovector_small< n > row (const long &i) const
template<long M, long N>
zgematrix_small< M, N > & operator= (const zgematrix_small< M, N > &)

Public Attributes

comple array [m *n]

Friends

template<long _m, long _n>
std::ostream & operator<< (std::ostream &, const zgematrix_small< _m, _n > &)
template<long _m, long _n>
zgematrix_small< n, m > t (const zgematrix_small< m, n > &)
template<long M, long N>
zgematrix_small< M, N > & operator+= (zgematrix_small< M, N > &, const zgematrix_small< M, N > &)
template<long M, long N>
zgematrix_small< M, N > & operator-= (zgematrix_small< M, N > &, const zgematrix_small< M, N > &)
template<long M, long L, long N>
zgematrix_small< M, N > & operator*= (zgematrix_small< M, L > &, const zgematrix_small< L, N > &)
template<long M, long N>
zgematrix_small< M, N > & operator*= (zgematrix_small< M, N > &, const comple &)
template<long M, long N>
zgematrix_small< M, N > & operator/= (zgematrix_small< M, N > &, const comple &)
template<long M, long N>
const zgematrix_small< M, N > & operator+ (const zgematrix_small< M, N > &)
template<long M, long N>
zgematrix_small< M, N > operator- (const zgematrix_small< M, N > &)
template<long M, long N>
zgematrix_small< M, N > operator+ (const zgematrix_small< M, N > &, const zgematrix_small< M, N > &)
template<long M, long N>
zgematrix_small< M, N > operator+ (const zgematrix_small< M, N > &, const zhematrix_small< N > &)
template<long M, long N>
zgematrix_small< M, N > operator- (const zgematrix_small< M, N > &, const zgematrix_small< M, N > &)
template<long M, long N>
zgematrix_small< M, N > operator- (const zgematrix_small< M, N > &, const zhematrix_small< N > &)
template<long M, long N>
zcovector_small< M > operator* (const zgematrix_small< M, N > &, const zcovector_small< N > &)
template<long M, long L, long N>
zgematrix_small< M, N > operator* (const zgematrix_small< M, L > &, const zgematrix_small< L, N > &)
template<long M, long N>
zgematrix_small< M, N > operator* (const zgematrix_small< M, N > &, const zhematrix_small< N > &)
template<long M, long N>
zgematrix_small< M, N > operator* (const zgematrix_small< M, N > &, const comple &)
template<long M, long N>
zgematrix_small< M, N > operator/ (const zgematrix_small< M, N > &, const comple &)
template<long M, long N>
zgematrix_small< M, N > operator* (const comple &, const zgematrix_small< M, N > &)

Detailed Description

template<long m, long n>
class zgematrix_small< m, n >

Samll Complex Double-precision General Dence Matrix Class.

Definition at line 3 of file zgematrix_small.hpp.


Constructor & Destructor Documentation

template<long m, long n>
zgematrix_small< m, n >::zgematrix_small ( ) [inline]

Definition at line 4 of file zgematrix_small-constructors.hpp.

{VERBOSE_REPORT;
  ;
}
template<long m, long n>
zgematrix_small< m, n >::zgematrix_small ( const zgematrix mat) [inline, explicit]

Definition at line 12 of file zgematrix_small-constructors.hpp.

References zgematrix::array, zgematrix::m, and zgematrix::n.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( m!=mat.m || n!=mat.n ){
    ERROR_REPORT;
    std::cerr << "Matrix sizes must be the same." << std::endl
              << "Your input was " << m << "x" << n << " and " << mat.m << "x" << mat.n << "." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long k=0; k<m*n; k++){
    array[k] =mat.array[k];
  }
}
template<long m, long n>
zgematrix_small< m, n >::zgematrix_small ( const comple &  x) [inline]

Definition at line 31 of file zgematrix_small-constructors.hpp.

{VERBOSE_REPORT;
  for(long k=0; k<m*n; k++){
    array[k] =x;
  }
}
template<long m, long n>
zgematrix_small< m, n >::~zgematrix_small ( ) [inline]

Definition at line 45 of file zgematrix_small-constructors.hpp.

{VERBOSE_REPORT;
  ;
}

Member Function Documentation

template<long m, long n>
_zgematrix zgematrix_small< m, n >::to_zgematrix ( ) const [inline]

Definition at line 4 of file zgematrix_small-functions.hpp.

References _(), and i().

{VERBOSE_REPORT;
  zgematrix mat(m,n);
  for(long i=0; i<m; i++){
    for(long j=0; j<n; j++){
      mat(i,j) =(*this)(i,j);
    }
  }
  return _(mat);
}
template<long m, long n>
comple & zgematrix_small< m, n >::operator() ( const long &  i,
const long &  j 
) [inline]

Definition at line 22 of file zgematrix_small-functions.hpp.

{VERBOSE_REPORT;
  return array[i+m*j];
}
template<long m, long n>
comple zgematrix_small< m, n >::operator() ( const long &  i,
const long &  j 
) const [inline]

Definition at line 30 of file zgematrix_small-functions.hpp.

{VERBOSE_REPORT;
  return array[i+m*j];
}
template<long m, long n>
zgematrix_small< m, n > & zgematrix_small< m, n >::set ( const long &  i,
const long &  j,
const comple &  v 
) [inline]

Definition at line 38 of file zgematrix_small-functions.hpp.

References i().

{VERBOSE_REPORT;
  (*this)(i,j) =v;
  return *this;
}
template<long m, long n>
void zgematrix_small< m, n >::read ( const char *  filename) [inline]

Definition at line 82 of file zgematrix_small-functions.hpp.

References i().

{VERBOSE_REPORT;
  std::ifstream s( filename );
  if(!s){
    ERROR_REPORT;
    std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl;
    exit(1);
  }
  
  std::string id;
  s >> id;
  if( id != "zgematrix" && id != "#zgematrix" ){
    ERROR_REPORT;
    std::cerr << "The type name of the file \"" << filename << "\" is not zgematrix." << std::endl
              << "Its type name was " << id << " ." << std::endl;
    exit(1);
  }
  
  long _m, _n;
  s >> _m >> _n;
  if(m!=_m || n!=_n){
    ERROR_REPORT;
    std::cerr << "Matrix size is invalid." << std::endl;
    exit(1);
  }
  for(long i=0; i<m; i++){
    for(long j=0; j<n; j++ ){
      s >> operator()(i,j);
    }
  }
  if(s.eof()){
    ERROR_REPORT;
    std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
              << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl;
    exit(1);
  }
  
  s >> id;
  if(!s.eof()){
    ERROR_REPORT;
    std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
              << "Most likely, there are extra data components." << std::endl;
    exit(1);
  }
  
  s.close();    
}
template<long m, long n>
void zgematrix_small< m, n >::write ( const char *  filename) const [inline]

Definition at line 62 of file zgematrix_small-functions.hpp.

References i().

{VERBOSE_REPORT;
  std::ofstream ofs(filename, std::ios::trunc);
  ofs.setf(std::cout.flags());
  ofs.precision(std::cout.precision());
  ofs.width(std::cout.width());
  ofs.fill(std::cout.fill());
  ofs << "#zgematrix" << " " << m << " " << n << std::endl;
  for(long i=0; i<m; i++){
    for(long j=0; j<n; j++){
      ofs << (*this)(i,j) << " ";
    }
    ofs << std::endl;
  }
  ofs.close();
}
template<long m, long n>
zgematrix_small< m, n > & zgematrix_small< m, n >::zero ( ) [inline]

Definition at line 158 of file zgematrix_small-functions.hpp.

{VERBOSE_REPORT;
  for(long k=0; k<m*n; k++){
    array[k] =comple(0.,0.);
  }
  return *this;
}
template<long m, long n>
zgematrix_small< m, n > & zgematrix_small< m, n >::identity ( ) [inline]

Definition at line 169 of file zgematrix_small-functions.hpp.

{VERBOSE_REPORT;
  zero();
  for(long k=0; k<std::min(m,n); k++){
    (*this)(k,k) =1.;
  }
  return *this;
}
template<long m, long n>
zcovector_small< m > zgematrix_small< m, n >::col ( const long &  j) const [inline]

Definition at line 181 of file zgematrix_small-functions.hpp.

References i().

{VERBOSE_REPORT;
  zcovector_small<m> vec;
  for(long i=0; i<m; i++){
    vec(i) =(*this)(i,j);
  }
  return vec;
}
template<long m, long n>
zrovector_small< n > zgematrix_small< m, n >::row ( const long &  i) const [inline]

Definition at line 193 of file zgematrix_small-functions.hpp.

References i().

{VERBOSE_REPORT;
  zrovector_small<n> vec;
  for(long j=0; j<n; j++){
    vec(j)=(*this)(i,j);
  }
  return vec;
}
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N>& zgematrix_small< m, n >::operator= ( const zgematrix_small< M, N > &  ) [inline]

Friends And Related Function Documentation

template<long m, long n>
template<long _m, long _n>
std::ostream& operator<< ( std::ostream &  ,
const zgematrix_small< _m, _n > &   
) [friend]
template<long m, long n>
template<long _m, long _n>
zgematrix_small<n,m> t ( const zgematrix_small< m, n > &  A) [friend]

Definition at line 140 of file zgematrix_small-functions.hpp.

{VERBOSE_REPORT;
  zgematrix_small<n,m> X;
  for(long i=0; i<m; i++){
    for(long j=0; j<n; j++){
      X(j,i) =A(i,j);
    }
  }
  return X;
}
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N>& operator+= ( zgematrix_small< M, N > &  ,
const zgematrix_small< M, N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N>& operator-= ( zgematrix_small< M, N > &  ,
const zgematrix_small< M, N > &   
) [friend]
template<long m, long n>
template<long M, long L, long N>
zgematrix_small<M,N>& operator*= ( zgematrix_small< M, L > &  ,
const zgematrix_small< L, N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N>& operator*= ( zgematrix_small< M, N > &  ,
const comple &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N>& operator/= ( zgematrix_small< M, N > &  ,
const comple &   
) [friend]
template<long m, long n>
template<long M, long N>
const zgematrix_small<M,N>& operator+ ( const zgematrix_small< M, N > &  ) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator- ( const zgematrix_small< M, N > &  ) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator+ ( const zgematrix_small< M, N > &  ,
const zgematrix_small< M, N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator+ ( const zgematrix_small< M, N > &  ,
const zhematrix_small< N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator- ( const zgematrix_small< M, N > &  ,
const zgematrix_small< M, N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator- ( const zgematrix_small< M, N > &  ,
const zhematrix_small< N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zcovector_small< M > operator* ( const zgematrix_small< M, N > &  ,
const zcovector_small< N > &   
) [friend]
template<long m, long n>
template<long M, long L, long N>
zgematrix_small<M,N> operator* ( const zgematrix_small< M, L > &  ,
const zgematrix_small< L, N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator* ( const zgematrix_small< M, N > &  ,
const zhematrix_small< N > &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator* ( const zgematrix_small< M, N > &  ,
const comple &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator/ ( const zgematrix_small< M, N > &  ,
const comple &   
) [friend]
template<long m, long n>
template<long M, long N>
zgematrix_small<M,N> operator* ( const comple &  ,
const zgematrix_small< M, N > &   
) [friend]

Member Data Documentation

template<long m, long n>
comple zgematrix_small< m, n >::array[m *n]

Definition at line 9 of file zgematrix_small.hpp.

Referenced by operator*=(), operator+=(), operator-=(), and operator/=().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Friends