CPPLapack
 All Classes Files Functions Variables Friends
_drovector-io.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! operator() for const object */
00003 inline double& _drovector::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 _drovector& vec)
00023 {VERBOSE_REPORT;
00024   for(long i=0; i<vec.l; i++){ s << " " << vec.array[i]; }
00025   s << std::endl;
00026   
00027   vec.destroy();
00028   return s;
00029 }
00030 
00031 ///////////////////////////////////////////////////////////////////////////////
00032 ///////////////////////////////////////////////////////////////////////////////
00033 ///////////////////////////////////////////////////////////////////////////////
00034 
00035 //=============================================================================
00036 inline void _drovector::write(const char* filename) const
00037 {VERBOSE_REPORT;
00038   std::ofstream ofs(filename, std::ios::trunc);
00039   ofs.setf(std::cout.flags());
00040   ofs.precision(std::cout.precision());
00041   ofs.width(std::cout.width());
00042   ofs.fill(std::cout.fill());
00043   
00044   ofs << "#drovector" << " " << l << std::endl;
00045   for(long i=0; i<l; i++){
00046     ofs << operator()(i) << " ";
00047   }
00048   ofs << std::endl;
00049   
00050   ofs.close();
00051   destroy();
00052 }
 All Classes Files Functions Variables Friends