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)
 

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, dcovector::array, i(), dcovector::l, 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  for(CPPL_INT i=0; i<vecA.l; i++){ vecB.array[i]+=vecA.array[i]; }
70 
71  return vecB;
72 }
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
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
double * array
1D array to store vector data
Definition: _dcovector.hpp:11
_dcovector operator- ( const dcovector vecA,
const _dcovector vecB 
)
inline

dcovector-dcovector operator

Definition at line 76 of file dcovector-_dcovector.hpp.

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

77 {CPPL_VERBOSE_REPORT;
78 #ifdef CPPL_DEBUG
79  if(vecA.l!=vecB.l){
80  ERROR_REPORT;
81  std::cerr << "These two vectors can not make a subtraction." << std::endl
82  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
83  exit(1);
84  }
85 #endif//CPPL_DEBUG
86 
87  for(CPPL_INT i=0; i<vecA.l; i++){
88  vecB.array[i] =vecA.array[i]-vecB.array[i];
89  }
90 
91  return vecB;
92 }
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
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
double * array
1D array to store vector data
Definition: _dcovector.hpp:11
double operator% ( const dcovector vecA,
const _dcovector vecB 
)
inline

dcovector^T*dcovector operator (inner product)

Definition at line 96 of file dcovector-_dcovector.hpp.

References dcovector::array, _dcovector::array, _dcovector::destroy(), dcovector::l, and _dcovector::l.

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