Esempio n. 1
0
	static scalar_type ir(int row, int col, const matrix_type& m)
	{
		BOOST_ASSERT(row >= 0);
		BOOST_ASSERT(row < rows);
		BOOST_ASSERT(col >= 0);
		BOOST_ASSERT(col < cols);
		return m.at(col, row);
	}
Esempio n. 2
0
	static scalar_type r(const matrix_type& m)
	{
		BOOST_STATIC_ASSERT(Row >= 0);
		BOOST_STATIC_ASSERT(Row < rows);
		BOOST_STATIC_ASSERT(Col >= 0);
		BOOST_STATIC_ASSERT(Col < cols);
		return m.at(Col, Row);
	}
void fill_from_file(matrix_type& tens, const std::string& str)
{
   std::ifstream ifs(str);
   for(int j = 0 ; j < tens.extent<1>(); ++j)
      for(int i = 0 ; i < tens.extent<0>(); ++i)
   {
      ifs >> tens.at(i,j);
   }
}
void print(const matrix_type& mat, const std::string& str)
{
   std::ofstream of(str);
   of << std::showpos;
   using limit_type = std::numeric_limits<typename matrix_type::value_type>;
   of << std::scientific;
   of << std::setprecision(limit_type::max_digits10);
   for(int j = 0 ; j < mat.extent<1>(); ++j)
      for(int i = 0 ; i < mat.extent<0>(); ++i)
   {
      of << mat.at(i,j) << std::endl;
   }
}