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

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

#include <zcovector_small.hpp>

Public Member Functions

 zcovector_small ()
 
 zcovector_small (const zcovector &)
 
 zcovector_small (const comple &, const comple &)
 
 zcovector_small (const comple &, const comple &, const comple &)
 
 ~zcovector_small ()
 
_zcovector to_zcovector () const
 
comple & operator() (const CPPL_INT &)
 
comple operator() (const CPPL_INT &) const
 
zcovector_small< l > & set (const CPPL_INT &, const comple &)
 
void read (const char *filename)
 
void write (const char *filename) const
 
zcovector_small< l > & zero ()
 
template<CPPL_INT L>
zcovector_small< L > & operator= (const zcovector_small< L > &)
 

Public Attributes

comple array [l]
 

Friends

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

Detailed Description

template<CPPL_INT l>
class zcovector_small< l >

Samll Complex Double-precision Column Vector Class.

Definition at line 3 of file zcovector_small.hpp.

Constructor & Destructor Documentation

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

zcovector_small constructor

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

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

zcovector_small constructor

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

References zcovector::array, and zcovector::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 }
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
CPPL_INT l
vector size
Definition: zcovector.hpp:9
template<CPPL_INT l>
zcovector_small< l >::zcovector_small ( const comple &  x,
const comple &  y 
)
inline

zcovector_small constructor

Definition at line 31 of file zcovector_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>
zcovector_small< l >::zcovector_small ( const comple &  x,
const comple &  y,
const comple &  z 
)
inline

zcovector_small constructor

Definition at line 49 of file zcovector_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>
zcovector_small< l >::~zcovector_small ( )
inline

zcovector_small destructor

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

73 {CPPL_VERBOSE_REPORT;
74  ;
75 }

Member Function Documentation

template<CPPL_INT l>
_zcovector zcovector_small< l >::to_zcovector ( ) const
inline

convert zcovector_small to zcovector

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

References _().

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

operator()

Definition at line 20 of file zcovector_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 zcovector_small< l >::operator() ( const CPPL_INT &  k) const
inline

operator() for const

Definition at line 37 of file zcovector_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>
zcovector_small< l > & zcovector_small< l >::set ( const CPPL_INT &  k,
const comple &  v 
)
inline

set

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

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

read from file

Definition at line 93 of file zcovector_small-functions.hpp.

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

write to file

Definition at line 75 of file zcovector_small-functions.hpp.

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

zero

Definition at line 202 of file zcovector_small-functions.hpp.

Referenced by operator*().

203 {CPPL_VERBOSE_REPORT;
204  for(CPPL_INT k=0; k<l; k++){
205  array[k] =0.;
206  }
207  return *this;
208 }
template<CPPL_INT l>
template<CPPL_INT L>
zcovector_small<L>& zcovector_small< l >::operator= ( const zcovector_small< L > &  )
inline

Friends And Related Function Documentation

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

Member Data Documentation

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

Definition at line 9 of file zcovector_small.hpp.


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