CPPLapack
 All Classes Files Functions Variables Friends Pages
Public Member Functions | Public Attributes | Friends | List of all members
zrovector_small< l > Class Template Reference

Samll Complex Double-precision Row Vector Class. More...

#include <zrovector_small.hpp>

Public Member Functions

 zrovector_small ()
 
 zrovector_small (const zrovector &)
 
 zrovector_small (const comple &, const comple &)
 
 zrovector_small (const comple &, const comple &, const comple &)
 
 ~zrovector_small ()
 
_zrovector to_zrovector () const
 
comple & operator() (const CPPL_INT &)
 
comple operator() (const CPPL_INT &) const
 
zrovector_small< l > & set (const CPPL_INT &, const comple &)
 
void read (const char *filename)
 
void write (const char *filename) const
 
zrovector_small< l > & zero ()
 
template<CPPL_INT L>
zrovector_small< L > & operator= (const zrovector_small< L > &)
 

Public Attributes

comple array [l]
 

Friends

template<CPPL_INT _l>
std::ostream & operator<< (std::ostream &, const zrovector_small< _l > &)
 
template<CPPL_INT _l>
zcovector_small< _l > t (const zrovector_small< _l > &)
 
template<CPPL_INT _l>
comple nrm2 (const zrovector_small< _l > &)
 
template<CPPL_INT _l>
CPPL_INT idamax (const zrovector_small< _l > &)
 
template<CPPL_INT _l>
comple damax (const zrovector_small< _l > &)
 
