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
/*! _zgsmatrix+_zgbmatrix operator */
3
/*
4
inline _zgematrix operator+(const _zgsmatrix& 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
matA.destroy();
24
matB.destroy();
25
return _(newmat);
26
}
27
*/
28
//=============================================================================
29
/*! _zgsmatrix-_zgbmatrix operator */
30
/*
31
inline _zgematrix operator-(const _zgsmatrix& matA, const _zgbmatrix& matB)
32
{CPPL_VERBOSE_REPORT;
33
#ifdef CPPL_DEBUG
34
if(matA.n!=matB.n || matA.m!=matB.m){
35
ERROR_REPORT;
36
std::cerr << "These two matrises can not make a summation." << std::endl
37
<< "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
38
exit(1);
39
}
40
#endif//CPPL_DEBUG
41
42
zgematrix newmat(matA);
43
44
for(CPPL_INT i=0; i<matB.m; i++){
45
for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){
46
newmat(i,j)-=matB(i,j);
47
}
48
}
49
50
matA.destroy();
51
matB.destroy();
52
return _(newmat);
53
}
54
*/
55
//=============================================================================
56
/*! _zgsmatrix*_zgbmatrix operator */
57
/*
58
inline _zgematrix operator*(const _zgsmatrix& matA, const _zgbmatrix& matB)
59
{CPPL_VERBOSE_REPORT;
60
#ifdef CPPL_DEBUG
61
if(matA.n!=matB.m){
62
ERROR_REPORT;
63
std::cerr << "These two matrises can not make a product." << std::endl
64
<< "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
65
exit(1);
66
}
67
#endif//CPPL_DEBUG
68
69
zgematrix newmat( matA.m, matB.n );
70
newmat.zero();
71
72
for(CPPL_INT c=0; c<matA.vol; c++){
73
for(CPPL_INT k=max(0,matA.jndx[c]-matB.ku);
74
k<min(matB.m,matA.jndx[c]+matB.kl+1); k++){
75
newmat(matA.indx[c],k) += matA.array[c]*matB(matA.jndx[c],k);
76
}
77
}
78
79
matA.destroy();
80
matB.destroy();
81
return _(newmat);
82
}
83
*/
Generated by
1.8.6