CPPLapack
 All Classes Files Functions Variables Friends Pages
dgbmatrix-constructor.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! dgbmatrix constructor */
4 {CPPL_VERBOSE_REPORT;
5  //////// initialize ////////
6  m =0;
7  n =0;
8  kl=0;
9  ku=0;
10  array =NULL;
11  darray =NULL;
12 }
13 
14 //=============================================================================
15 /*! dgbmatrix copy constructor */
16 inline dgbmatrix::dgbmatrix(const dgbmatrix& mat)
17 {CPPL_VERBOSE_REPORT;
18  //////// initialize ////////
19  m =mat.m;
20  n =mat.n;
21  kl=mat.kl;
22  ku=mat.ku;
23  array =new double[(kl+ku+1)*n];
24  darray =new double*[n];
25  for(int i=0; i<n; i++){
26  darray[i] =&array[i*(kl+ku+1)];
27  }
28 
29  //////// copy ////////
30  CPPL_INT size =(kl+ku+1)*n;
31  CPPL_INT inc =1;
32  dcopy_(&size, mat.array, &inc, array, &inc);
33 }
34 
35 //=============================================================================
36 /*! dgbmatrix constructor to cast _dgbmatrix */
37 inline dgbmatrix::dgbmatrix(const _dgbmatrix& mat)
38 {CPPL_VERBOSE_REPORT;
39  m =mat.m;
40  n =mat.n;
41  kl =mat.kl;
42  ku =mat.ku;
43  array =mat.array;
44  darray =mat.darray;
45 
46  mat.nullify();
47 }
48 
49 //=============================================================================
50 /*! dgbmatrix constructor with size specification */
51 inline dgbmatrix::dgbmatrix(const CPPL_INT& _m, const CPPL_INT& _n,
52  const CPPL_INT& _kl, const CPPL_INT& _ku)
53 {CPPL_VERBOSE_REPORT;
54 #ifdef CPPL_DEBUG
55  if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
56  ERROR_REPORT;
57  std::cerr << "It is impossible to make a matrix you ordered. " << std::endl
58  << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl;
59  exit(1);
60  }
61 #endif//CPPL_DEBUG
62 
63  //////// initialize ////////
64  m =_m;
65  n =_n;
66  kl =_kl;
67  ku =_ku;
68  array =new double[(kl+ku+1)*n];
69  darray =new double*[n];
70  for(int i=0; i<n; i++){
71  darray[i] =&array[i*(kl+ku+1)];
72  }
73 }
74 
75 //=============================================================================
76 /*! dgbmatrix constructor with filename */
77 inline dgbmatrix::dgbmatrix(const char* filename)
78 {CPPL_VERBOSE_REPORT;
79  array =NULL;
80  darray =NULL;
81 
82  //// read ////
83  read(filename);
84 }
85 
86 ///////////////////////////////////////////////////////////////////////////////
87 ///////////////////////////////////////////////////////////////////////////////
88 ///////////////////////////////////////////////////////////////////////////////
89 
90 //=============================================================================
91 /*! dgbmatrix destructor */
93 {CPPL_VERBOSE_REPORT;
94  //////// delete array ////////
95  delete [] array;
96  delete [] darray;
97 }
friend _dgematrix i(const dgbmatrix &)
CPPL_INT m
matrix row size
Definition: dgbmatrix.hpp:9
double ** darray
array of pointers of column head addresses
Definition: _dgbmatrix.hpp:14
void nullify() const
CPPL_INT ku
upper band width
Definition: _dgbmatrix.hpp:12
double ** darray
array of pointers of column head addresses
Definition: dgbmatrix.hpp:14
CPPL_INT kl
lower band width
Definition: dgbmatrix.hpp:11
CPPL_INT kl
lower band width
Definition: _dgbmatrix.hpp:11
CPPL_INT ku
upper band width
Definition: dgbmatrix.hpp:12
double * array
1D array to store matrix data
Definition: dgbmatrix.hpp:13
CPPL_INT n
matrix column size
Definition: _dgbmatrix.hpp:10
void read(const char *)
Real Double-precision General Band Matrix Class.
Definition: dgbmatrix.hpp:3
double * array
1D array to store matrix data
Definition: _dgbmatrix.hpp:13
(DO NOT USE) Smart-temporary Real Double-precision General Band Matrix Class
Definition: _dgbmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: dgbmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgbmatrix.hpp:9