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

References _dcovector::array, _dcovector::destroy(), i(), and _dcovector::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++){ vecA.array[i]+=vecB.array[i]; }
16 
17  vecB.destroy();
18  return vecA;
19 }
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
void destroy() const
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 23 of file _dcovector-_dcovector.hpp.

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

24 {CPPL_VERBOSE_REPORT;
25 #ifdef CPPL_DEBUG
26  if(vecA.l!=vecB.l){
27  ERROR_REPORT;
28  std::cerr << "These two vectors can not make a subtraction." << std::endl
29  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
30  exit(1);
31  }
32 #endif//CPPL_DEBUG
33 
34  for(CPPL_INT i=0; i<vecA.l; i++){ vecA.array[i]-=vecB.array[i]; }
35 
36  vecB.destroy();
37  return vecA;
38 }
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
void destroy() const
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 42 of file _dcovector-_dcovector.hpp.

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

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