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

dgematrix-dgematrix.hpp File Reference

Go to the source code of this file.

Functions

_dgematrix operator+ (const dgematrix &matA, const dgematrix &matB)
_dgematrix operator- (const dgematrix &matA, const dgematrix &matB)
_dgematrix operator * (const dgematrix &matA, const dgematrix &matB)


Function Documentation

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

dgematrix+dgematrix operator

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

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

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
[inline]
 

dgematrix-dgematrix operator

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

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

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
[inline]
 

dgematrix*dgematrix operator

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

References _dgematrix::Array, dgematrix::Array, _dgematrix::Desc, dgematrix::Desc, dgematrix::M, and dgematrix::N.

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 }


Generated on Sat Jan 31 19:25:44 2004 for CPPScaLapack by doxygen 1.3.5