Verified Commit e2ab314e authored by Justin Carpentier's avatar Justin Carpentier
Browse files

test: fix

parent 90cf65ca
Pipeline #18403 passed with stage
in 2 minutes and 14 seconds
......@@ -42,8 +42,13 @@ Eigen::Ref<MatType> editBlock(Eigen::Ref<MatType> mat, Eigen::DenseIndex i,
Eigen::DenseIndex j, Eigen::DenseIndex n,
Eigen::DenseIndex m) {
typename Eigen::Ref<MatType>::BlockXpr B = mat.block(i, j, n, m);
Eigen::Map<VectorXd> view(B.data(), B.size());
view.setLinSpaced(0., (double)view.size() - 1.);
int k = 0;
for (int i = 0; i < B.rows(); ++i) {
for (int j = 0; j < B.cols(); ++j) {
B(i, j) = k++;
}
}
std::cout << "B:\n" << B << std::endl;
return mat;
}
......
......@@ -22,7 +22,6 @@ def test(mat):
assert np.all(ref == mat)
const_ref = asConstRef(mat)
# import pdb; pdb.set_trace()
assert np.all(const_ref == mat)
mat.fill(0.0)
......@@ -37,11 +36,12 @@ def test(mat):
mat.fill(0.0)
mat_as_C_order = np.array(mat, order="F")
mat_copy = mat_as_C_order.copy()
getBlock(mat_as_C_order, 0, 0, 3, 2)[:, :] = 1.0
assert np.all(mat_as_C_order[:3, :2] == np.ones((3, 2)))
mat_as_C_order[:3, :2] = 0.0
mat_copy = mat_as_C_order.copy()
editBlock(mat_as_C_order, 0, 0, 3, 2)
mat_copy[:3, :2] = np.arange(6).reshape(3, 2)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment