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
/*! dssmatrix+dsymatrix operator */
3
/*
4
inline _dgematrix operator+(const dssmatrix& 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
return _(newmat);
21
}
22
*/
23
//=============================================================================
24
/*! dssmatrix-dsymatrix operator */
25
/*
26
inline _dgematrix operator-(const dssmatrix& matA, const dsymatrix& matB)
27
{CPPL_VERBOSE_REPORT;
28
#ifdef CPPL_DEBUG
29
if(matA.m!=matB.n || matA.n!=matB.n){
30
ERROR_REPORT;
31
std::cerr << "These two matrises can not make a subtraction." << std::endl
32
<< "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
33
exit(1);
34
}
35
#endif//CPPL_DEBUG
36
37
//// shallow copy to dgematrix ////
38
dgematrix newmat(-matB);
39
40
//// add ////
41
for(CPPL_INT c=0; c<matA.vol; c++){
42
newmat(matA.indx[c],matA.jndx[c]) += matA.array[c];
43
}
44
45
return _(newmat);
46
}
47
*/
48
//=============================================================================
49
/*! dssmatrix*dsymatrix operator */
50
/*
51
inline _dgematrix operator*(const dssmatrix& matA, const dsymatrix& matB)
52
{CPPL_VERBOSE_REPORT;
53
#ifdef CPPL_DEBUG
54
if(matA.n!=matB.n){
55
ERROR_REPORT;
56
std::cerr << "These two matrises can not make a product." << std::endl
57
<< "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
58
exit(1);
59
}
60
#endif//CPPL_DEBUG
61
62
dgematrix newmat(matA.m, matB.n);
63
newmat.zero();
64
65
for(CPPL_INT c=0; c<matA.vol; c++){
66
for(CPPL_INT i=0; i<matB.n; i++){
67
newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i);
68
}
69
}
70
71
return _(newmat);
72
}
73
*/
Generated by
1.8.6