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 3 of file _drovector-_drovector.hpp.

References _drovector::array, _drovector::destroy(), i(), and _drovector::l.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(vecA.l!=vecB.l){
7  ERROR_REPORT;
8  std::cerr << "These two vectors can not make a sumation." << std::endl
9  << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
10  exit(1);
11  }
12 
13 #endif//CPPL_DEBUG
14 
15  for(CPPL_INT i=0; i<vecA.l; i++){
16  vecA.array[i]+=vecB.array[i];
17  }
18 
19  vecB.destroy();
20  return vecA;
21 }
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)
void destroy() const
_drovector operator- ( const _drovector vecA,
const _drovector vecB 
)
inline

_drovector-_drovector operator

Definition at line 25 of file _drovector-_drovector.hpp.

References _drovector::array, _drovector::destroy(), i(), and _drovector::l.

26 {CPPL_VERBOSE_REPORT;
27 #ifdef CPPL_DEBUG
28  if(vecA.l!=vecB.l){
29  ERROR_REPORT;
30  std::cerr << "These two vectors can not make a subtraction." << std::endl
31  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
32  exit(1);
33  }
34 #endif//CPPL_DEBUG
35 
36  for(CPPL_INT i=0; i<vecA.l; i++){
37  vecA.array[i]-=vecB.array[i];
38  }
39 
40  vecB.destroy();
41  return vecA;
42 }
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)
void destroy() const
double operator% ( const _drovector vecA,
const _drovector vecB 
)
inline

_drovector^T*_drovector operator (inner product)

Definition at line 46 of file _drovector-_drovector.hpp.

References _drovector::array, _drovector::destroy(), and _drovector::l.

47 {CPPL_VERBOSE_REPORT;
48 #ifdef CPPL_DEBUG
49  if(vecA.l!=vecB.l){
50  ERROR_REPORT;
51  std::cerr << "These two vectors can not make a dot product." << std::endl
52  << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
53  exit(1);
54  }
55 #endif//CPPL_DEBUG
56 
57  CPPL_INT inc =1;
58  double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc );
59 
60  vecA.destroy();
61  vecB.destroy();
62  return val;
63 }
double * array
1D array to store vector data
Definition: _drovector.hpp:11
CPPL_INT l
vector size
Definition: _drovector.hpp:9
void destroy() const