CPPLapack
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Friends
Pages
include
_dssmatrix-
_dssmatrix-dgematrix.hpp
Go to the documentation of this file.
1
//=============================================================================
2
/*! _dgsmatrix+dgematrix operator */
3
/*
4
inline _dgematrix operator+(const _dgsmatrix& matA, const dgematrix& matB)
5
{CPPL_VERBOSE_REPORT;
6
#ifdef CPPL_DEBUG
7
if(matA.m!=matB.m || matA.n!=matB.n){
8
ERROR_REPORT;
9
std::cerr << "These two matrises can not make a summation." << std::endl
10
<< "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
11
exit(1);
12
}
13
#endif//CPPL_DEBUG
14
15
dgematrix newmat(matB);
16
for(CPPL_INT c=0; c<matA.vol; c++){
17
newmat(matA.indx[c],matA.jndx[c]) += matA.array[c];
18
}
19
20
matA.destroy();
21
return _(newmat);
22
}
23
*/
24
//=============================================================================
25
/*! _dgsmatrix-dgematrix operator */
26
/*
27
inline _dgematrix operator-(const _dgsmatrix& matA, const dgematrix& matB)
28
{CPPL_VERBOSE_REPORT;
29
#ifdef CPPL_DEBUG
30
if(matA.m!=matB.m || matA.n!=matB.n){
31
ERROR_REPORT;
32
std::cerr << "These two matrises can not make a subtraction." << std::endl
33
<< "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
34
exit(1);
35
}
36
#endif//CPPL_DEBUG
37
38
dgematrix newmat(-matB);
39
for(CPPL_INT c=0; c<matA.vol; c++){
40
newmat(matA.indx[c],matA.jndx[c]) += matA.array[c];
41
}
42
43
matA.destroy();
44
return _(newmat);
45
}
46
*/
47
//=============================================================================
48
/*! _dgsmatrix*dgematrix operator */
49
/*
50
inline _dgematrix operator*(const _dgsmatrix& matA, const dgematrix& matB)
51
{CPPL_VERBOSE_REPORT;
52
#ifdef CPPL_DEBUG
53
if(matA.n!=matB.m){
54
ERROR_REPORT;
55
std::cerr << "These two matrises can not make a product." << std::endl
56
<< "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
57
exit(1);
58
}
59
#endif//CPPL_DEBUG
60
61
dgematrix newmat(matA.m, matB.n);
62
newmat.zero();
63
64
for(CPPL_INT c=0; c<matA.vol; c++){
65
for(CPPL_INT j=0; j<matB.n; j++){
66
newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j);
67
}
68
}
69
70
matA.destroy();
71
return _(newmat);
72
}
73
*/
Generated by
1.8.6