CPPLapack
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Friends
Pages
include
zhsmatrix-
zhsmatrix-zhematrix.hpp
Go to the documentation of this file.
1
//=============================================================================
2
/*! zhsmatrix+zhematrix operator */
3
/*
4
inline _zgematrix operator+(const zhsmatrix& matA, const zhematrix& 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
zgematrix 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
/*! zhsmatrix-zhematrix operator */
25
/*
26
inline _zgematrix operator-(const zhsmatrix& matA, const zhematrix& 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 zgematrix ////
38
zgematrix 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
/*! zhsmatrix*zhematrix operator */
50
/*
51
inline _zgematrix operator*(const zhsmatrix& matA, const zhematrix& 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
zgematrix 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