CPPLapack
 All Classes Files Functions Variables Friends Pages
_zrovector-io.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! operator() for const object */
3 inline comple& _zrovector::operator()(const CPPL_INT& i) const
4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if( i<0 || l<=i ){
7  ERROR_REPORT;
8  std::cerr << "The required component is out of the vector size." << std::endl
9  << "Your input is (" << i << "), whereas the vector size is (" << l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  return array[i];
15 }
16 
17 ///////////////////////////////////////////////////////////////////////////////
18 ///////////////////////////////////////////////////////////////////////////////
19 ///////////////////////////////////////////////////////////////////////////////
20 
21 //=============================================================================
22 inline std::ostream& operator<<(std::ostream& s, const _zrovector& vec)
23 {CPPL_VERBOSE_REPORT;
24  for(CPPL_INT i=0; i<vec.l; i++){ s << " " << vec.array[i]; }
25  s << std::endl;
26 
27  vec.destroy();
28  return s;
29 }
30 
31 ///////////////////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 //=============================================================================
36 inline void _zrovector::write(const char* filename) const
37 {CPPL_VERBOSE_REPORT;
38  std::ofstream ofs(filename, std::ios::trunc);
39  ofs.setf(std::cout.flags());
40  ofs.precision(std::cout.precision());
41  ofs.width(std::cout.width());
42  ofs.fill(std::cout.fill());
43 
44  ofs << "#zrovector" << " " << l << std::endl;
45  for(CPPL_INT i=0; i<l; i++){
46  ofs << operator()(i) << " ";
47  }
48  ofs << std::endl;
49 
50  ofs.close();
51  destroy();
52 }
void write(const char *) const
comple & operator()(const CPPL_INT &) const
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT l
vector size
Definition: _zrovector.hpp:9
std::ostream & operator<<(std::ostream &s, const _zrovector &vec)
(DO NOT USE) Smart-temporary Complex Double-precision Row Vector Class
Definition: _zrovector.hpp:3
comple * array
1D array to store vector data
Definition: _zrovector.hpp:10