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