Main Page | Class List | File List | Class Members | File Members | Related Pages

_dgematrix Class Reference

Smart-Temporary double-precision general matrix class (DO NOT USE). More...

#include <_dgematrix.hpp>

List of all members.

Public Member Functions

 _dgematrix ()
 _dgematrix (const _dgematrix &)
 _dgematrix (const dgematrix &)
 _dgematrix (const long &, const long &)
 ~_dgematrix ()
CPPSL_double operator() (const long &, const long &) const
void destroy () const
void absorb (dgematrix &) const
void zero () const
void identity () const

Public Attributes

long M
 global matrix row size

long N
 global matrix column size

long Ml
 local matrix row size

long Nl
 local matrix column size

long Desc [9]
 matrix description

double * Array
 1D array to store matrix data


Friends

class dgematrix
class dcovector
class _dcovector
class drovector
class _drovector
std::ostream & operator<< (std::ostream &, const dgematrix &)
_dgematrix t (const _dgematrix &)
const _dgematrixoperator+ (const _dgematrix &)
_dgematrix operator- (const _dgematrix &)
_dgematrix operator+ (const dgematrix &, const dgematrix &)
_dgematrix operator+ (const dgematrix &, const _dgematrix &)
_dgematrix operator+ (const _dgematrix &, const dgematrix &)
_dgematrix operator+ (const _dgematrix &, const _dgematrix &)
_dgematrix operator- (const dgematrix &)
_dgematrix operator- (const dgematrix &, const dgematrix &)
_dgematrix operator- (const dgematrix &, const _dgematrix &)
_dgematrix operator- (const _dgematrix &, const dgematrix &)
_dgematrix operator- (const _dgematrix &, const _dgematrix &)
_dgematrix operator * (const dgematrix &, const dgematrix &)
_dgematrix operator * (const dgematrix &, const _dgematrix &)
_dgematrix operator * (const _dgematrix &, const dgematrix &)
_dgematrix operator * (const _dgematrix &, const _dgematrix &)
_dgematrix operator * (const dgematrix &, const double &)
_dgematrix operator * (const _dgematrix &, const double &)
_dgematrix operator * (const double &, const _dgematrix &)
_dgematrix operator * (const double &, const dgematrix &)
_dgematrix operator * (const dcovector &, const drovector &)
_dgematrix operator * (const dcovector &, const _drovector &)
_dgematrix operator * (const _dcovector &, const drovector &)
_dgematrix operator * (const _dcovector &, const _drovector &)
_drovector operator * (const drovector &, const _dgematrix &)
_drovector operator * (const _drovector &, const _dgematrix &)
_dcovector operator * (const _dgematrix &, const dcovector &)
_dcovector operator * (const _dgematrix &, const _dcovector &)
_dgematrix operator/ (const dgematrix &, const double &)
_dgematrix operator/ (const _dgematrix &, const double &)


Detailed Description

Smart-Temporary double-precision general matrix class (DO NOT USE).

Definition at line 3 of file _dgematrix.hpp.


Constructor & Destructor Documentation

_dgematrix::_dgematrix  )  [inline]
 

_dgematrix constructor without arguments

Definition at line 3 of file _dgematrix-constructor.hpp.

References Array, Desc, M, Ml, N, and Nl.

00004 {
00005   //////// initialize ////////
00006   M =N =0;
00007   Ml =Nl =0;
00008   Desc[0]=1; Desc[1]=icontxt; Desc[2]=0; Desc[3]=0; Desc[4]=mb; Desc[5]=nb;
00009   Desc[6]=0; Desc[7]=0; Desc[8]=max(1,Ml);
00010   Array =new double[0];
00011   
00012 #ifdef  CPPSL_DEBUG
00013   std::cerr << "# [NOTE] _dgematrix::_dgematrix() "
00014             << "A new 0x0 matrix at " << Array
00015             << " has been made." << std::endl;
00016 #endif//CPPSL_DEBUG
00017 }

_dgematrix::_dgematrix const _dgematrix mat  )  [inline]
 

_dgematrix copy constructor

Definition at line 25 of file _dgematrix-constructor.hpp.

References Array, Desc, M, Ml, N, and Nl.

