CPPLapack
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Friends
Pages
include
zhsmatrix-
zhsmatrix-_zgbmatrix.hpp
Go to the documentation of this file.
1
//=============================================================================
2
/*! zhsmatrix+_zgbmatrix operator */
3
/*
4
inline _zgematrix operator+(const zhsmatrix& matA, const _zgbmatrix& 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
zgematrix 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
matB.destroy();
24
return _(newmat);
25
}
26
*/
27
//=============================================================================
28
/*! zhsmatrix-_zgbmatrix operator */
29
/*
30
inline _zgematrix operator-(const zhsmatrix& matA, const _zgbmatrix& 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
zgematrix 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
matB.destroy();
50
return _(newmat);
51
}
52
*/
53
54
//=============================================================================
55
/*! zhsmatrix*_zgbmatrix operator */
56
/*
57
inline _zgematrix operator*(const zhsmatrix& matA, const _zgbmatrix& matB)
58
{CPPL_VERBOSE_REPORT;
59
#ifdef CPPL_DEBUG
60
if(matA.n!=matB.m){
61
ERROR_REPORT;
62
std::cerr << "These two matrises can not make a product." << std::endl
63
<< "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
64
exit(1);
65
}
66
#endif//CPPL_DEBUG
67
68
zgematrix newmat( matA.m, matB.n );
69
newmat.zero();
70
71
for(CPPL_INT c=0; c<matA.vol; c++){
72
for(CPPL_INT j=max(0,matA.jndx[c]-matB.kl);
73
j<min(matB.n,matA.jndx[c]+matB.ku+1); j++){
74
newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j);
75
}
76
}
77
78
matB.destroy();
79
return _(newmat);
80
}
81
*/
Generated by
1.8.6