template<CPPL_INT L>
zrovector_small< L > & operator+= (zrovector_small< L > &, const zrovector_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > & operator-= (zrovector_small< L > &, const zrovector_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > & operator*= (zrovector_small< L > &, const double &)
 
template<CPPL_INT L>
zrovector_small< L > & operator*= (zrovector_small< L > &, const comple &)
 
template<CPPL_INT L>
zrovector_small< L > & operator/= (zrovector_small< L > &, const double &)
 
template<CPPL_INT L>
zrovector_small< L > & operator/= (zrovector_small< L > &, const comple &)
 
template<CPPL_INT L>
const zrovector_small< L > & operator+ (const zrovector_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > operator- (const zrovector_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > operator+ (const zrovector_small< L > &, const zrovector_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > operator- (const zrovector_small< L > &, const zrovector_small< L > &)
 
template<CPPL_INT L>
comple operator* (const zrovector_small< L > &, const zcovector_small< L > &)
 
template<CPPL_INT M, CPPL_INT N>
zrovector_small< N > operator* (const zrovector_small< M > &, const zgematrix_small< M, N > &)
 
template<CPPL_INT L>
zrovector_small< L > operator* (const zrovector_small< L > &, const dsymatrix_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > operator* (const zrovector_small< L > &, const comple &)
 
template<CPPL_INT L>
zrovector_small< L > operator* (const zrovector_small< L > &, const comple &)
 
template<CPPL_INT L>
zrovector_small< L > operator/ (const zrovector_small< L > &, const double &)
 
template<CPPL_INT L>
zrovector_small< L > operator/ (const zrovector_small< L > &, const comple &)
 
template<CPPL_INT L>
zrovector_small< L > operator* (const double &, const zrovector_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > operator* (const comple &, const zrovector_small< L > &)
 
template<CPPL_INT L>
zrovector_small< L > hadamerd (const zrovector_small< L > &, const zrovector_small< L > &)
 

Detailed Description

template<CPPL_INT l>
class zrovector_small< l >

Samll Complex Double-precision Row Vector Class.

Definition at line 3 of file zrovector_small.hpp.

Constructor & Destructor Documentation

template<CPPL_INT l>
zrovector_small< l >::zrovector_small ( )
inline

zrovector_small constructor

Definition at line 4 of file zrovector_small-constructors.hpp.

5 {CPPL_VERBOSE_REPORT;
6  ;
7 }
template<CPPL_INT l>
zrovector_small< l >::zrovector_small ( const zrovector vec)
inlineexplicit

zrovector_small constructor

Definition at line 12 of file zrovector_small-constructors.hpp.

References zrovector::array, and zrovector::l.

13 {CPPL_VERBOSE_REPORT;
14 #ifdef CPPL_DEBUG
15  if( l!=vec.l ){
16  ERROR_REPORT;
17  std::cerr << "Vector sizes must be the same." << std::endl
18  << "Your input was " << l << " and " << vec.l << "." << std::endl;
19  exit(1);
20  }
21 #endif//CPPL_DEBUG
22 
23  for(CPPL_INT k=0; k<l; k++){
24  array[k] =vec.array[k];
25  }
26 }
CPPL_INT l
vector size
Definition: zrovector.hpp:9
comple * array
1D array to store vector data
Definition: zrovector.hpp:10
template<CPPL_INT l>
zrovector_small< l >::zrovector_small ( const comple &  x,
const comple &  y 
)
inline

zrovector_small constructor

Definition at line 31 of file zrovector_small-constructors.hpp.

32 {CPPL_VERBOSE_REPORT;
33 #ifdef CPPL_DEBUG
34  if( l!=2 ){
35  ERROR_REPORT;
36  std::cerr << "The vector size must be 2." << std::endl
37  << "The vector size you set was " << l << "." << std::endl;
38  exit(1);
39  }
40 #endif//CPPL_DEBUG
41 
42  array[0] =x;
43  array[1] =y;
44 }
template<CPPL_INT l>
zrovector_small< l >::zrovector_small ( const comple &  x,
const comple &  y,
const comple &  z 
)
inline

zrovector_small constructor

Definition at line 49 of file zrovector_small-constructors.hpp.

50 {CPPL_VERBOSE_REPORT;
51 #ifdef CPPL_DEBUG
52  if( l!=3 ){
53  ERROR_REPORT;
54  std::cerr << "The vector size must be 3." << std::endl
55  << "The vector size you set was " << l << "." << std::endl;
56  exit(1);
57  }
58 #endif//CPPL_DEBUG
59 
60  array[0] =x;
61  array[1] =y;
62  array[2] =z;
63 }
template<CPPL_INT l>
zrovector_small< l >::~zrovector_small ( )
inline

zrovector_small destructor

Definition at line 72 of file zrovector_small-constructors.hpp.

73 {CPPL_VERBOSE_REPORT;
74  ;
75 }

Member Function Documentation

template<CPPL_INT l>
_zrovector zrovector_small< l >::to_zrovector ( ) const
inline

convert zrovector_small to zrovector

Definition at line 4 of file zrovector_small-functions.hpp.

References _().

5 {CPPL_VERBOSE_REPORT;
6  zrovector vec(l);
7  for(CPPL_INT k=0; k<l; k++){
8  vec(k) =(*this)(k);
9  }
10  return _(vec);
11 }
Complex Double-precision Row Vector Class.
Definition: zrovector.hpp:3
_dcovector _(dcovector &vec)
template<CPPL_INT l>
comple & zrovector_small< l >::operator() ( const CPPL_INT &  k)
inline

operator()

Definition at line 20 of file zrovector_small-functions.hpp.

21 {CPPL_VERBOSE_REPORT;
22 #ifdef CPPL_DEBUG
23  if( k<0 || l<=k ){
24  ERROR_REPORT;
25  std::cerr << "The required component is out of the vector size." << std::endl
26  << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl;
27  exit(1);
28  }
29 #endif//CPPL_DEBUG
30 
31  return array[k];
32 }
template<CPPL_INT l>
comple zrovector_small< l >::operator() ( const CPPL_INT &  k) const
inline

operator() for const

Definition at line 37 of file zrovector_small-functions.hpp.

38 {CPPL_VERBOSE_REPORT;
39 #ifdef CPPL_DEBUG
40  if( k<0 || l<=k ){
41  ERROR_REPORT;
42  std::cerr << "The required component is out of the vector size." << std::endl
43  << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl;
44  exit(1);
45  }
46 #endif//CPPL_DEBUG
47 
48  return array[k];
49 }
template<CPPL_INT l>
zrovector_small< l > & zrovector_small< l >::set ( const CPPL_INT &  k,
const comple &  v 
)
inline

set

Definition at line 54 of file zrovector_small-functions.hpp.

55 {CPPL_VERBOSE_REPORT;
56  (*this)(k) =v;
57  return *this;
58 }
template<CPPL_INT l>
void zrovector_small< l >::read ( const char *  filename)
inline

read from file

Definition at line 94 of file zrovector_small-functions.hpp.

95 {CPPL_VERBOSE_REPORT;
96  std::ifstream s( filename );
97  if(!s){
98  ERROR_REPORT;
99  std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl;
100  exit(1);
101  }
102 
103  std::string id;
104  s >> id;
105  if( id != "zrovector" && id != "#zrovector" ){
106  ERROR_REPORT;
107  std::cerr << "The type name of the file \"" << filename << "\" is not zrovector." << std::endl
108  << "Its type name was " << id << " ." << std::endl;
109  exit(1);
110  }
111 
112  CPPL_INT _l;
113  s >> _l;
114  if(l!=_l){
115  ERROR_REPORT;
116  std::cerr << "Matrix size is invalid." << std::endl;
117  exit(1);
118  }
119  for(CPPL_INT k=0; k<l; k++){
120  s >> (*this)(k);
121  }
122  if(s.eof()){
123  ERROR_REPORT;
124  std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
125  << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl;
126  exit(1);
127  }
128 
129  s >> id;//tmp
130  if(!s.eof()){
131  ERROR_REPORT;
132  std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
133  << "Most likely, there are extra data components." << std::endl;
134  exit(1);
135  }
136 
137  s.close();
138 }
template<CPPL_INT l>
void zrovector_small< l >::write ( const char *  filename) const
inline

write to file

Definition at line 76 of file zrovector_small-functions.hpp.

77 {CPPL_VERBOSE_REPORT;
78  std::ofstream ofs(filename, std::ios::trunc);
79  ofs.setf(std::cout.flags());
80  ofs.precision(std::cout.precision());
81  ofs.width(std::cout.width());
82  ofs.fill(std::cout.fill());
83 
84  ofs << "#zrovector" << " " << l << std::endl;
85  for(CPPL_INT k=0; k<l; k++){
86  ofs << (*this)(k) << std::endl;
87  }
88  ofs.close();
89 }
template<CPPL_INT l>
zrovector_small< l > & zrovector_small< l >::zero ( )
inline

zero

Definition at line 206 of file zrovector_small-functions.hpp.

Referenced by operator*().

207 {CPPL_VERBOSE_REPORT;
208  for(CPPL_INT k=0; k<l; k++){
209  array[k] =0.;
210  }
211  return *this;
212 }
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L>& zrovector_small< l >::operator= ( const zrovector_small< L > &  )
inline

Friends And Related Function Documentation

template<CPPL_INT l>
template<CPPL_INT _l>
std::ostream& operator<< ( std::ostream &  ,
const zrovector_small< _l > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT _l>
zcovector_small<_l> t ( const zrovector_small< _l > &  )
friend
template<CPPL_INT l>
template<CPPL_INT _l>
comple nrm2 ( const zrovector_small< _l > &  )
friend
template<CPPL_INT l>
template<CPPL_INT _l>
CPPL_INT idamax ( const zrovector_small< _l > &  )
friend
template<CPPL_INT l>
template<CPPL_INT _l>
comple damax ( const zrovector_small< _l > &  )
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L>& operator+= ( zrovector_small< L > &  ,
const zrovector_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L>& operator-= ( zrovector_small< L > &  ,
const zrovector_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L>& operator*= ( zrovector_small< L > &  ,
const double &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L>& operator*= ( zrovector_small< L > &  ,
const comple &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L>& operator/= ( zrovector_small< L > &  ,
const double &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L>& operator/= ( zrovector_small< L > &  ,
const comple &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
const zrovector_small<L>& operator+ ( const zrovector_small< L > &  )
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator- ( const zrovector_small< L > &  )
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator+ ( const zrovector_small< L > &  ,
const zrovector_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator- ( const zrovector_small< L > &  ,
const zrovector_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
comple operator* ( const zrovector_small< L > &  ,
const zcovector_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT M, CPPL_INT N>
zrovector_small<N> operator* ( const zrovector_small< M > &  ,
const zgematrix_small< M, N > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator* ( const zrovector_small< L > &  ,
const dsymatrix_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator* ( const zrovector_small< L > &  ,
const comple &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator* ( const zrovector_small< L > &  ,
const comple &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator/ ( const zrovector_small< L > &  ,
const double &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator/ ( const zrovector_small< L > &  ,
const comple &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator* ( const double &  ,
const zrovector_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> operator* ( const comple &  ,
const zrovector_small< L > &   
)
friend
template<CPPL_INT l>
template<CPPL_INT L>
zrovector_small<L> hadamerd ( const zrovector_small< L > &  ,
const zrovector_small< L > &   
)
friend

Member Data Documentation

template<CPPL_INT l>
comple zrovector_small< l >::array[l]

Definition at line 9 of file zrovector_small.hpp.


The documentation for this class was generated from the following files: