VERB_code_2.3
_zcovector-io.hpp
1 //=============================================================================
3 inline std::complex<double>& _zcovector::operator()(const long& i) const
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] _zcovector::operator()(const long&) const"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10 #ifdef CPPL_DEBUG
11  if( i<0 || L<=i ){
12  std::cerr << "[ERROR] _zcovector::operator()(const long&) const"
13  << std::endl
14  << "The required component is out of the vector size."
15  << std::endl
16  << "Your input was (" << i << ")." << std::endl;
17  exit(1);
18  }
19 #endif//CPPL_DEBUG
20 
21  return Array[i];
22 }
23 
27 
28 //=============================================================================
29 inline std::ostream& operator<<(std::ostream& s, const _zcovector& vec)
30 {
31 #ifdef CPPL_VERBOSE
32  std::cerr << "# [MARK] operator<<(std::ostream&, const _zcovector&)"
33  << std::endl;
34 #endif//CPPL_VERBOSE
35 
36  for(long i=0; i<vec.L; i++){
37  s << " " << vec.Array[i] << std::endl;
38  }
39 
40  vec.destroy();
41  return s;
42 }
43 
47 
48 //=============================================================================
49 inline void _zcovector::write(const char* filename) const
50 {
51 #ifdef CPPL_VERBOSE
52  std::cerr << "# [MARK] _zcovector::write(const char*) const"
53  << std::endl;
54 #endif//CPPL_VERBOSE
55 
56  std::ofstream s(filename, std::ios::trunc);
57 
58  s << "zcovector" << " " << L << std::endl;
59  for(long i=0; i<L; i++){
60  s << operator()(i) << std::endl;
61  }
62 
63  s.close();
64  destroy();
65 }
std::complex< double > * Array
1D Array to store vector data
Definition: _zcovector.hpp:8
void destroy() const
Definition: _zcovector-misc.hpp:3
std::complex< double > & operator()(const long &) const
Definition: _zcovector-io.hpp:3
(DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class
Definition: _zcovector.hpp:3
long L
vector size
Definition: _zcovector.hpp:7