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 3 of file _dgematrix-_dgematrix.hpp.

References _dgematrix::Array, _dgematrix::destroy(), _dgematrix::M, _dgematrix::Ml, _dgematrix::N, and _dgematrix::Nl.

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 matA,
const _dgematrix matB
[inline]
 

_dgematrix-_dgematrix operator

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

References _dgematrix::Array, _dgematrix::destroy(), _dgematrix::M, _dgematrix::Ml, _dgematrix::N, and _dgematrix::Nl.

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

_dgematrix*_dgematrix operator

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

References _dgematrix::Array, _dgematrix::Desc, _dgematrix::destroy(), _dgematrix::M, and _dgematrix::N.

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 }


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