00026 {
00027   //////// initialize ////////
00028   M =mat.M; N =mat.N;
00029   Ml =mat.Ml; Nl =mat.Nl;
00030   for(int i=0; i<9; i++){ Desc[i] =mat.Desc[i]; }
00031   Array =mat.Array;
00032   
00033 #ifdef  CPPSL_DEBUG
00034   std::cerr << "# [NOTE] _dgematrix::_dgematrix(const _dgematrix&) "
00035             << "A new matrix at " << Array << " has been made." << std::endl;
00036 #endif//CPPSL_DEBUG
00037 }

_dgematrix::_dgematrix const dgematrix mat  )  [inline]
 

_dgematrix constructor to cast dgematrix

Definition at line 41 of file _dgematrix-constructor.hpp.

References dgematrix::Array, Array, dgematrix::Desc, Desc, dgematrix::M, M, dgematrix::Ml, Ml, dgematrix::N, N, dgematrix::Nl, and Nl.

00042 {
00043   M =mat.M; N =mat.N;
00044   Ml =mat.Ml; Nl =mat.Nl;
00045   for(int i=0; i<9; i++){ Desc[i] =mat.Desc[i]; }
00046   Array =mat.Array;
00047   
00048 #ifdef  CPPSL_DEBUG
00049   std::cerr << "# [NOTE] _dgematrix::_dgematrix(const dgematrix&) "
00050             << "A new matrix pointing at " << Array << " has been made."
00051             << std::endl;
00052 #endif//CPPSL_DEBUG
00053 }

_dgematrix::_dgematrix const long &  _m,
const long &  _n
[inline]
 

_dgematrix constructor with size specification

Definition at line 61 of file _dgematrix-constructor.hpp.

References Array, Desc, M, Ml, N, and Nl.

00062 {
00063 #ifdef  CPPSL_DEBUG
00064   if( _m<0 || _n<0 ){
00065     std::cerr << "[ERROR] _dgematrix::_dgematrix(const long, const long)"
00066               << std::endl
00067               << "Matrix sizes must be positive integers. " << std::endl
00068               << "Your input was (" << _m << "," << _n << ")." << std::endl;
00069     exit(1);
00070   }
00071 #endif//CPPSL_DEBUG
00072   
00073   //////// initialize ////////
00074   M =_m; N =_n;
00075   Ml =numroc_( M, mb, myrow, 0, nprow );
00076   Nl =numroc_( N, nb, mycol, 0, npcol );
00077   Desc[0]=1; Desc[1]=icontxt; Desc[2]=M; Desc[3]=N; Desc[4]=mb; Desc[5]=nb;
00078   Desc[6]=0; Desc[7]=0; Desc[8]=max(1,Ml);
00079   Array =new double[Ml*Nl];
00080   
00081 #ifdef  CPPSL_DEBUG
00082   std::cerr << "# [NOTE] _dgematrix(const long&, const long&) "
00083             << "A new matrix at " << Array << " has been made." << std::endl;
00084 #endif//CPPSL_DEBUG
00085 }

_dgematrix::~_dgematrix  )  [inline]
 

_dgematrix destructor

Definition at line 93 of file _dgematrix-constructor.hpp.

00094 {
00095 #ifdef  CPPSL_DEBUG
00096   std::cerr << "# [NOTE] _dgematrix::~_dgematrix() "
00097             << "A _dgematrix is going to be destructed." << std::endl;
00098 #endif//CPPSL_DEBUG
00099   //////// do nothing ////////
00100 }


Member Function Documentation

CPPSL_double _dgematrix::operator() const long &  i,
const long &  j
const [inline]
 

operator() for const object

Definition at line 3 of file _dgematrix-io.hpp.

References Array, Desc, M, and N.

Referenced by identity().

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( i<0 || j<0 || M<=i || N<=j ){
00007     std::cerr << "[ERROR] _dgematrix::operator()"
00008               << "(const long&, const long&) const" << std::endl
00009               << "The required component is out of the matrix size."
00010               << std::endl
00011               << "Your input was (" << i << "," << j << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   return CPPSL_double( Array, i, j, Desc );
00017 }

void _dgematrix::destroy  )  const [inline]
 

destroy all the matrix data

Definition at line 3 of file _dgematrix-misc.hpp.

References Array.

Referenced by operator *(), operator+(), dgematrix::operator+=(), operator-(), dgematrix::operator-=(), operator<<(), and t().

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   std::cerr << "# [NOTE] _dgematrix::destroy() "
00007             << " An array at " << Array
00008             << " is going to be destroyed." << std::endl;
00009 #endif//CPPSL_DEBUG
00010   
00011   delete [] Array;
00012 }

void _dgematrix::absorb dgematrix mat  )  const [inline]
 

shallow copy dgematrix into _dgematrix and set dgematrix an empty matrix

Definition at line 16 of file _dgematrix-misc.hpp.

References dgematrix::Array, Array, dgematrix::Desc, Desc, dgematrix::M, M, dgematrix::Ml, Ml, dgematrix::N, N, dgematrix::Nl, and Nl.

00017 {
00018   M =mat.M; N =mat.N;
00019   Ml =mat.Ml; Nl =mat.Nl;
00020   for(int i=0; i<9; i++){ Desc[i] =mat.Desc[i]; }
00021   
00022   delete [] Array;
00023   double* tmp_array;
00024   tmp_array = new double[0];
00025   
00026   Array =mat.Array;
00027   mat.Array =tmp_array;
00028 }

void _dgematrix::zero  )  const [inline]
 

change the matrix into a zero matrix

Definition at line 36 of file _dgematrix-misc.hpp.

References Array, Ml, and Nl.

00037 {
00038   for(long i=0; i<Ml*Nl; i++){ Array[i] =0.0; }
00039 }

void _dgematrix::identity  )  const [inline]
 

change the matrix into an identity matrix

Definition at line 43 of file _dgematrix-misc.hpp.

References Array, M, Ml, N, Nl, and operator()().

00044 {
00045 #ifdef  CPPSL_DEBUG
00046   if(M!=N){
00047     std::cerr << "[ERROR] _dgematrix::identity()" << std::endl
00048               << "Only square matrix can be a identity matrix." << std::endl
00049               << "The matrix size was " << M << "x" << N << "." << std::endl;
00050     exit(1);
00051   }
00052 #endif//CPPSL_DEBUG
00053   
00054   for(long i=0; i<Ml*Nl; i++){ Array[i] =0.0; }
00055   for(long i=0; i<M; i++){ operator()(i,i) =1.0; }
00056 }


Friends And Related Function Documentation

friend class dgematrix [friend]
 

Definition at line 113 of file _dgematrix.hpp.

friend class dcovector [friend]
 

Definition at line 116 of file _dgematrix.hpp.

friend class _dcovector [friend]
 

Definition at line 117 of file _dgematrix.hpp.

friend class drovector [friend]
 

Definition at line 118 of file _dgematrix.hpp.

friend class _drovector [friend]
 

Definition at line 119 of file _dgematrix.hpp.

std::ostream& operator<< std::ostream &  s,
const dgematrix mat
[friend]
 

Definition at line 67 of file dgematrix-io.hpp.

00068 {
00069   for(long i=0; i<mat.M; i++){
00070     for(long j=0; j<mat.N; j++){
00071       s << " " << mat(i,j);
00072     }
00073     s << std::endl;
00074   }
00075   return s;
00076 }

_dgematrix t const _dgematrix mat  )  [friend]
 

return transposed _dgematrix

Definition at line 3 of file _dgematrix-calc.hpp.

00004 {
00005   _dgematrix newmat(mat.N,mat.M);
00006   
00007   for(long i=0; i<newmat.M; i++){ for(long j=0; j<newmat.N; j++){
00008     newmat(i,j) =mat(j,i);
00009   }}
00010   
00011   mat.destroy();
00012   return newmat;
00013 }

const _dgematrix& operator+ const _dgematrix mat  )  [friend]
 

+_dgematrix operator

Definition at line 3 of file _dgematrix-unary.hpp.

00004 {
00005   return mat;
00006 }

_dgematrix operator- const _dgematrix mat  )  [friend]
 

-_dgematrix operator

Definition at line 10 of file _dgematrix-unary.hpp.

00011 {
00012   for(long i=0; i<mat.Ml*mat.Nl; i++){ mat.Array[i]=-mat.Array[i]; }
00013   
00014   return mat;
00015 }

_dgematrix operator+ const dgematrix matA,
const dgematrix matB
[friend]
 

dgematrix+dgematrix operator

Definition at line 84 of file dgematrix-dgematrix.hpp.

00085 {
00086 #ifdef  CPPSL_DEBUG
00087   if(matA.N!=matB.N || matA.M!=matB.M){
00088     std::cerr << "[ERROR] operator+(const dgematrix&, const dgematrix&)"
00089               << std::endl
00090               << "These two matrises can not make a summation." << std::endl
00091               << "Your input was (" << matA.M << "x" << matA.N << ") + ("
00092               << matB.M << "x" << matB.N << ")." << std::endl;
00093     exit(1);
00094   }
00095 #endif//CPPSL_DEBUG
00096 
00097   _dgematrix newmat(matA.M,matA.N);
00098   for(long i=0; i<newmat.Ml*newmat.Nl; i++){
00099     newmat.Array[i] =matA.Array[i]+matB.Array[i];
00100   }
00101   
00102   return newmat;
00103 }

_dgematrix operator+ const dgematrix matA,
const _dgematrix matB
[friend]
 

dgematrix+_dgematrix operator

Definition at line 86 of file dgematrix-_dgematrix.hpp.

00087 {
00088 #ifdef  CPPSL_DEBUG
00089   if(matA.N!=matB.N || matA.M!=matB.M){
00090     std::cerr << "[ERROR] operator+(const dgematrix&, const _dgematrix&)"
00091               << std::endl
00092               << "These two matrises can not make a summation." << std::endl
00093               << "Your input was (" << matA.M << "x" << matA.N << ") + ("
00094               << matB.M << "x" << matB.N << ")." << std::endl;
00095     exit(1);
00096   }
00097 #endif//CPPSL_DEBUG
00098 
00099   for(long i=0; i<matA.Ml*matA.Nl; i++){ matB.Array[i] +=matA.Array[i]; }
00100   
00101   return matB;
00102 }

_dgematrix operator+ const _dgematrix matA,
const dgematrix matB
[friend]
 

_dgematrix+dgematrix operator

Definition at line 3 of file _dgematrix-dgematrix.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(matA.N!=matB.N || matA.M!=matB.M){
00007     std::cerr << "[ERROR] operator+(const _dgematrix&, const dgematrix&)"
00008               << std::endl
00009               << "These two matrises can not make a summation." << std::endl
00010               << "Your input was (" << matA.M << "x" << matA.N << ") + ("
00011               << matB.M << "x" << matB.N << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015 
00016   for(long i=0; i<matA.Ml*matA.Nl; i++){ matA.Array[i] +=matB.Array[i]; }
00017   
00018   return matA;
00019 }

_dgematrix operator+ const _dgematrix matA,
const _dgematrix matB
[friend]
 

_dgematrix+_dgematrix operator

Definition at line 3 of file _dgematrix-_dgematrix.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(matA.N!=matB.N || matA.M!=matB.M){
00007     std::cerr << "[ERROR] operator+(const _dgematrix&, const _dgematrix&)"
00008               << std::endl
00009               << "These two matrises can not make a summation." << std::endl
00010               << "Your input was (" << matA.M << "x" << matA.N << ") + ("
00011               << matB.M << "x" << matB.N << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015 
00016   for(long i=0; i<matA.Ml*matA.Nl; i++){ matA.Array[i] +=matB.Array[i]; }
00017   
00018   matB.destroy();
00019   return matA;
00020 }

_dgematrix operator- const dgematrix mat  )  [friend]
 

-dgematrix operator

Definition at line 10 of file dgematrix-unary.hpp.

00011 {
00012   _dgematrix newmat(mat.M,mat.N);
00013   for(long i=0; i<newmat.Ml*newmat.Nl; i++){ newmat.Array[i]=-mat.Array[i]; }
00014   return newmat;
00015 }

_dgematrix operator- const dgematrix matA,
const dgematrix matB
[friend]
 

dgematrix-dgematrix operator

Definition at line 107 of file dgematrix-dgematrix.hpp.

00108 {
00109 #ifdef  CPPSL_DEBUG
00110   if(matA.N!=matB.N || matA.M!=matB.M){
00111     std::cerr << "[ERROR] operator-(const dgematrix&, const dgematrix&)"
00112               << std::endl
00113               << "These two matrises can not make a subtraction." << std::endl
00114               << "Your input was (" << matA.M << "x" << matA.N << ") - ("
00115               << matB.M << "x" << matB.N << ")." << std::endl;
00116     exit(1);
00117   }
00118 #endif//CPPSL_DEBUG
00119   
00120   _dgematrix newmat(matA.M,matA.N);
00121   for(long i=0; i<newmat.Ml*newmat.Nl; i++){
00122     newmat.Array[i] =matA.Array[i]-matB.Array[i];
00123   }
00124   
00125   return newmat;
00126 }

_dgematrix operator- const dgematrix matA,
const _dgematrix matB
[friend]
 

dgematrix-_dgematrix operator

Definition at line 106 of file dgematrix-_dgematrix.hpp.

00107 {
00108 #ifdef  CPPSL_DEBUG
00109   if(matA.N!=matB.N || matA.M!=matB.M){
00110     std::cerr << "[ERROR] operator-(const dgematrix&, const _dgematrix&)"
00111               << std::endl
00112               << "These two matrises can not make a subtraction." << std::endl
00113               << "Your input was (" << matA.M << "x" << matA.N << ") - ("
00114               << matB.M << "x" << matB.N << ")." << std::endl;
00115     exit(1);
00116   }
00117 #endif//CPPSL_DEBUG
00118   
00119   for(long i=0; i<matA.Ml*matA.Nl; i++){
00120     matB.Array[i] =matA.Array[i]-matB.Array[i];
00121   }
00122   
00123   return matB;
00124 }

_dgematrix operator- const _dgematrix matA,
const dgematrix matB
[friend]
 

_dgematrix-dgematrix operator

Definition at line 23 of file _dgematrix-dgematrix.hpp.

00024 {
00025 #ifdef  CPPSL_DEBUG
00026   if(matA.N!=matB.N || matA.M!=matB.M){
00027     std::cerr << "[ERROR] operator-(const _dgematrix&, const dgematrix&)"
00028               << std::endl
00029               << "These two matrises can not make a subtraction." << std::endl
00030               << "Your input was (" << matA.M << "x" << matA.N << ") - ("
00031               << matB.M << "x" << matB.N << ")." << std::endl;
00032     exit(1);
00033   }
00034 #endif//CPPSL_DEBUG
00035   
00036   for(long i=0; i<matA.Ml*matA.Nl; i++){ matA.Array[i] -=matB.Array[i]; }
00037   
00038   return matA;
00039 }

_dgematrix operator- const _dgematrix matA,
const _dgematrix matB
[friend]
 

_dgematrix-_dgematrix operator

Definition at line 24 of file _dgematrix-_dgematrix.hpp.

00025 {
00026 #ifdef  CPPSL_DEBUG
00027   if(matA.N!=matB.N || matA.M!=matB.M){
00028     std::cerr << "[ERROR] operator-(const _dgematrix&, const _dgematrix&)"
00029               << std::endl
00030               << "These two matrises can not make a subtraction." << std::endl
00031               << "Your input was (" << matA.M << "x" << matA.N << ") - ("
00032               << matB.M << "x" << matB.N << ")." << std::endl;
00033     exit(1);
00034   }
00035 #endif//CPPSL_DEBUG
00036   
00037   for(long i=0; i<matA.Ml*matA.Nl; i++){ matA.Array[i] -=matB.Array[i]; }
00038   
00039   matB.destroy();
00040   return matA;
00041 }

_dgematrix operator * const dgematrix matA,
const dgematrix matB
[friend]
 

dgematrix*dgematrix operator

Definition at line 130 of file dgematrix-dgematrix.hpp.

00131 {
00132 #ifdef  CPPSL_DEBUG
00133   if(matA.N!=matB.M){
00134     std::cerr << "[ERROR] operator*(const dgematrix&, const dgematrix&)"
00135               << std::endl
00136               << "These two matrises can not make a product." << std::endl
00137               << "Your input was (" << matA.M << "x" << matA.N << ") * ("
00138               << matB.M << "x" << matB.N << ")." << std::endl;
00139     exit(1);
00140   }
00141 #endif//CPPSL_DEBUG
00142   
00143   _dgematrix newmat( matA.M, matB.N );
00144   pdgemm_( 'N', 'N', matA.M, matB.N, matA.N, 1.0,
00145            matA.Array, 1, 1, matA.Desc,
00146            matB.Array, 1, 1, matB.Desc, 0.0,
00147            newmat.Array, 1, 1, newmat.Desc );
00148   
00149   return newmat;
00150 }

_dgematrix operator * const dgematrix matA,
const _dgematrix matB
[friend]
 

dgematrix*_dgematrix operator

Definition at line 128 of file dgematrix-_dgematrix.hpp.

00129 {
00130 #ifdef  CPPSL_DEBUG
00131   if(matA.N!=matB.M){
00132     std::cerr << "[ERROR] operator*(const dgematrix&, const _dgematrix&)"
00133               << std::endl
00134               << "These two matrises can not make a product." << std::endl
00135               << "Your input was (" << matA.M << "x" << matA.N << ") * ("
00136               << matB.M << "x" << matB.N << ")." << std::endl;
00137     exit(1);
00138   }
00139 #endif//CPPSL_DEBUG
00140   
00141   _dgematrix newmat( matA.M, matB.N );
00142   pdgemm_( 'N', 'N', matA.M, matB.N, matA.N, 1.0,
00143            matA.Array, 1, 1, matA.Desc,
00144            matB.Array, 1, 1, matB.Desc, 0.0,
00145            newmat.Array, 1, 1, newmat.Desc );
00146   
00147   matB.destroy();
00148   return newmat;
00149 }

_dgematrix operator * const _dgematrix matA,
const dgematrix matB
[friend]
 

_dgematrix*dgematrix operator

Definition at line 43 of file _dgematrix-dgematrix.hpp.

00044 {
00045 #ifdef  CPPSL_DEBUG
00046   if(matA.N!=matB.M){
00047     std::cerr << "[ERROR] operator*(const _dgematrix&, const dgematrix&)"
00048               << std::endl
00049               << "These two matrises can not make a product." << std::endl
00050               << "Your input was (" << matA.M << "x" << matA.N << ") * ("
00051               << matB.M << "x" << matB.N << ")." << std::endl;
00052     exit(1);
00053   }
00054 #endif//CPPSL_DEBUG
00055   
00056   _dgematrix newmat( matA.M, matB.N );
00057   pdgemm_( 'N', 'N', matA.M, matB.N, matA.N, 1.0,
00058            matA.Array, 1, 1, matA.Desc,
00059            matB.Array, 1, 1, matB.Desc, 0.0,
00060            newmat.Array, 1, 1, newmat.Desc );
00061   
00062   matA.destroy();
00063   return newmat;
00064 }

_dgematrix operator * const _dgematrix matA,
const _dgematrix matB
[friend]
 

_dgematrix*_dgematrix operator

Definition at line 45 of file _dgematrix-_dgematrix.hpp.

00046 {
00047 #ifdef  CPPSL_DEBUG
00048   if(matA.N!=matB.M){
00049     std::cerr << "[ERROR] operator*(const _dgematrix&, const _dgematrix&)"
00050               << std::endl
00051               << "These two matrises can not make a product." << std::endl
00052               << "Your input was (" << matA.M << "x" << matA.N << ") * ("
00053               << matB.M << "x" << matB.N << ")." << std::endl;
00054     exit(1);
00055   }
00056 #endif//CPPSL_DEBUG
00057   
00058   _dgematrix newmat( matA.M, matB.N );
00059   pdgemm_( 'N', 'N', matA.M, matB.N, matA.N, 1.0,
00060            matA.Array, 1, 1, matA.Desc,
00061            matB.Array, 1, 1, matB.Desc, 0.0,
00062            newmat.Array, 1, 1, newmat.Desc );
00063   
00064   matA.destroy();
00065   matB.destroy();
00066   return newmat;
00067 }

_dgematrix operator * const dgematrix mat,
const double &  d
[friend]
 

dgematrix*double operator

Definition at line 23 of file dgematrix-double.hpp.

00024 {
00025   _dgematrix newmat(mat.M, mat.N);
00026   for(int i=0; i<mat.Ml*mat.Nl; i++){ newmat.Array[i] =mat.Array[i]*d; }
00027   
00028   return newmat;
00029 }

_dgematrix operator * const _dgematrix mat,
const double &  d
[friend]
 

_dgematrix*double operator

Definition at line 3 of file _dgematrix-double.hpp.

00004 {
00005   dscal_(mat.Ml*mat.Ml, d, mat.Array, 1);
00006   
00007   return mat;
00008 }

_dgematrix operator * const double &  d,
const _dgematrix mat
[friend]
 

double*_dgematrix operator

Definition at line 3 of file double-_dgematrix.hpp.

00004 {
00005   dscal_(mat.Ml*mat.Nl, d, mat.Array, 1);
00006   
00007   return mat;
00008 }

_dgematrix operator * const double &  d,
const dgematrix mat
[friend]
 

double*dgematrix operator

Definition at line 3 of file double-dgematrix.hpp.

00004 {
00005   _dgematrix newmat(mat.M, mat.N);
00006   for(int i=0; i<mat.Ml*mat.Nl; i++){ newmat.Array[i] =d*mat.Array[i]; }
00007   
00008   return newmat;
00009 }

_dgematrix operator * const dcovector covec,
const drovector rovec
[friend]
 

dcovector*drovector operator

Definition at line 3 of file dcovector-drovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(covec.L!=rovec.L){
00007     std::cerr << "[ERROR] operator*(const dcovector&, const drovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << covec.L << ") * (" << rovec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dgematrix newmat(covec.L, covec.L);
00017   for(long i=0; i<newmat.M; i++){ for(long j=0; j<newmat.N; j++){
00018     newmat(i,j) =covec(i)*rovec(j);
00019   }}
00020   
00021   return newmat;
00022 }

_dgematrix operator * const dcovector covec,
const _drovector rovec
[friend]
 

dcovector*_drovector operator

Definition at line 3 of file dcovector-_drovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(covec.L!=rovec.L){
00007     std::cerr << "[ERROR] operator*(const dcovector&, const _drovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << covec.L << ") * (" << rovec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dgematrix newmat(covec.L, covec.L);
00017   for(long i=0; i<newmat.M; i++){ for(long j=0; j<newmat.N; j++){
00018     newmat(i,j) =covec(i)*rovec(j);
00019   }}
00020   
00021   rovec.destroy();
00022   return newmat;
00023 }

_dgematrix operator * const _dcovector covec,
const drovector rovec
[friend]
 

_dcovector*drovector operator

Definition at line 3 of file _dcovector-drovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(covec.L!=rovec.L){
00007     std::cerr << "[ERROR] operator*(const _dcovector&, const drovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << covec.L << ") * (" << rovec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dgematrix newmat(covec.L, covec.L);
00017   for(long i=0; i<newmat.M; i++){ for(long j=0; j<newmat.N; j++){
00018     newmat(i,j) =covec(i)*rovec(j);
00019   }}
00020   
00021   covec.destroy();
00022   return newmat;
00023 }

_dgematrix operator * const _dcovector covec,
const _drovector rovec
[friend]
 

_dcovector*_drovector operator

Definition at line 3 of file _dcovector-_drovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(covec.L!=rovec.L){
00007     std::cerr << "[ERROR] operator*(const _dcovector&, const _drovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << covec.L << ") * (" << rovec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dgematrix newmat(covec.L, covec.L);
00017   for(long i=0; i<newmat.M; i++){ for(long j=0; j<newmat.N; j++){
00018     newmat(i,j) =covec(i)*rovec(j);
00019   }}
00020   
00021   covec.destroy();
00022   rovec.destroy();
00023   return newmat;
00024 }

_drovector operator * const drovector vec,
const _dgematrix mat
[friend]
 

drovector*_dgematrix operator

Definition at line 3 of file drovector-_dgematrix.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( vec.L!=mat.M ){
00007     std::cerr << "[ERROR] operator*(const drovector&, const _dgematrix&)"
00008               << std::endl
00009               << "These vector and matrix can not make a product." << std::endl
00010               << "Your input was (" << vec.L << ") * ("
00011               << mat.M << "x" << mat.N << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _drovector newvec(mat.N);
00017   pdgemv_( 'T', mat.M, mat.N, 1.0, mat.Array, 1, 1, mat.Desc,
00018            vec.Array, 1, 1, vec.Desc, 1, 0.0,
00019            newvec.Array, 1, 1, newvec.Desc, 1 );
00020   
00021   mat.destroy();
00022   return newvec;
00023 }

_drovector operator * const _drovector vec,
const _dgematrix mat
[friend]
 

_drovector*_dgematrix operator

Definition at line 3 of file _drovector-_dgematrix.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( vec.L!=mat.M ){
00007     std::cerr << "[ERROR] operator*(const _drovector&, const _dgematrix&)"
00008               << std::endl
00009               << "These vector and matrix can not make a product." << std::endl
00010               << "Your input was (" << vec.L << ") * ("
00011               << mat.M << "x" << mat.N << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _drovector newvec(mat.N);
00017   pdgemv_( 'T', mat.M, mat.N, 1.0, mat.Array, 1, 1, mat.Desc,
00018            vec.Array, 1, 1, vec.Desc, 1, 0.0,
00019            newvec.Array, 1, 1, newvec.Desc, 1 );
00020   
00021   vec.destroy();
00022   mat.destroy();
00023   return newvec;
00024 }

_dcovector operator * const _dgematrix mat,
const dcovector vec
[friend]
 

_dgematrix*dcovector operator

Definition at line 3 of file _dgematrix-dcovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(mat.N!=vec.L){
00007     std::cerr << "[ERROR] operator*(const _dgematrix&, const dcovector&)"
00008               << std::endl
00009               << "These matrix and vector can not make a product." << std::endl
00010               << "Your input was (" << mat.M << "x" << mat.N << ") * ("
00011               << vec.L << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dcovector newvec(mat.M);
00017   pdgemv_( 'N', mat.M, mat.N, 1.0, mat.Array, 1, 1, mat.Desc,
00018            vec.Array, 1, 1, vec.Desc, 1, 0.0,
00019            newvec.Array, 1, 1, newvec.Desc, 1 );
00020   
00021   mat.destroy();
00022   return newvec;
00023 }

_dcovector operator * const _dgematrix mat,
const _dcovector vec
[friend]
 

_dgematrix*_dcovector operator

Definition at line 3 of file _dgematrix-_dcovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(mat.N!=vec.L){
00007     std::cerr << "[ERROR] operator*(const _dgematrix&, const _dcovector&)"
00008               << std::endl
00009               << "These matrix and vector can not make a product." << std::endl
00010               << "Your input was (" << mat.M << "x" << mat.N << ") * ("
00011               << vec.L << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dcovector newvec(mat.M);
00017   pdgemv_( 'N', mat.M, mat.N, 1.0, mat.Array, 1, 1, mat.Desc,
00018            vec.Array, 1, 1, vec.Desc, 1, 0.0,
00019            newvec.Array, 1, 1, newvec.Desc, 1 );
00020   
00021   mat.destroy();
00022   vec.destroy();
00023   return newvec;
00024 }

_dgematrix operator/ const dgematrix mat,
const double &  d
[friend]
 

dgematrix/double operator

Definition at line 33 of file dgematrix-double.hpp.

00034 {
00035   double inv_d(1./d);
00036   
00037   _dgematrix newmat(mat.M, mat.N);
00038   for(int i=0; i<mat.Ml*mat.Nl; i++){ newmat.Array[i] =mat.Array[i]*inv_d; }
00039   
00040   return newmat;
00041 }

_dgematrix operator/ const _dgematrix mat,
const double &  d
[friend]
 

_dgematrix/double operator

Definition at line 12 of file _dgematrix-double.hpp.

00013 {
00014   dscal_(mat.Ml*mat.Nl, 1./d, mat.Array, 1);
00015   
00016   return mat;
00017 }


Member Data Documentation

long _dgematrix::M [mutable]
 

global matrix row size

Definition at line 7 of file _dgematrix.hpp.

Referenced by _dgematrix(), absorb(), identity(), operator *(), dgematrix::operator *=(), operator()(), operator+(), dgematrix::operator+=(), operator-(), dgematrix::operator-=(), operator<<(), dgematrix::shallow_copy(), t(), and dgematrix::transpose().

long _dgematrix::N [mutable]
 

global matrix column size

Definition at line 8 of file _dgematrix.hpp.

Referenced by _dgematrix(), absorb(), identity(), operator *(), dgematrix::operator *=(), operator()(), operator+(), dgematrix::operator+=(), operator-(), dgematrix::operator-=(), operator<<(), dgematrix::shallow_copy(), t(), and dgematrix::transpose().

long _dgematrix::Ml [mutable]
 

local matrix row size

Definition at line 9 of file _dgematrix.hpp.

Referenced by _dgematrix(), absorb(), identity(), operator *(), operator+(), operator-(), operator/(), dgematrix::shallow_copy(), and zero().

long _dgematrix::Nl [mutable]
 

local matrix column size

Definition at line 10 of file _dgematrix.hpp.

Referenced by _dgematrix(), absorb(), identity(), operator *(), operator+(), operator-(), operator/(), dgematrix::shallow_copy(), and zero().

long _dgematrix::Desc[9] [mutable]
 

matrix description

Definition at line 11 of file _dgematrix.hpp.

Referenced by _dgematrix(), absorb(), operator *(), dgematrix::operator *=(), operator()(), and dgematrix::shallow_copy().

double* _dgematrix::Array [mutable]
 

1D array to store matrix data

Definition at line 12 of file _dgematrix.hpp.

Referenced by _dgematrix(), absorb(), destroy(), identity(), operator *(), dgematrix::operator *=(), operator()(), operator+(), dgematrix::operator+=(), operator-(), dgematrix::operator-=(), operator/(), dgematrix::shallow_copy(), and zero().


The documentation for this class was generated from the following files:
Generated on Sat Jan 31 19:25:45 2004 for CPPScaLapack by doxygen 1.3.5