CPPLapack
|
Real Double-precision General Band Matrix Class. More...
#include <dgbmatrix.hpp>
Real Double-precision General Band Matrix Class.
Definition at line 3 of file dgbmatrix.hpp.
dgbmatrix::dgbmatrix | ( | ) | [inline] |
dgbmatrix::dgbmatrix | ( | const dgbmatrix & | mat | ) | [inline] |
dgbmatrix copy constructor
Definition at line 16 of file dgbmatrix-constructor.hpp.
dgbmatrix::dgbmatrix | ( | const _dgbmatrix & | mat | ) | [inline] |
dgbmatrix constructor to cast _dgbmatrix
Definition at line 33 of file dgbmatrix-constructor.hpp.
References array, _dgbmatrix::array, darray, _dgbmatrix::darray, kl, _dgbmatrix::kl, _dgbmatrix::ku, ku, m, _dgbmatrix::m, _dgbmatrix::n, n, and _dgbmatrix::nullify().
dgbmatrix::dgbmatrix | ( | const long & | _m, |
const long & | _n, | ||
const long & | _kl, | ||
const long & | _ku | ||
) | [inline] |
dgbmatrix constructor with size specification
Definition at line 47 of file dgbmatrix-constructor.hpp.
References array, darray, i, kl, ku, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){ ERROR_REPORT; std::cerr << "It is impossible to make a matrix you ordered. " << std::endl << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //////// initialize //////// m =_m; n =_n; kl =_kl; ku =_ku; array =new double[(kl+ku+1)*n]; darray =new double*[n]; for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; } }
dgbmatrix::dgbmatrix | ( | const char * | filename | ) | [inline] |
dgbmatrix::~dgbmatrix | ( | ) | [inline] |
_zgbmatrix dgbmatrix::to_zgbmatrix | ( | ) | const [inline] |
_dgematrix dgbmatrix::to_dgematrix | ( | ) | const [inline] |
convert to _dgematrix
Definition at line 19 of file dgbmatrix-cast.hpp.
double & dgbmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
operator() for non-const object
Definition at line 3 of file dgbmatrix-io.hpp.
References darray, i, kl, ku, and m.
Referenced by dgbsv(), identity(), operator*=(), operator+=(), operator-=(), read(), and write().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ ERROR_REPORT; std::cerr << "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[ku+i+(kl+ku)*j]; return darray[j][ku-j+i]; }
double dgbmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
operator() for const object
Definition at line 20 of file dgbmatrix-io.hpp.
References darray, i, kl, ku, and m.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ ERROR_REPORT; std::cerr << "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[ku+i+(kl+ku)*j]; return darray[j][ku-j+i]; }
dgbmatrix & dgbmatrix::set | ( | const long & | i, |
const long & | j, | ||
const double & | v | ||
) | [inline] |
set value for const object
Definition at line 41 of file dgbmatrix-io.hpp.
References darray, i, kl, ku, and m.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ ERROR_REPORT; std::cerr << "The required component is out of the matrix size." << std::endl << "Your input was (" << i << "," << j << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //array[ku+i+(kl+ku)*j] =v; darray[j][ku-j+i] =v; return *this; }
void dgbmatrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 80 of file dgbmatrix-io.hpp.
References i, kl, ku, m, n, and operator()().
{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 << "#dgbmatrix" << " " << m << " " << n << " " << kl << " " << ku << std::endl; for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){ ofs << operator()(i,j) << " "; } ofs << std::endl; } ofs.close(); }
void dgbmatrix::read | ( | const char * | filename | ) | [inline] |
Definition at line 100 of file dgbmatrix-io.hpp.
References i, kl, ku, m, n, operator()(), and resize().
Referenced by dgbmatrix().
{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 != "dgbmatrix" && id != "#dgbmatrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not dgbmatrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } s >> m >> n >> kl >> ku; resize(m, n, kl, ku); for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); 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(); }
void dgbmatrix::clear | ( | ) | [inline] |
dgbmatrix & dgbmatrix::zero | ( | ) | [inline] |
change the matrix into a zero matrix
Definition at line 18 of file dgbmatrix-misc.hpp.
References array, i, kl, ku, and n.
Referenced by col(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), row(), and to_dgematrix().
dgbmatrix & dgbmatrix::identity | ( | ) | [inline] |
change the matrix into an identity matrix
Definition at line 26 of file dgbmatrix-misc.hpp.
References array, i, kl, ku, m, n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n){ ERROR_REPORT; std::cerr << "Only square matrix can be a identity matrix." << std::endl << "The matrix size was " << m << "x" << n << "." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<(kl+ku+1)*n; i++){ array[i] =0.0; } for(long i=0; i<m; i++){ operator()(i,i) =1.0; } return *this; }
void dgbmatrix::chsign | ( | ) | [inline] |
void dgbmatrix::copy | ( | const dgbmatrix & | mat | ) | [inline] |
make a deep copy of the matrix
Definition at line 50 of file dgbmatrix-misc.hpp.
References array, darray, i, kl, ku, m, and n.
Referenced by operator=().
void dgbmatrix::shallow_copy | ( | const _dgbmatrix & | mat | ) | [inline] |
make a shallow copy of the matrix
This function is not designed to be used in project codes.
Definition at line 68 of file dgbmatrix-misc.hpp.
References array, _dgbmatrix::array, darray, _dgbmatrix::darray, kl, _dgbmatrix::kl, _dgbmatrix::ku, ku, m, _dgbmatrix::m, _dgbmatrix::n, n, and _dgbmatrix::nullify().
Referenced by operator=().
dgbmatrix & dgbmatrix::resize | ( | const long & | _m, |
const long & | _n, | ||
const long & | _kl, | ||
const long & | _ku | ||
) | [inline] |
resize the matrix
Definition at line 84 of file dgbmatrix-misc.hpp.
References array, darray, i, kl, ku, m, and n.
Referenced by dgematrix::dgesvd(), and read().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){ ERROR_REPORT; std::cerr << "It is impossible to make a matrix you ordered. " << std::endl << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG m =_m; n =_n; kl =_kl; ku =_ku; delete [] array; array =new double[(kl+ku+1)*n]; delete [] darray; darray =new double*[n]; for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; } return *this; }
_drovector dgbmatrix::row | ( | const long & | _m | ) | const [inline] |
get row of the matrix
Definition at line 115 of file dgbmatrix-misc.hpp.
References _, kl, ku, m, n, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _m>m ){ ERROR_REPORT; std::cerr << "Input row number must be between 0 and " << m << "." << std::endl << "Your input was " << _m << "." << std::endl; exit(1); } #endif//CPPL_DEBUG drovector v( drovector(n).zero() ); for(long j=std::max(long(0),_m-kl); j<std::min(n,_m+ku+1); j++){ v(j)=(*this)(_m,j); } return _(v); }
_dcovector dgbmatrix::col | ( | const long & | _n | ) | const [inline] |
get column of the matrix
Definition at line 133 of file dgbmatrix-misc.hpp.
References _, i, kl, ku, m, n, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _n<0 || _n>n ){ ERROR_REPORT; std::cerr << "Input row number must be between 0 and " << n << "." << std::endl << "Your input was " << _n << "." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector v( dcovector(m).zero() ); for(long i=std::max(long(0),_n-ku); i<std::min(m,_n+kl+1); i++){ v(i)=(*this)(i,_n); } return _(v); }
long dgbmatrix::dgbsv | ( | dgematrix & | mat | ) | [inline] |
solve A*X=Y using dgbsv
The argument is dgematrix Y. Y is overwritten and become the solution X. A is also overwritten.
Definition at line 5 of file dgbmatrix-lapack.hpp.
References dgematrix::array, array, i, kl, ku, m, dgematrix::m, n, dgematrix::n, operator()(), and swap.
Referenced by i().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n || n!=mat.m){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat(m,n,kl,ku+kl); for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){ newmat(i,j) =operator()(i,j); }} long NRHS(mat.n), LDAB(2*kl+ku+1), *IPIV(new long[n]), LDB(mat.m), INFO(1); dgbsv_(n, kl, ku, NRHS, newmat.array, LDAB, IPIV, mat.array, LDB, INFO); delete [] IPIV; swap(*this,newmat); if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long dgbmatrix::dgbsv | ( | dcovector & | vec | ) | [inline] |
solve A*x=y using dgbsv
The argument is dcovector y. y is overwritten and become the solution x. A is also overwritten.
Definition at line 39 of file dgbmatrix-lapack.hpp.
References dcovector::array, array, i, kl, ku, dcovector::l, m, n, operator()(), and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n || n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat(m,n,kl,ku+kl); for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){ newmat(i,j) =operator()(i,j); }} long NRHS(1), LDAB(2*kl+ku+1), *IPIV(new long[n]), LDB(vec.l), INFO(1); dgbsv_(n, kl, ku, NRHS, newmat.array, LDAB, IPIV, vec.array, LDB, INFO); delete [] IPIV; swap(*this,newmat); if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
dgbmatrix & dgbmatrix::operator= | ( | const _dgbmatrix & | mat | ) | [inline] |
dgbmatrix=_dgbmatrix operator
Definition at line 3 of file dgbmatrix-_dgbmatrix.hpp.
References shallow_copy().
{VERBOSE_REPORT; shallow_copy(mat); return *this; }
dgbmatrix+=dgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.
Definition at line 19 of file dgbmatrix-dgbmatrix.hpp.
References i, kl, ku, m, n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; exit(1); } #endif//CPPL_DEBUG if(kl>=mat.kl && ku>=mat.ku){ for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)+=mat(i,j); } } return *this; } else{ dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); newmat.zero(); for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){ newmat(i,j)+=operator()(i,j); } for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){ newmat(i,j)+=mat(i,j); } } swap(*this,newmat); return *this; } }
dgbmatrix & dgbmatrix::operator+= | ( | const _dgbmatrix & | mat | ) | [inline] |
dgbmatrix+=_dgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.
Definition at line 16 of file dgbmatrix-_dgbmatrix.hpp.
References _dgbmatrix::destroy(), i, kl, _dgbmatrix::kl, _dgbmatrix::ku, ku, m, _dgbmatrix::m, _dgbmatrix::n, n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; exit(1); } #endif//CPPL_DEBUG if(kl>=mat.kl && ku>=mat.ku){ for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)+=mat(i,j); } } mat.destroy(); return *this; } else{ dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); newmat.zero(); for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){ newmat(i,j)+=operator()(i,j); } for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){ newmat(i,j)+=mat(i,j); } } swap(*this,newmat); mat.destroy(); return *this; } }
dgbmatrix-=dgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.
Definition at line 60 of file dgbmatrix-dgbmatrix.hpp.
References i, kl, ku, m, n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; exit(1); } #endif//CPPL_DEBUG if(kl>=mat.kl && ku>=mat.ku){ for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)-=mat(i,j); } } return *this; } else{ dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); newmat.zero(); for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){ newmat(i,j)+=operator()(i,j); } for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){ newmat(i,j)-=mat(i,j); } } swap(*this,newmat); return *this; } }
dgbmatrix & dgbmatrix::operator-= | ( | const _dgbmatrix & | mat | ) | [inline] |
dgbmatrix-=_dgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.
Definition at line 58 of file dgbmatrix-_dgbmatrix.hpp.
References _dgbmatrix::destroy(), i, kl, _dgbmatrix::kl, _dgbmatrix::ku, ku, m, _dgbmatrix::m, _dgbmatrix::n, n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; exit(1); } #endif//CPPL_DEBUG if(kl>=mat.kl && ku>=mat.ku){ for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)-=mat(i,j); } } mat.destroy(); return *this; } else{ dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); newmat.zero(); for(long i=0; i<m; i++){ for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){ newmat(i,j)+=operator()(i,j); } for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){ newmat(i,j)-=mat(i,j); } } swap(*this,newmat); mat.destroy(); return *this; } }
dgbmatrix*=dgbmatrix operator
Definition at line 100 of file dgbmatrix-dgbmatrix.hpp.
References i, kl, ku, m, n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){ for(long k=std::max( std::max(long(0),i-kl), std::max(long(0),j-mat.ku) ); k< std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); k++){ newmat(i,j)+= operator()(i,k)*mat(k,j); } } } swap(*this,newmat); return *this; }
dgbmatrix & dgbmatrix::operator*= | ( | const _dgbmatrix & | mat | ) | [inline] |
dgbmatrix*=_dgbmatrix operator
Definition at line 99 of file dgbmatrix-_dgbmatrix.hpp.
References _dgbmatrix::destroy(), i, kl, _dgbmatrix::kl, _dgbmatrix::ku, ku, _dgbmatrix::m, m, _dgbmatrix::n, n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){ for(long k=std::max( std::max(long(0),i-kl), std::max(long(0),j-mat.ku) ); k< std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); k++){ newmat(i,j)+= operator()(i,k)*mat(k,j); } } } swap(*this,newmat); mat.destroy(); return *this; }
dgbmatrix & dgbmatrix::operator*= | ( | const double & | d | ) | [inline] |
dgbmatrix & dgbmatrix::operator/= | ( | const double & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const dgbmatrix & | mat | ||
) | [friend] |
swap two matrices
Definition at line 155 of file dgbmatrix-misc.hpp.
Referenced by dgbsv(), operator*=(), operator+=(), and operator-=().
_dgbmatrix _ | ( | dgbmatrix & | mat | ) | [friend] |
convert user object to smart-temporary object
Definition at line 166 of file dgbmatrix-misc.hpp.
Referenced by col(), row(), to_dgematrix(), and to_zgbmatrix().
{VERBOSE_REPORT; _dgbmatrix newmat; //////// shallow copy //////// newmat.m =mat.m; newmat.n =mat.n; newmat.kl =mat.kl; newmat.ku =mat.ku; newmat.array =mat.array; newmat.darray =mat.darray; //////// nullify //////// mat.m =0; mat.n =0; mat.kl =0; mat.ku =0; mat.array =NULL; mat.darray =NULL; return newmat; }
_dgbmatrix t | ( | const dgbmatrix & | mat | ) | [friend] |
return transposed dgbmatrix
Definition at line 3 of file dgbmatrix-calc.hpp.
_dgematrix i | ( | const dgbmatrix & | mat | ) | [friend] |
return its inverse matrix
Definition at line 17 of file dgbmatrix-calc.hpp.
Referenced by chsign(), col(), copy(), dgbmatrix(), dgbsv(), identity(), operator()(), operator*=(), operator+=(), operator-=(), read(), resize(), set(), to_dgematrix(), to_zgbmatrix(), write(), and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.m!=mat.n){ ERROR_REPORT; std::cerr << "This matrix is not square and has no inverse matrix." << std::endl << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix mat_cp(mat); dgematrix mat_inv(mat.m,mat.n); mat_inv.identity(); mat_cp.dgbsv(mat_inv); return _(mat_inv); }
+dgbmatrix operator
Definition at line 3 of file dgbmatrix-unary.hpp.
{VERBOSE_REPORT;
return mat;
}
_dgbmatrix operator- | ( | const dgbmatrix & | mat | ) | [friend] |
_dgematrix operator+ | ( | const dgbmatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dgbmatrix+dgematrix operator
Definition at line 3 of file dgbmatrix-dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matB); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } } return _(newmat); }
_dgematrix operator+ | ( | const dgbmatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
dgbmatrix+_dgematrix operator
Definition at line 3 of file dgbmatrix-_dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ matB(i,j)+=matA(i,j); } } return matB; }
_dgematrix operator+ | ( | const dgbmatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dgbmatrix+dsymatrix operator
Definition at line 3 of file dgbmatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matB.n,matB.n); for(long i=0; i<matA.m; i++){ for(long j=0; j<matB.n; j++){ newmat(i,j) = matB(i,j); } for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } } return _(newmat); }
_dgematrix operator+ | ( | const dgbmatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dgbmatrix+_dsymatrix operator
Definition at line 3 of file dgbmatrix-_dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matB.n,matB.n); for(long i=0; i<matA.m; i++){ for(long j=0; j<matB.n; j++){ newmat(i,j) = matB(i,j); } for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } } matB.destroy(); return _(newmat); }
_dgbmatrix operator+ | ( | const dgbmatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dgbmatrix+dgbmatrix operator
Definition at line 133 of file dgbmatrix-dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); newmat.zero(); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)+=matB(i,j); } } return _(newmat); }
_dgbmatrix operator+ | ( | const dgbmatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dgbmatrix+_dgbmatrix operator
Definition at line 133 of file dgbmatrix-_dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if(matB.kl>matA.kl && matB.ku>matA.ku){ for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ matB(i,j)+=matA(i,j); } } return matB; } else{ dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); newmat.zero(); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)+=matB(i,j); } } matB.destroy(); return _(newmat); } }
_dgematrix operator+ | ( | const dgbmatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dgbmatrix+dgsmatrix operator
Definition at line 3 of file dgbmatrix-dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matB.to_dgematrix() ); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } } return _(newmat); }
_dgematrix operator+ | ( | const dgbmatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dgbmatrix+_dgsmatrix operator
Definition at line 3 of file dgbmatrix-_dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matB.to_dgematrix() ); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } } matB.destroy(); return _(newmat); }
_dgematrix operator+ | ( | const dgbmatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dgematrix operator+ | ( | const dgbmatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dgbmatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dgbmatrix-dgematrix operator
Definition at line 26 of file dgbmatrix-dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(-matB); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } } return _(newmat); }
_dgematrix operator- | ( | const dgbmatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
dgbmatrix-_dgematrix operator
Definition at line 25 of file dgbmatrix-_dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //// change sign //// for(long i=0; i<matB.m*matB.n; i++){ matB.array[i]=-matB.array[i]; } //// add //// for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ matB(i,j) +=matA(i,j); } } return matB; }
_dgematrix operator- | ( | const dgbmatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dgbmatrix-dsymatrix operator
Definition at line 29 of file dgbmatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matB.n,matB.n); for(long i=0; i<matA.m; i++){ for(long j=0; j<matB.n; j++){ newmat(i,j) = -matB(i,j); } for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j) += matA(i,j); } } return _(newmat); }
_dgematrix operator- | ( | const dgbmatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dgbmatrix-_dsymatrix operator
Definition at line 30 of file dgbmatrix-_dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matB.n,matB.n); for(long i=0; i<matA.m; i++){ for(long j=0; j<matB.n; j++){ newmat(i,j) = -matB(i,j); } for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j) += matA(i,j); } } matB.destroy(); return _(newmat); }
_dgbmatrix operator- | ( | const dgbmatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dgbmatrix-dgbmatrix operator
Definition at line 161 of file dgbmatrix-dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); newmat.zero(); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)-=matB(i,j); } } return _(newmat); }
_dgbmatrix operator- | ( | const dgbmatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dgbmatrix-_dgbmatrix operator
Definition at line 173 of file dgbmatrix-_dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); newmat.zero(); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)+=matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)-=matB(i,j); } } matB.destroy(); return _(newmat); }
_dgematrix operator- | ( | const dgbmatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dgbmatrix-dgsmatrix operator
Definition at line 27 of file dgbmatrix-dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( -matB.to_dgematrix() ); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)-=matA(i,j); } } return _(newmat); }
_dgematrix operator- | ( | const dgbmatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dgbmatrix-_dgsmatrix operator
Definition at line 27 of file dgbmatrix-_dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( (-matB).to_dgematrix() ); for(long i=0; i<matA.m; i++){ for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){ newmat(i,j)-=matA(i,j); } } matB.destroy(); return _(newmat); }
_dgematrix operator- | ( | const dgbmatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dgbmatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dcovector operator* | ( | const dgbmatrix & | mat, |
const dcovector & | vec | ||
) | [friend] |
dgbmatrix*dcovector operator
Definition at line 3 of file dgbmatrix-dcovector.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector can not make a product." << std::endl << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(mat.m); dgbmv_( 'n', mat.m, mat.n, mat.kl, mat.ku, 1.0, mat.array, mat.kl+mat.ku+1, vec.array, 1, 0.0, newvec.array, 1 ); return _(newvec); }
_dcovector operator* | ( | const dgbmatrix & | mat, |
const _dcovector & | vec | ||
) | [friend] |
dgbmatrix*_dcovector operator
Definition at line 3 of file dgbmatrix-_dcovector.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector can not make a product." << std::endl << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(mat.m); dgbmv_( 'n', mat.m, mat.n, mat.kl, mat.ku, 1.0, mat.array, mat.kl+mat.ku+1, vec.array, 1, 0.0, newvec.array, 1 ); vec.destroy(); return _(newvec); }
_dgematrix operator* | ( | const dgbmatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dgbmatrix*dgematrix operator
Definition at line 49 of file dgbmatrix-dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=0; j<newmat.n; j++){ for(long k=std::max(long(0),i-matA.kl); k<std::min(matA.n,i+matA.ku+1); k++){ newmat(i,j)+=matA(i,k)*matB(k,j); } } } return _(newmat); }
_dgematrix operator* | ( | const dgbmatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
dgbmatrix*_dgematrix operator
Definition at line 53 of file dgbmatrix-_dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=0; j<newmat.n; j++){ for(long k=std::max(long(0),i-matA.kl); k<std::min(matA.n,i+matA.ku+1); k++){ newmat(i,j)+=matA(i,k)*matB(k,j); } } } matB.destroy(); return _(newmat); }
_dgematrix operator* | ( | const dgbmatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dgbmatrix*dsymatrix operator
Definition at line 55 of file dgbmatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=0; j<newmat.n; j++){ for(long k=std::max(long(0),i-matA.kl); k<std::min(matA.n,i+matA.ku+1); k++){ newmat(i,j)+=matA(i,k)*matB(k,j); } } } return _(newmat); }
_dgematrix operator* | ( | const dgbmatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dgbmatrix*_dsymatrix operator
Definition at line 57 of file dgbmatrix-_dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=0; j<newmat.n; j++){ for(long k=std::max(long(0),i-matA.kl); k<std::min(matA.n,i+matA.ku+1); k++){ newmat(i,j)+=matA(i,k)*matB(k,j); } } } matB.destroy(); return _(newmat); }
_dgbmatrix operator* | ( | const dgbmatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dgbmatrix*dgbmatrix operator
Definition at line 189 of file dgbmatrix-dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){ for(long k=std::max( std::max(long(0),i-matA.kl), std::max(long(0),j-matB.ku) ); k< std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); k++){ newmat(i,j)+= matA(i,k)*matB(k,j); } } } return _(newmat); }
_dgbmatrix operator* | ( | const dgbmatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dgbmatrix*_dgbmatrix operator
Definition at line 202 of file dgbmatrix-_dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){ for(long k=std::max( std::max(long(0),i-matA.kl), std::max(long(0),j-matB.ku) ); k< std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); k++){ newmat(i,j)+= matA(i,k)*matB(k,j); } } } matB.destroy(); return _(newmat); }
_dgematrix operator* | ( | const dgbmatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dgbmatrix*dgsmatrix operator
Definition at line 51 of file dgbmatrix-dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ for(long i=std::max(long(0),long(it->i)-(matA.ku+1)); i<std::min(matA.m,long(it->i)+matA.kl); i++){ newmat(i,it->j) += matA(i,it->i)*it->v; } } return _(newmat); }
_dgematrix operator* | ( | const dgbmatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dgbmatrix*_dgsmatrix operator
Definition at line 51 of file dgbmatrix-_dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ for(long i=std::max(long(0),long(it->i)-(matA.ku+1)); i<std::min(matA.m,long(it->i)+matA.kl); i++){ newmat(i,it->j) += matA(i,it->i)*it->v; } } matB.destroy(); return _(newmat); }
_dgematrix operator* | ( | const dgbmatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dgematrix operator* | ( | const dgbmatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dgbmatrix operator* | ( | const dgbmatrix & | mat, |
const double & | d | ||
) | [friend] |
_dgbmatrix operator/ | ( | const dgbmatrix & | mat, |
const double & | d | ||
) | [friend] |
_dgbmatrix operator* | ( | const double & | d, |
const dgbmatrix & | mat | ||
) | [friend] |
long dgbmatrix::m |
matrix row size
Definition at line 9 of file dgbmatrix.hpp.
Referenced by _(), clear(), col(), copy(), dgbmatrix(), dgbsv(), i(), identity(), operator()(), operator*(), operator*=(), dgematrix::operator*=(), operator+(), operator+=(), dgematrix::operator+=(), operator-(), operator-=(), dgematrix::operator-=(), operator/(), operator<<(), read(), resize(), row(), set(), shallow_copy(), swap(), t(), to_dgematrix(), to_zgbmatrix(), and write().
long dgbmatrix::n |
matrix column size
Definition at line 10 of file dgbmatrix.hpp.
Referenced by _(), chsign(), clear(), col(), copy(), dgbmatrix(), dgbsv(), i(), identity(), operator*(), operator*=(), dgematrix::operator*=(), operator+(), operator+=(), dgematrix::operator+=(), operator-(), operator-=(), dgematrix::operator-=(), operator/(), operator/=(), operator<<(), read(), resize(), row(), shallow_copy(), swap(), t(), to_dgematrix(), to_zgbmatrix(), write(), and zero().
long dgbmatrix::kl |
lower band width
Definition at line 11 of file dgbmatrix.hpp.
Referenced by _(), chsign(), clear(), col(), copy(), dgbmatrix(), dgbsv(), identity(), operator()(), operator*(), operator*=(), dgematrix::operator*=(), operator+(), operator+=(), dgematrix::operator+=(), operator-(), operator-=(), dgematrix::operator-=(), operator/(), operator/=(), operator<<(), read(), resize(), row(), set(), shallow_copy(), swap(), t(), to_dgematrix(), to_zgbmatrix(), write(), and zero().
long dgbmatrix::ku |
upper band width
Definition at line 12 of file dgbmatrix.hpp.
Referenced by _(), chsign(), clear(), col(), copy(), dgbmatrix(), dgbsv(), identity(), operator()(), operator*(), operator*=(), dgematrix::operator*=(), operator+(), operator+=(), dgematrix::operator+=(), operator-(), operator-=(), dgematrix::operator-=(), operator/(), operator/=(), operator<<(), read(), resize(), row(), set(), shallow_copy(), swap(), t(), to_dgematrix(), to_zgbmatrix(), write(), and zero().
double* dgbmatrix::array |
1D array to store matrix data
Definition at line 13 of file dgbmatrix.hpp.
Referenced by _(), chsign(), clear(), copy(), dgbmatrix(), dgbsv(), dgematrix::dgesvd(), identity(), operator*(), operator*=(), operator-(), operator/(), operator/=(), operator=(), resize(), shallow_copy(), swap(), to_zgbmatrix(), zero(), and ~dgbmatrix().
double** dgbmatrix::darray |
array of pointers of column head addresses
Definition at line 14 of file dgbmatrix.hpp.
Referenced by _(), clear(), copy(), dgbmatrix(), operator()(), resize(), set(), shallow_copy(), swap(), and ~dgbmatrix().