My Project
dgbmatrix-double.hpp
1 //=============================================================================
3 inline dgbmatrix& dgbmatrix::operator*=(const double& d)
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] dgbmatrix::operator*=(const double&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10  dscal_((KL+KU+1)*N, d, Array, 1);
11  return *this;
12 }
13 
14 //=============================================================================
16 inline dgbmatrix& dgbmatrix::operator/=(const double& d)
17 {
18 #ifdef CPPL_VERBOSE
19  std::cerr << "# [MARK] dgbmatrix::operator/=(const double&)"
20  << std::endl;
21 #endif//CPPL_VERBOSE
22 
23  dscal_((KL+KU+1)*N, 1./d, Array, 1);
24  return *this;
25 }
26 
30 
31 //=============================================================================
33 inline _dgbmatrix operator*(const dgbmatrix& mat, const double& d)
34 {
35 #ifdef CPPL_VERBOSE
36  std::cerr << "# [MARK] operator*(const dgbmatrix&, const double&)"
37  << std::endl;
38 #endif//CPPL_VERBOSE
39 
40  dgbmatrix newmat(mat.M, mat.N, mat.KL, mat.KU);
41  for(long i=0; i<(newmat.KL+newmat.KU+1)*newmat.N; i++){
42  newmat.Array[i] =mat.Array[i]*d;
43  }
44 
45  return _(newmat);
46 }
47 
48 //=============================================================================
50 inline _dgbmatrix operator/(const dgbmatrix& mat, const double& d)
51 {
52 #ifdef CPPL_VERBOSE
53  std::cerr << "# [MARK] operator/(const dgbmatrix&, const double&)"
54  << std::endl;
55 #endif//CPPL_VERBOSE
56 
57  double inv_d(1./d);
58 
59  dgbmatrix newmat(mat.M, mat.N, mat.KL, mat.KU);
60  for(long i=0; i<(newmat.KL+newmat.KU+1)*newmat.N; i++){
61  newmat.Array[i] =mat.Array[i]*inv_d;
62  }
63 
64  return _(newmat);
65 }
double * Array
1D Array to store vector data
Definition: _drovector.hpp:8
dgbmatrix & operator/=(const double &)
Definition: dgbmatrix-double.hpp:16
Real Double-precision General Band Matrix Class.
Definition: dgbmatrix.hpp:3
dgbmatrix & operator*=(const dgbmatrix &)
Definition: dgbmatrix-dgbmatrix.hpp:121
friend _drovector operator/(const drovector &, const double &)
Definition: drovector-double.hpp:48
friend _drovector operator*(const drovector &, const dgematrix &)
Definition: drovector-dgematrix.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision General Band Matrix Class
Definition: _dgbmatrix.hpp:3