CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
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 89 of file dgematrix-_dgematrix.hpp.

References _dgematrix::array, dgematrix::array, i(), _dgematrix::m, dgematrix::m, dgematrix::n, and _dgematrix::n.

90 {CPPL_VERBOSE_REPORT;
91 #ifdef CPPL_DEBUG
92  if(matA.n!=matB.n || matA.m!=matB.m){
93  ERROR_REPORT;
94  std::cerr << "These two matrises can not make a summation." << std::endl
95  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
96  exit(1);
97  }
98 #endif//CPPL_DEBUG
99 
100  const CPPL_INT mn =matA.m*matA.n;
101  for(CPPL_INT i=0; i<mn; i++){
102  matB.array[i] +=matA.array[i];
103  }
104 
105  return matB;
106 }
CPPL_INT m
matrix row size
Definition: dgematrix.hpp:9
double * array
1D array to store matrix data
Definition: dgematrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
double * array
1D array to store matrix data
Definition: _dgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
_dgematrix operator- ( const dgematrix matA,
const _dgematrix matB 
)
inline

dgematrix-_dgematrix operator

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

References _dgematrix::array, dgematrix::array, i(), _dgematrix::m, dgematrix::m, dgematrix::n, and _dgematrix::n.

111 {CPPL_VERBOSE_REPORT;
112 #ifdef CPPL_DEBUG
113  if(matA.n!=matB.n || matA.m!=matB.m){
114  ERROR_REPORT;
115  std::cerr << "These two matrises can not make a subtraction." << std::endl
116  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
117  exit(1);
118  }
119 #endif//CPPL_DEBUG
120 
121  const CPPL_INT mn =matA.m*matA.n;
122  for(CPPL_INT i=0; i<mn; i++){
123  matB.array[i] =matA.array[i]-matB.array[i];
124  }
125 
126  return matB;
127 }
CPPL_INT m
matrix row size
Definition: dgematrix.hpp:9
double * array
1D array to store matrix data
Definition: dgematrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
double * array
1D array to store matrix data
Definition: _dgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
_dgematrix operator* ( const dgematrix matA,
const _dgematrix matB 
)
inline

dgematrix*_dgematrix operator

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

References _(), dgematrix::array, _dgematrix::array, _dgematrix::destroy(), _dgematrix::m, dgematrix::m, _dgematrix::n, and dgematrix::n.

132 {CPPL_VERBOSE_REPORT;
133 #ifdef CPPL_DEBUG
134  if(matA.n!=matB.m){
135  ERROR_REPORT;
136  std::cerr << "These two matrises can not make a product." << std::endl
137  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
138  exit(1);
139  }
140 #endif//CPPL_DEBUG
141 
142  dgematrix newmat( matA.m, matB.n );
143  char transa ='n';
144  char transb ='n';
145  double alpha =1.;
146  double beta =0.;
147 
148  dgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m );
149 
150  matB.destroy();
151  return _(newmat);
152 }
CPPL_INT m
matrix row size
Definition: dgematrix.hpp:9
double * array
1D array to store matrix data
Definition: dgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
double * array
1D array to store matrix data
Definition: _dgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
void destroy() const
_dcovector _(dcovector &vec)