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

Go to the source code of this file.

Functions

_drovector operator+ (const drovector &vecA, const _drovector &vecB)
 
_drovector operator- (const drovector &vecA, const _drovector &vecB)
 
double operator% (const drovector &vecA, const _drovector &vecB)
 

Function Documentation

_drovector operator+ ( const drovector vecA,
const _drovector vecB 
)
inline

drovector+drovector operator

Definition at line 57 of file drovector-_drovector.hpp.

References _drovector::array, drovector::array, i(), drovector::l, and _drovector::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 }
double * array
1D array to store vector data
Definition: drovector.hpp:11
double * array
1D array to store vector data
Definition: _drovector.hpp:11
CPPL_INT l
vector size
Definition: _drovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT l
vector size
Definition: drovector.hpp:9
_drovector operator- ( const drovector vecA,
const _drovector vecB 
)
inline

drovector-drovector operator

Definition at line 76 of file drovector-_drovector.hpp.

References _drovector::array, drovector::array, i(), drovector::l, and _drovector::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 }
double * array
1D array to store vector data
Definition: drovector.hpp:11
double * array
1D array to store vector data
Definition: _drovector.hpp:11
CPPL_INT l
vector size
Definition: _drovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT l
vector size
Definition: drovector.hpp:9
double operator% ( const drovector vecA,
const _drovector vecB 
)
inline

drovector^T*drovector operator (inner product)

Definition at line 96 of file drovector-_drovector.hpp.

References drovector::array, _drovector::array, _drovector::destroy(), drovector::l, and _drovector::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  double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc );
109 
110  vecB.destroy();
111  return val;
112 }
double * array
1D array to store vector data
Definition: drovector.hpp:11
double * array
1D array to store vector data
Definition: _drovector.hpp:11
CPPL_INT l
vector size
Definition: _drovector.hpp:9
void destroy() const
CPPL_INT l
vector size
Definition: drovector.hpp:9