CPPLapack
 All Classes Files Functions Variables Friends Pages
_drovector-calc.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! return a transposed column vector */
3 inline _dcovector t(const _drovector& rovec)
4 {CPPL_VERBOSE_REPORT;
5  _dcovector covec;
6  covec.l =rovec.l;
7  covec.cap =rovec.cap;
8  delete [] covec.array;
9  covec.array =rovec.array;
10 
11  rovec.nullify();
12  return covec;
13 }
14 
15 //=============================================================================
16 /*! return its Euclidean norm */
17 inline double nrm2(const _drovector& vec)
18 {CPPL_VERBOSE_REPORT;
19  CPPL_INT inc =1;
20  double val =dnrm2_(&vec.l, vec.array, &inc);
21  vec.destroy();
22  return val;
23 }
24 
25 //=============================================================================
26 /*! return the index of element having the largest absolute value
27  in 0-based numbering system */
28 inline CPPL_INT idamax(const _drovector& vec)
29 {CPPL_VERBOSE_REPORT;
30  CPPL_INT inc =1;
31  CPPL_INT i =idamax_(&vec.l, vec.array, &inc) -1;
32  vec.destroy();
33  return i;
34 }
35 
36 //=============================================================================
37 /*! return its largest absolute value */
38 inline double damax(const _drovector& vec)
39 {CPPL_VERBOSE_REPORT;
40  CPPL_INT inc =1;
41  double val =vec.array[idamax_(&vec.l, vec.array, &inc) -1];
42  vec.destroy();
43  return val;
44 }
CPPL_INT idamax(const _drovector &vec)
void nullify() const
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
double damax(const _drovector &vec)
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)
_dcovector t(const _drovector &rovec)
CPPL_INT cap
vector capacity
Definition: _dcovector.hpp:10
void destroy() const
CPPL_INT cap
vector capacity
Definition: _drovector.hpp:10
(DO NOT USE) Smart-temporary Real Double-precision Row Vector Class
Definition: _drovector.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision Column Vector Class
Definition: _dcovector.hpp:3
double * array
1D array to store vector data
Definition: _dcovector.hpp:11
double nrm2(const _drovector &vec)