示例:
Python:
m = np.bmat([[A, B], [C, D]])
<>#include <boost/numeric/ublas/matrix.hpp>
boost::numeric::ublas::matrix m;
//...
r1 = boost::numeric::ublas::range(i1, i2);
r2 = boost::numeric::ublas::range(i3, i4);
boost::numeric::ublas::project(m, r1, r2) = A;
// repeat code above for other submatrices, each time calculating the appropriate indices
结果证明使用Eigen更容易。下面是一个示例程序:
相关问题 更多 >
编程相关推荐