test_eigen_ref.py
Go to the documentation of this file.
1 import numpy as np
2 from eigen_ref import *
3 
4 def test(mat):
5 
6  printMatrix(mat)
7  fill(mat,1.)
8  printMatrix(mat)
9  assert np.array_equal(mat,np.full(mat.shape,1.))
10 
11  A_ref = asRef(mat.shape[0],mat.shape[1])
12  A_ref.fill(1.)
13  A_ref2 = asRef(mat.shape[0],mat.shape[1])
14 
15  assert np.array_equal(A_ref,A_ref2)
16 
17  A_ref2.fill(0)
18  assert np.array_equal(A_ref,A_ref2)
19 
20 
21 rows = 10
22 cols = 30
23 
24 mat = np.array(np.zeros((rows,cols)))
25 
26 test(mat)
Eigen::Ref< MatType > asRef(const int rows, const int cols)
Definition: eigen_ref.cpp:41
void printMatrix(const Eigen::Ref< const MatType > mat)
Definition: eigen_ref.cpp:13
void fill(Eigen::Ref< MatType > mat, const typename MatType::Scalar &value)
Definition: eigen_ref.cpp:35


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59