mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +00:00
Eigen tests: '2*' functions for col-, row-vectors
This commit is contained in:
parent
3b48482f02
commit
b063e64b19
@ -10,6 +10,12 @@
|
||||
#include "example.h"
|
||||
#include <pybind11/eigen.h>
|
||||
|
||||
Eigen::VectorXf double_col(const Eigen::VectorXf& x)
|
||||
{ return 2.0f * x; }
|
||||
|
||||
Eigen::RowVectorXf double_row(const Eigen::RowVectorXf& x)
|
||||
{ return 2.0f * x; }
|
||||
|
||||
void init_eigen(py::module &m) {
|
||||
typedef Eigen::Matrix<float, 5, 6, Eigen::RowMajor> FixedMatrixR;
|
||||
typedef Eigen::Matrix<float, 5, 6> FixedMatrixC;
|
||||
@ -23,6 +29,9 @@ void init_eigen(py::module &m) {
|
||||
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, 0, 8, 11;
|
||||
|
||||
m.def("double_col", &double_col);
|
||||
m.def("double_row", &double_row);
|
||||
|
||||
m.def("fixed_r", [mat]() -> FixedMatrixR {
|
||||
return FixedMatrixR(mat);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user