VERB_code_2.3
dsymatrix-dgematrix.hpp
1 //=============================================================================
3 inline _dgematrix operator+(const dsymatrix& matA, const dgematrix& matB)
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] operator+(const dsymatrix&, const dgematrix&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10 #ifdef CPPL_DEBUG
11  if(matA.N!=matB.N || matA.N!=matB.M){
12  std::cerr << "[ERROR] operator+(dsymatrix&, dgematrix&)" << std::endl
13  << "These two matrises can not make a summation." << std::endl
14  << "Your input was (" << matA.N << "x" << matA.N << ") + ("
15  << matB.M << "x" << matB.N << ")." << std::endl;
16  exit(1);
17  }
18 #endif//CPPL_DEBUG
19 
20  dgematrix newmat(matB);
21  for(long i=0; i<matA.N; i++) {
22  for(long j=0; j<matA.N; j++) {
23  newmat(i,j)+=matA(i,j);
24  }
25  }
26 
27  return _(newmat);
28 }
29 
30 //=============================================================================
32 inline _dgematrix operator-(const dsymatrix& matA, const dgematrix& matB)
33 {
34 #ifdef CPPL_VERBOSE
35  std::cerr << "# [MARK] operator-(const dsymatrix&, const dgematrix&)"
36  << std::endl;
37 #endif//CPPL_VERBOSE
38 
39 #ifdef CPPL_DEBUG
40  if(matA.N!=matB.N || matA.N!=matB.M){
41  std::cerr << "[ERROR] operator+(dsymatrix&, dgematrix&)" << std::endl
42  << "These two matrises can not make a summation." << std::endl
43  << "Your input was (" << matA.N << "x" << matA.N << ") + ("
44  << matB.M << "x" << matB.N << ")." << std::endl;
45  exit(1);
46  }
47 #endif//CPPL_DEBUG
48 
49  dgematrix newmat(-matB);
50  for(long i=0; i<matA.N; i++){
51  for(long j=0; j<matA.N; j++){
52  newmat(i,j)+=matA(i,j);
53  }
54  }
55 
56  return _(newmat);
57 }
58 
59 
60 //=============================================================================
62 inline _dgematrix operator*(const dsymatrix& matA, const dgematrix& matB)
63 {
64 #ifdef CPPL_VERBOSE
65  std::cerr << "# [MARK] operator*(const dsymatrix&, const dgematrix&)"
66  << std::endl;
67 #endif//CPPL_VERBOSE
68 
69 #ifdef CPPL_DEBUG
70  if(matA.N!=matB.M){
71  std::cerr << "[ERROR] operator*(dsymatrix&, dgematrix&)" << std::endl
72  << "These two matrises can not make a product." << std::endl
73  << "Your input was (" << matA.N << "x" << matA.N << ") * ("
74  << matB.M << "x" << matB.N << ")." << std::endl;
75  exit(1);
76  }
77 #endif//CPPL_DEBUG
78 
79  dgematrix newmat( matA.N, matB.N );
80  dsymm_( 'L', 'L', matA.N, matB.N, 1.0, matA.Array, matA.N,
81  matB.Array, matB.M, 0.0, newmat.array, newmat.m );
82 
83  return _(newmat);
84 }
long const & m
matrix row size (readable)
Definition: dgematrix.hpp:14
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
Real Double-precision Symmetric Matrix Class [L-type (UPLO=L) Strage].
Definition: dsymatrix.hpp:3
double *const & array
1D array to store matrix data (readable)
Definition: dgematrix.hpp:16
friend _drovector operator-(const _drovector &)
Definition: _drovector-unary.hpp:15
(DO NOT USE) Smart-temporary Real Double-precision General Dence Matrix Class
Definition: _dgematrix.hpp:3
friend _drovector operator*(const drovector &, const dgematrix &)
Definition: drovector-dgematrix.hpp:3
friend const _drovector & operator+(const _drovector &)
Definition: _drovector-unary.hpp:3