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::array, i(), _dcovector::l, 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  return vecA;
18 }
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 22 of file _dcovector-dcovector.hpp.

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

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

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

41 {CPPL_VERBOSE_REPORT;
42 #ifdef CPPL_DEBUG
43  if(vecA.l!=vecB.l){
44  ERROR_REPORT;
45  std::cerr << "These two vectors can not make a dot product." << std::endl
46  << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
47  exit(1);
48  }
49 #endif//CPPL_DEBUG
50  CPPL_INT inc =1;
51 
52  double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc );
53 
54  vecA.destroy();
55  return val;
56 }
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