VERB_code_2.3
_zrovector-io.hpp
1 //=============================================================================
3 inline std::complex<double>& _zrovector::operator()(const long& i) const
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] _zrovector::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] _zrovector::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 _zrovector& vec)
30 {
31 #ifdef CPPL_VERBOSE
32  std::cerr << "# [MARK] operator<<(std::ostream&, const _zrovector&)"
33  << std::endl;
34 #endif//CPPL_VERBOSE
35 
36  for(long i=0; i<vec.L; i++){ s << " " << vec.Array[i]; }
37  s << std::endl;
38 
39  vec.destroy();
40  return s;
41 }
42 
46 
47 //=============================================================================
48 inline void _zrovector::write(const char* filename) const
49 {
50 #ifdef CPPL_VERBOSE
51  std::cerr << "# [MARK] _zrovector::write(const char*) const"
52  << std::endl;
53 #endif//CPPL_VERBOSE
54 
55  std::ofstream s(filename, std::ios::trunc);
56 
57  s << "zrovector" << " " << L << std::endl;
58  for(long i=0; i<L; i++){
59  s << operator()(i) << " ";
60  }
61  s << std::endl;
62 
63  s.close();
64  destroy();
65 }
void destroy() const
Definition: _zrovector-misc.hpp:3
long L
vector size
Definition: _zrovector.hpp:7
(DO NOT USE) Smart-temporary Complex Double-precision Row Vector Class
Definition: _zrovector.hpp:3
std::complex< double > & operator()(const long &) const
Definition: _zrovector-io.hpp:3
std::complex< double > * Array
1D Array to store vector data
Definition: _zrovector.hpp:8