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