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