test_eigen_matrix.cpp
Go to the documentation of this file.
1 /*
2  tests/eigen.cpp -- automatic conversion of Eigen types
3 
4  Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
5 
6  All rights reserved. Use of this source code is governed by a
7  BSD-style license that can be found in the LICENSE file.
8 */
9 
10 #include <pybind11/eigen/matrix.h>
11 #include <pybind11/stl.h>
12 
13 #include "constructor_stats.h"
14 #include "pybind11_tests.h"
15 
17 
18 #include <Eigen/Cholesky>
19 
21 
22 // Sets/resets a testing reference matrix to have values of 10*r + c, where r and c are the
23 // (1-based) row/column number.
24 template <typename M>
25 void reset_ref(M &x) {
26  for (int i = 0; i < x.rows(); i++) {
27  for (int j = 0; j < x.cols(); j++) {
28  x(i, j) = 11 + 10 * i + j;
29  }
30  }
31 }
32 
33 // Returns a static, column-major matrix
34 Eigen::MatrixXd &get_cm() {
35  static Eigen::MatrixXd *x;
36  if (!x) {
37  x = new Eigen::MatrixXd(3, 3);
38  reset_ref(*x);
39  }
40  return *x;
41 }
42 // Likewise, but row-major
44  static MatrixXdR *x;
45  if (!x) {
46  x = new MatrixXdR(3, 3);
47  reset_ref(*x);
48  }
49  return *x;
50 }
51 // Resets the values of the static matrices returned by get_cm()/get_rm()
52 void reset_refs() {
53  reset_ref(get_cm());
54  reset_ref(get_rm());
55 }
56 
57 // Returns element 2,1 from a matrix (used to test copy/nocopy)
58 double get_elem(const Eigen::Ref<const Eigen::MatrixXd> &m) { return m(2, 1); };
59 
60 // Returns a matrix with 10*r + 100*c added to each matrix element (to help test that the matrix
61 // reference is referencing rows/columns correctly).
62 template <typename MatrixArgType>
63 Eigen::MatrixXd adjust_matrix(MatrixArgType m) {
64  Eigen::MatrixXd ret(m);
65  for (int c = 0; c < m.cols(); c++) {
66  for (int r = 0; r < m.rows(); r++) {
67  ret(r, c) += 10 * r + 100 * c; // NOLINT(clang-analyzer-core.uninitialized.Assign)
68  }
69  }
70  return ret;
71 }
72 
73 struct CustomOperatorNew {
74  CustomOperatorNew() = default;
75 
76  Eigen::Matrix4d a = Eigen::Matrix4d::Zero();
77  Eigen::Matrix4d b = Eigen::Matrix4d::Identity();
78 
80 };
81 
82 TEST_SUBMODULE(eigen_matrix, m) {
84  using FixedMatrixC = Eigen::Matrix<float, 5, 6>;
87  using FourRowMatrixC = Eigen::Matrix<float, 4, Eigen::Dynamic>;
88  using FourColMatrixC = Eigen::Matrix<float, Eigen::Dynamic, 4>;
89  using FourRowMatrixR = Eigen::Matrix<float, 4, Eigen::Dynamic>;
90  using FourColMatrixR = Eigen::Matrix<float, Eigen::Dynamic, 4>;
91  using SparseMatrixR = Eigen::SparseMatrix<float, Eigen::RowMajor>;
92  using SparseMatrixC = Eigen::SparseMatrix<float>;
93 
94  // various tests
95  m.def("double_col", [](const Eigen::VectorXf &x) -> Eigen::VectorXf { return 2.0f * x; });
96  m.def("double_row",
97  [](const Eigen::RowVectorXf &x) -> Eigen::RowVectorXf { return 2.0f * x; });
98  m.def("double_complex",
99  [](const Eigen::VectorXcf &x) -> Eigen::VectorXcf { return 2.0f * x; });
100  m.def("double_threec", [](py::EigenDRef<Eigen::Vector3f> x) { x *= 2; });
101  m.def("double_threer", [](py::EigenDRef<Eigen::RowVector3f> x) { x *= 2; });
102  m.def("double_mat_cm", [](const Eigen::MatrixXf &x) -> Eigen::MatrixXf { return 2.0f * x; });
103  m.def("double_mat_rm", [](const DenseMatrixR &x) -> DenseMatrixR { return 2.0f * x; });
104 
105  // test_eigen_ref_to_python
106  // Different ways of passing via Eigen::Ref; the first and second are the Eigen-recommended
107  m.def("cholesky1",
108  [](const Eigen::Ref<MatrixXdR> &x) -> Eigen::MatrixXd { return x.llt().matrixL(); });
109  m.def("cholesky2", [](const Eigen::Ref<const MatrixXdR> &x) -> Eigen::MatrixXd {
110  return x.llt().matrixL();
111  });
112  m.def("cholesky3",
113  [](const Eigen::Ref<MatrixXdR> &x) -> Eigen::MatrixXd { return x.llt().matrixL(); });
114  m.def("cholesky4", [](const Eigen::Ref<const MatrixXdR> &x) -> Eigen::MatrixXd {
115  return x.llt().matrixL();
116  });
117 
118  // test_eigen_ref_mutators
119  // Mutators: these add some value to the given element using Eigen, but Eigen should be mapping
120  // into the numpy array data and so the result should show up there. There are three versions:
121  // one that works on a contiguous-row matrix (numpy's default), one for a contiguous-column
122  // matrix, and one for any matrix.
123  auto add_rm = [](Eigen::Ref<MatrixXdR> x, int r, int c, double v) { x(r, c) += v; };
124  auto add_cm = [](Eigen::Ref<Eigen::MatrixXd> x, int r, int c, double v) { x(r, c) += v; };
125 
126  // Mutators (Eigen maps into numpy variables):
127  m.def("add_rm", add_rm); // Only takes row-contiguous
128  m.def("add_cm", add_cm); // Only takes column-contiguous
129  // Overloaded versions that will accept either row or column contiguous:
130  m.def("add1", add_rm);
131  m.def("add1", add_cm);
132  m.def("add2", add_cm);
133  m.def("add2", add_rm);
134  // This one accepts a matrix of any stride:
135  m.def("add_any",
136  [](py::EigenDRef<Eigen::MatrixXd> x, int r, int c, double v) { x(r, c) += v; });
137 
138  // Return mutable references (numpy maps into eigen variables)
139  m.def("get_cm_ref", []() { return Eigen::Ref<Eigen::MatrixXd>(get_cm()); });
140  m.def("get_rm_ref", []() { return Eigen::Ref<MatrixXdR>(get_rm()); });
141  // The same references, but non-mutable (numpy maps into eigen variables, but is !writeable)
142  m.def("get_cm_const_ref", []() { return Eigen::Ref<const Eigen::MatrixXd>(get_cm()); });
143  m.def("get_rm_const_ref", []() { return Eigen::Ref<const MatrixXdR>(get_rm()); });
144 
145  m.def("reset_refs", reset_refs); // Restores get_{cm,rm}_ref to original values
146 
147  // Increments and returns ref to (same) matrix
148  m.def(
149  "incr_matrix",
150  [](Eigen::Ref<Eigen::MatrixXd> m, double v) {
151  m += Eigen::MatrixXd::Constant(m.rows(), m.cols(), v);
152  return m;
153  },
154  py::return_value_policy::reference);
155 
156  // Same, but accepts a matrix of any strides
157  m.def(
158  "incr_matrix_any",
159  [](py::EigenDRef<Eigen::MatrixXd> m, double v) {
160  m += Eigen::MatrixXd::Constant(m.rows(), m.cols(), v);
161  return m;
162  },
163  py::return_value_policy::reference);
164 
165  // Returns an eigen slice of even rows
166  m.def(
167  "even_rows",
168  [](py::EigenDRef<Eigen::MatrixXd> m) {
169  return py::EigenDMap<Eigen::MatrixXd>(
170  m.data(),
171  (m.rows() + 1) / 2,
172  m.cols(),
173  py::EigenDStride(m.outerStride(), 2 * m.innerStride()));
174  },
175  py::return_value_policy::reference);
176 
177  // Returns an eigen slice of even columns
178  m.def(
179  "even_cols",
180  [](py::EigenDRef<Eigen::MatrixXd> m) {
181  return py::EigenDMap<Eigen::MatrixXd>(
182  m.data(),
183  m.rows(),
184  (m.cols() + 1) / 2,
185  py::EigenDStride(2 * m.outerStride(), m.innerStride()));
186  },
187  py::return_value_policy::reference);
188 
189  // Returns diagonals: a vector-like object with an inner stride != 1
190  m.def("diagonal", [](const Eigen::Ref<const Eigen::MatrixXd> &x) { return x.diagonal(); });
191  m.def("diagonal_1",
192  [](const Eigen::Ref<const Eigen::MatrixXd> &x) { return x.diagonal<1>(); });
193  m.def("diagonal_n",
194  [](const Eigen::Ref<const Eigen::MatrixXd> &x, int index) { return x.diagonal(index); });
195 
196  // Return a block of a matrix (gives non-standard strides)
197  m.def("block",
198  [m](const py::object &x_obj,
199  int start_row,
200  int start_col,
201  int block_rows,
202  int block_cols) {
203  return m.attr("_block")(x_obj, x_obj, start_row, start_col, block_rows, block_cols);
204  });
205 
206  m.def(
207  "_block",
208  [](const py::object &x_obj,
210  int start_row,
211  int start_col,
212  int block_rows,
213  int block_cols) {
214  // See PR #4217 for background. This test is a bit over the top, but might be useful
215  // as a concrete example to point to when explaining the dangling reference trap.
216  auto i0 = py::make_tuple(0, 0);
217  auto x0_orig = x_obj[*i0].cast<double>();
218  if (x(0, 0) != x0_orig) {
219  throw std::runtime_error(
220  "Something in the type_caster for Eigen::Ref is terribly wrong.");
221  }
222  double x0_mod = x0_orig + 1;
223  x_obj[*i0] = x0_mod;
224  auto copy_detected = (x(0, 0) != x0_mod);
225  x_obj[*i0] = x0_orig;
226  if (copy_detected) {
227  throw std::runtime_error("type_caster for Eigen::Ref made a copy.");
228  }
229  return x.block(start_row, start_col, block_rows, block_cols);
230  },
231  py::keep_alive<0, 1>());
232 
233  // test_eigen_return_references, test_eigen_keepalive
234  // return value referencing/copying tests:
235  class ReturnTester {
236  Eigen::MatrixXd mat = create();
237 
238  public:
239  ReturnTester() { print_created(this); }
240  ~ReturnTester() { print_destroyed(this); }
241  static Eigen::MatrixXd create() { return Eigen::MatrixXd::Ones(10, 10); }
242  // NOLINTNEXTLINE(readability-const-return-type)
243  static const Eigen::MatrixXd createConst() { return Eigen::MatrixXd::Ones(10, 10); }
244  Eigen::MatrixXd &get() { return mat; }
245  Eigen::MatrixXd *getPtr() { return &mat; }
246  const Eigen::MatrixXd &view() { return mat; }
247  const Eigen::MatrixXd *viewPtr() { return &mat; }
248  Eigen::Ref<Eigen::MatrixXd> ref() { return mat; }
249  Eigen::Ref<const Eigen::MatrixXd> refConst() { return mat; }
250  Eigen::Block<Eigen::MatrixXd> block(int r, int c, int nrow, int ncol) {
251  return mat.block(r, c, nrow, ncol);
252  }
253  Eigen::Block<const Eigen::MatrixXd> blockConst(int r, int c, int nrow, int ncol) const {
254  return mat.block(r, c, nrow, ncol);
255  }
256  py::EigenDMap<Eigen::Matrix2d> corners() {
257  return py::EigenDMap<Eigen::Matrix2d>(
258  mat.data(),
259  py::EigenDStride(mat.outerStride() * (mat.outerSize() - 1),
260  mat.innerStride() * (mat.innerSize() - 1)));
261  }
262  py::EigenDMap<const Eigen::Matrix2d> cornersConst() const {
263  return py::EigenDMap<const Eigen::Matrix2d>(
264  mat.data(),
265  py::EigenDStride(mat.outerStride() * (mat.outerSize() - 1),
266  mat.innerStride() * (mat.innerSize() - 1)));
267  }
268  };
269  using rvp = py::return_value_policy;
270  py::class_<ReturnTester>(m, "ReturnTester")
271  .def(py::init<>())
272  .def_static("create", &ReturnTester::create)
273  .def_static("create_const", &ReturnTester::createConst)
274  .def("get", &ReturnTester::get, rvp::reference_internal)
275  .def("get_ptr", &ReturnTester::getPtr, rvp::reference_internal)
276  .def("view", &ReturnTester::view, rvp::reference_internal)
277  .def("view_ptr", &ReturnTester::view, rvp::reference_internal)
278  .def("copy_get", &ReturnTester::get) // Default rvp: copy
279  .def("copy_view", &ReturnTester::view) // "
280  .def("ref", &ReturnTester::ref) // Default for Ref is to reference
281  .def("ref_const", &ReturnTester::refConst) // Likewise, but const
282  .def("ref_safe", &ReturnTester::ref, rvp::reference_internal)
283  .def("ref_const_safe", &ReturnTester::refConst, rvp::reference_internal)
284  .def("copy_ref", &ReturnTester::ref, rvp::copy)
285  .def("copy_ref_const", &ReturnTester::refConst, rvp::copy)
286  .def("block", &ReturnTester::block)
287  .def("block_safe", &ReturnTester::block, rvp::reference_internal)
288  .def("block_const", &ReturnTester::blockConst, rvp::reference_internal)
289  .def("copy_block", &ReturnTester::block, rvp::copy)
290  .def("corners", &ReturnTester::corners, rvp::reference_internal)
291  .def("corners_const", &ReturnTester::cornersConst, rvp::reference_internal);
292 
293  // test_special_matrix_objects
294  // Returns a DiagonalMatrix with diagonal (1,2,3,...)
295  m.def("incr_diag", [](int k) {
297  for (int i = 0; i < k; i++) {
298  m.diagonal()[i] = i + 1;
299  }
300  return m;
301  });
302 
303  // Returns a SelfAdjointView referencing the lower triangle of m
304  m.def("symmetric_lower",
305  [](const Eigen::MatrixXi &m) { return m.selfadjointView<Eigen::Lower>(); });
306  // Returns a SelfAdjointView referencing the lower triangle of m
307  m.def("symmetric_upper",
308  [](const Eigen::MatrixXi &m) { return m.selfadjointView<Eigen::Upper>(); });
309 
310  // Test matrix for various functions below.
311  Eigen::MatrixXf mat(5, 6);
312  mat << 0, 3, 0, 0, 0, 11, 22, 0, 0, 0, 17, 11, 7, 5, 0, 1, 0, 11, 0, 0, 0, 0, 0, 11, 0, 0, 14,
313  0, 8, 11;
314 
315  // test_fixed, and various other tests
316  m.def("fixed_r", [mat]() -> FixedMatrixR { return FixedMatrixR(mat); });
317  // Our Eigen does a hack which respects constness through the numpy writeable flag.
318  // Therefore, the const return actually affects this type despite being an rvalue.
319  // NOLINTNEXTLINE(readability-const-return-type)
320  m.def("fixed_r_const", [mat]() -> const FixedMatrixR { return FixedMatrixR(mat); });
321  m.def("fixed_c", [mat]() -> FixedMatrixC { return FixedMatrixC(mat); });
322  m.def("fixed_copy_r", [](const FixedMatrixR &m) -> FixedMatrixR { return m; });
323  m.def("fixed_copy_c", [](const FixedMatrixC &m) -> FixedMatrixC { return m; });
324  // test_mutator_descriptors
325  m.def("fixed_mutator_r", [](const Eigen::Ref<FixedMatrixR> &) {});
326  m.def("fixed_mutator_c", [](const Eigen::Ref<FixedMatrixC> &) {});
327  m.def("fixed_mutator_a", [](const py::EigenDRef<FixedMatrixC> &) {});
328  // test_dense
329  m.def("dense_r", [mat]() -> DenseMatrixR { return DenseMatrixR(mat); });
330  m.def("dense_c", [mat]() -> DenseMatrixC { return DenseMatrixC(mat); });
331  m.def("dense_copy_r", [](const DenseMatrixR &m) -> DenseMatrixR { return m; });
332  m.def("dense_copy_c", [](const DenseMatrixC &m) -> DenseMatrixC { return m; });
333  // test_defaults
334  bool have_numpy = true;
335  try {
336  py::module_::import("numpy");
337  } catch (const py::error_already_set &) {
338  have_numpy = false;
339  }
340  if (have_numpy) {
341  py::module_::import("numpy");
342  Eigen::Matrix<double, 3, 3> defaultMatrix = Eigen::Matrix3d::Identity();
343  m.def("defaults_mat", [](const Eigen::Matrix3d &) {}, py::arg("mat") = defaultMatrix);
344 
345  Eigen::VectorXd defaultVector = Eigen::VectorXd::Ones(32);
346  m.def("defaults_vec", [](const Eigen::VectorXd &) {}, py::arg("vec") = defaultMatrix);
347  }
348  // test_sparse, test_sparse_signature
349  m.def("sparse_r", [mat]() -> SparseMatrixR {
350  // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn)
352  });
353  m.def("sparse_c",
354  [mat]() -> SparseMatrixC { return Eigen::SparseView<Eigen::MatrixXf>(mat); });
355  m.def("sparse_copy_r", [](const SparseMatrixR &m) -> SparseMatrixR { return m; });
356  m.def("sparse_copy_c", [](const SparseMatrixC &m) -> SparseMatrixC { return m; });
357  // test_partially_fixed
358  m.def("partial_copy_four_rm_r", [](const FourRowMatrixR &m) -> FourRowMatrixR { return m; });
359  m.def("partial_copy_four_rm_c", [](const FourColMatrixR &m) -> FourColMatrixR { return m; });
360  m.def("partial_copy_four_cm_r", [](const FourRowMatrixC &m) -> FourRowMatrixC { return m; });
361  m.def("partial_copy_four_cm_c", [](const FourColMatrixC &m) -> FourColMatrixC { return m; });
362 
363  // test_cpp_casting
364  // Test that we can cast a numpy object to a Eigen::MatrixXd explicitly
365  m.def("cpp_copy", [](py::handle m) { return m.cast<Eigen::MatrixXd>()(1, 0); });
366  m.def("cpp_ref_c", [](py::handle m) { return m.cast<Eigen::Ref<Eigen::MatrixXd>>()(1, 0); });
367  m.def("cpp_ref_r", [](py::handle m) { return m.cast<Eigen::Ref<MatrixXdR>>()(1, 0); });
368  m.def("cpp_ref_any",
369  [](py::handle m) { return m.cast<py::EigenDRef<Eigen::MatrixXd>>()(1, 0); });
370 
371  // [workaround(intel)] ICC 20/21 breaks with py::arg().stuff, using py::arg{}.stuff works.
372 
373  // test_nocopy_wrapper
374  // Test that we can prevent copying into an argument that would normally copy: First a version
375  // that would allow copying (if types or strides don't match) for comparison:
376  m.def("get_elem", &get_elem);
377  // Now this alternative that calls the tells pybind to fail rather than copy:
378  m.def(
379  "get_elem_nocopy",
380  [](const Eigen::Ref<const Eigen::MatrixXd> &m) -> double { return get_elem(m); },
381  py::arg{}.noconvert());
382  // Also test a row-major-only no-copy const ref:
383  m.def(
384  "get_elem_rm_nocopy",
386  return m(2, 1);
387  },
388  py::arg{}.noconvert());
389 
390  // test_issue738, test_zero_length
391  // Issue #738: 1×N or N×1 2D matrices were neither accepted nor properly copied with an
392  // incompatible stride value on the length-1 dimension--but that should be allowed (without
393  // requiring a copy!) because the stride value can be safely ignored on a size-1 dimension.
394  // Similarly, 0×N or N×0 matrices were not accepted--again, these should be allowed since
395  // they contain no data. This particularly affects numpy ≥ 1.23, which sets the strides to
396  // 0 if any dimension size is 0.
397  m.def("iss738_f1",
399  py::arg{}.noconvert());
400  m.def("iss738_f2",
402  py::arg{}.noconvert());
403 
404  // test_issue1105
405  // Issue #1105: when converting from a numpy two-dimensional (Nx1) or (1xN) value into a dense
406  // eigen Vector or RowVector, the argument would fail to load because the numpy copy would
407  // fail: numpy won't broadcast a Nx1 into a 1-dimensional vector.
408  m.def("iss1105_col", [](const Eigen::VectorXd &) { return true; });
409  m.def("iss1105_row", [](const Eigen::RowVectorXd &) { return true; });
410 
411  // test_named_arguments
412  // Make sure named arguments are working properly:
413  m.def(
414  "matrix_multiply",
415  [](const py::EigenDRef<const Eigen::MatrixXd> &A,
416  const py::EigenDRef<const Eigen::MatrixXd> &B) -> Eigen::MatrixXd {
417  if (A.cols() != B.rows()) {
418  throw std::domain_error("Nonconformable matrices!");
419  }
420  return A * B;
421  },
422  py::arg("A"),
423  py::arg("B"));
424 
425  // test_custom_operator_new
426  py::class_<CustomOperatorNew>(m, "CustomOperatorNew")
427  .def(py::init<>())
428  .def_readonly("a", &CustomOperatorNew::a)
429  .def_readonly("b", &CustomOperatorNew::b);
430 
431  // test_eigen_ref_life_support
432  // In case of a failure (the caster's temp array does not live long enough), creating
433  // a new array (np.ones(10)) increases the chances that the temp array will be garbage
434  // collected and/or that its memory will be overridden with different values.
435  m.def("get_elem_direct", [](const Eigen::Ref<const Eigen::VectorXd> &v) {
436  py::module_::import("numpy").attr("ones")(10);
437  return v(5);
438  });
439  m.def("get_elem_indirect", [](std::vector<Eigen::Ref<const Eigen::VectorXd>> v) {
440  py::module_::import("numpy").attr("ones")(10);
441  return v[0](5);
442  });
443 }
create
ADT create(const Signature &signature)
Definition: testAlgebraicDecisionTree.cpp:136
Eigen::SparseMatrix
A versatible sparse matrix representation.
Definition: SparseMatrix.h:96
B
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:49
Eigen::DiagonalMatrix
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:140
get_rm
MatrixXdR & get_rm()
Definition: test_eigen_matrix.cpp:43
Eigen::Block
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
return_value_policy
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
Definition: wrap/pybind11/include/pybind11/detail/common.h:499
reset_ref
void reset_ref(M &x)
Definition: test_eigen_matrix.cpp:25
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
get_elem
double get_elem(const Eigen::Ref< const Eigen::MatrixXd > &m)
Definition: test_eigen_matrix.cpp:58
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
ret
DenseIndex ret
Definition: level1_cplx_impl.h:44
TEST_SUBMODULE
TEST_SUBMODULE(eigen_matrix, m)
Definition: test_eigen_matrix.cpp:82
stl.h
Eigen::Upper
@ Upper
Definition: Constants.h:211
copy
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_impl.h:29
get_cm
Eigen::MatrixXd & get_cm()
Definition: test_eigen_matrix.cpp:34
mat
MatrixXf mat
Definition: Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
corners
void corners(const MatrixType &m)
Definition: corners.cpp:16
constructor_stats.h
block
m m block(1, 0, 2, 2)<< 4
MatrixXdR
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixXdR
Definition: test_eigen_matrix.cpp:20
A
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:48
view
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set view
Definition: gnuplot_common_settings.hh:27
matrix.h
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
make_tuple
tuple make_tuple()
Definition: cast.h:1383
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
CustomOperatorNew::EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition: test_eigen.cpp:81
arg
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE ArgReturnType arg() const
Definition: ArrayCwiseUnaryOps.h:66
Eigen::Lower
@ Lower
Definition: Constants.h:209
i0
double i0(double x)
Definition: i0.c:149
Eigen::Ref
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:281
adjust_matrix
Eigen::MatrixXd adjust_matrix(MatrixArgType m)
Definition: test_eigen_matrix.cpp:63
CustomOperatorNew::CustomOperatorNew
CustomOperatorNew()=default
reset_refs
void reset_refs()
Definition: test_eigen_matrix.cpp:52
PYBIND11_WARNING_DISABLE_MSVC
PYBIND11_WARNING_PUSH PYBIND11_WARNING_DISABLE_MSVC(5054) PYBIND11_WARNING_POP static_assert(EIGEN_VERSION_AT_LEAST(3
pybind11_tests.h
print_destroyed
void print_destroyed(T *inst, Values &&...values)
Definition: constructor_stats.h:314
Eigen::SparseView
Expression of a dense or sparse matrix with zero or too small values removed.
Definition: ForwardDeclarations.h:124
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
CustomOperatorNew
Definition: test_eigen.cpp:75
CustomOperatorNew::a
Eigen::Matrix4d a
Definition: test_eigen.cpp:78
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
print_created
void print_created(T *inst, Values &&...values)
Definition: constructor_stats.h:309
CustomOperatorNew::b
Eigen::Matrix4d b
Definition: test_eigen.cpp:79
test_eigen.ref
ref
Definition: test_eigen.py:9
M
Matrix< RealScalar, Dynamic, Dynamic > M
Definition: bench_gemm.cpp:51


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:39:27