printmatrix.hpp

来自「This collection of C++ templates wraps t」· HPP 代码 · 共 25 行

HPP
25
字号
/* Pretty printing of a uBLAS matrix.
 *
 * Tim Bailey 2005.
 */

#include <cstdio>

namespace ulapack {
	namespace ublas = boost::numeric::ublas;
	template<class F, class A>
	void print_matrix(const ublas::matrix<double,F,A> &m)
	{
		using namespace std;

		for (size_t i = 0; i < m.size1(); ++i) {
			for (size_t j = 0; j < m.size2(); ++j)
				printf("%9.3g\t", m(i,j));
			printf("\n");
		}
		printf("\n");
	}

} // namespace ulapack

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?