CPPLapack
 All Classes Files Functions Variables Friends Pages
drovector-constructor.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! drovector constructor */
4 {CPPL_VERBOSE_REPORT;
5  //////// initialize ////////
6  l =0;
7  cap =0;
8  array =NULL;
9 }
10 
11 //=============================================================================
12 /*! drovector copy constructor */
13 inline drovector::drovector(const drovector& vec)
14 {CPPL_VERBOSE_REPORT;
15  //////// initialize ////////
16  l =vec.l;
17  cap =vec.cap;
18  array =new double[cap];
19 
20  //////// copy ////////
21  CPPL_INT inc =1;
22  dcopy_(&l, vec.array, &inc, array, &inc);
23 }
24 
25 //=============================================================================
26 /*! drovector constructor to cast _drovector */
27 inline drovector::drovector(const _drovector& vec)
28 {CPPL_VERBOSE_REPORT;
29  //////// initialize ////////
30  l =vec.l;
31  cap =vec.cap;
32  array =vec.array;
33 
34  vec.nullify();
35 }
36 
37 //=============================================================================
38 /*! drovector constructor with size specification */
39 inline drovector::drovector(const CPPL_INT& _l, const CPPL_INT margin)
40 {CPPL_VERBOSE_REPORT;
41 #ifdef CPPL_DEBUG
42  if( _l<0 || margin<0 ){
43  ERROR_REPORT;
44  std::cerr << "Vector size must be positive integers. " << std::endl
45  << "Your input was (" << _l << ")." << std::endl;
46  exit(1);
47  }
48 #endif//CPPL_DEBUG
49 
50  //////// initialize ////////
51  l =_l;
52  cap =l+margin;
53  array =new double[cap];
54 }
55 
56 //=============================================================================
57 /*! drovector constructor with filename */
58 inline drovector::drovector(const char* filename)
59 {CPPL_VERBOSE_REPORT;
60  array =NULL;
61  read(filename);
62 }
63 
64 ///////////////////////////////////////////////////////////////////////////////
65 ///////////////////////////////////////////////////////////////////////////////
66 ///////////////////////////////////////////////////////////////////////////////
67 
68 //=============================================================================
69 /*! drovector destructor */
71 {CPPL_VERBOSE_REPORT;
72  delete [] array;
73 }
double * array
1D array to store vector data
Definition: drovector.hpp:11
void nullify() const
double * array
1D array to store vector data
Definition: _drovector.hpp:11
CPPL_INT l
vector size
Definition: _drovector.hpp:9
CPPL_INT l
vector size
Definition: drovector.hpp:9
CPPL_INT cap
vector capacity
Definition: drovector.hpp:10
CPPL_INT cap
vector capacity
Definition: _drovector.hpp:10
Real Double-precision Row Vector Class.
Definition: drovector.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision Row Vector Class
Definition: _drovector.hpp:3
void read(const char *)