CPPLapack
 All Classes Files Functions Variables Friends
_dcovector-io.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! operator() for const object */
00003 inline double& _dcovector::operator()(const long& i) const
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if( i<0 || l<=i ){
00007     ERROR_REPORT;
00008     std::cerr << "The required component is out of the vector size." << std::endl
00009               << "Your input was (" << i << ")." << std::endl;
00010     exit(1);
00011   }
00012 #endif//CPPL_DEBUG
00013   
00014   return array[i];
00015 }
00016 
00017 ///////////////////////////////////////////////////////////////////////////////
00018 ///////////////////////////////////////////////////////////////////////////////
00019 ///////////////////////////////////////////////////////////////////////////////
00020 
00021 //=============================================================================
00022 inline std::ostream& operator<<(std::ostream& s, const _dcovector& vec)
00023 {VERBOSE_REPORT;
00024   for(long i=0; i<vec.l; i++){
00025     s << " " << vec.array[i] << std::endl;
00026   }
00027   
00028   vec.destroy();
00029   return s;
00030 }
00031 
00032 ///////////////////////////////////////////////////////////////////////////////
00033 ///////////////////////////////////////////////////////////////////////////////
00034 ///////////////////////////////////////////////////////////////////////////////
00035 
00036 //=============================================================================
00037 inline void _dcovector::write(const char *filename) const
00038 {VERBOSE_REPORT;
00039   std::ofstream ofs(filename, std::ios::trunc);
00040   ofs.setf(std::cout.flags());
00041   ofs.precision(std::cout.precision());
00042   ofs.width(std::cout.width());
00043   ofs.fill(std::cout.fill());
00044   
00045   ofs << "#dcovector" << " " << l << std::endl;
00046   for(long i=0; i<l; i++){
00047     ofs << operator()(i) << std::endl;
00048   }
00049   
00050   ofs.close();
00051   destroy();
00052 }
 All Classes Files Functions Variables Friends