CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
dcovector-dcovector.hpp File Reference

Go to the source code of this file.

Functions

_dcovector operator+ (const dcovector &vecA, const dcovector &vecB)
 
_dcovector operator- (const dcovector &vecA, const dcovector &vecB)
 
double operator% (const dcovector &vecA, const dcovector &vecB)
 
_dcovector hadamerd (const dcovector &vecA, const dcovector &vecB)
 

Function Documentation

_dcovector operator+ ( const dcovector vecA,
const dcovector vecB 
)
inline

dcovector+dcovector operator

Definition at line 57 of file dcovector-dcovector.hpp.

References _(), dcovector::array, i(), and dcovector::l.

58 {CPPL_VERBOSE_REPORT;
59 #ifdef CPPL_DEBUG
60  if(vecA.l!=vecB.l){
61  ERROR_REPORT;
62  std::cerr << "These two vectors can not make a sumation." << std::endl
63  << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
64  exit(1);
65  }
66 
67 #endif//CPPL_DEBUG
68 
69  dcovector newvec(vecA.l);
70  for(CPPL_INT i=0; i<newvec.l; i++){
71  newvec.array[i] =vecA.array[i]+vecB.array[i];
72  }
73 
74  return _(newvec);
75 }
CPPL_INT l
vector size
Definition: dcovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
double * array
1D array to store vector data
Definition: dcovector.hpp:11
Real Double-precision Column Vector Class.
Definition: dcovector.hpp:3
_dcovector _(dcovector &vec)
_dcovector operator- ( const dcovector vecA,
const dcovector vecB 
)
inline

dcovector-dcovector operator

Definition at line 79 of file dcovector-dcovector.hpp.

References _(), dcovector::array, i(), and dcovector::l.

80 {CPPL_VERBOSE_REPORT;
81 #ifdef CPPL_DEBUG
82  if(vecA.l!=vecB.l){
83  ERROR_REPORT;
84  std::cerr << "These two vectors can not make a subtraction." << std::endl
85  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
86  exit(1);
87  }
88 #endif//CPPL_DEBUG
89 
90  dcovector newvec(vecA.l);
91  for(CPPL_INT i=0; i<newvec.l; i++){
92  newvec.array[i] =vecA.array[i]-vecB.array[i];
93  }
94 
95  return _(newvec);
96 }
CPPL_INT l
vector size
Definition: dcovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
double * array
1D array to store vector data
Definition: dcovector.hpp:11
Real Double-precision Column Vector Class.
Definition: dcovector.hpp:3
_dcovector _(dcovector &vec)
double operator% ( const dcovector vecA,
const dcovector vecB 
)
inline

dcovector^T*dcovector operator (inner product)

Definition at line 100 of file dcovector-dcovector.hpp.

References dcovector::array, and dcovector::l.

101 {CPPL_VERBOSE_REPORT;
102 #ifdef CPPL_DEBUG
103  if(vecA.l!=vecB.l){
104  ERROR_REPORT;
105  std::cerr << "These two vectors can not make a dot product." << std::endl
106  << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
107  exit(1);
108  }
109 #endif//CPPL_DEBUG
110 
111  CPPL_INT inc =1;
112 
113  double val( ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ) );
114 
115  return val;
116 }
CPPL_INT l
vector size
Definition: dcovector.hpp:9
double * array
1D array to store vector data
Definition: dcovector.hpp:11
_dcovector hadamerd ( const dcovector vecA,
const dcovector vecB 
)
inline

return Hadamerd product

Definition at line 124 of file dcovector-dcovector.hpp.

References _(), i(), and dcovector::l.

125 {CPPL_VERBOSE_REPORT;
126 #ifdef CPPL_DEBUG
127  if( vecA.l!=vecB.l ){
128  ERROR_REPORT;
129  std::cerr << "These two vectors can not make Hadamerd product." << std::endl
130  << "Your input was (" << vecA.l << ") and (" << vecB.l << ")." << std::endl;
131  exit(1);
132  }
133 #endif//CPPL_DEBUG
134 
135  dcovector newvec(vecA.l);
136  for(CPPL_INT i=0; i<newvec.l; i++){
137  newvec(i) =vecA(i)*vecB(i);
138  }
139  return _(newvec);
140 }
CPPL_INT l
vector size
Definition: dcovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision Column Vector Class.
Definition: dcovector.hpp:3
_dcovector _(dcovector &vec)