CPPLapack
 All Classes Files Functions Variables Friends Pages
_zcovector-io.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! operator() for const object */
3 inline comple& _zcovector::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 _zcovector& vec)
23 {CPPL_VERBOSE_REPORT;
24  for(CPPL_INT i=0; i<vec.l; i++){
25  s << " " << vec.array[i] << std::endl;
26  }
27 
28  vec.destroy();
29  return s;
30 }
31 
32 ///////////////////////////////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 //=============================================================================
37 inline void _zcovector::write(const char* filename) const
38 {CPPL_VERBOSE_REPORT;
39  std::ofstream ofs(filename, std::ios::trunc);
40  ofs.setf(std::cout.flags());
41  ofs.precision(std::cout.precision());
42  ofs.width(std::cout.width());
43  ofs.fill(std::cout.fill());
44 
45  ofs << "#zcovector" << " " << l << std::endl;
46  for(CPPL_INT i=0; i<l; i++){
47  ofs << operator()(i) << std::endl;
48  }
49 
50  ofs.close();
51  destroy();
52 }
std::ostream & operator<<(std::ostream &s, const _zcovector &vec)
_dgematrix i(const _dgbmatrix &mat)
void destroy() const
comple * array
1D array to store vector data
Definition: _zcovector.hpp:10
comple & operator()(const CPPL_INT &) const
(DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class
Definition: _zcovector.hpp:3
CPPL_INT l
vector size
Definition: _zcovector.hpp:9
void write(const char *) const