c++ - 如何在 Pybind11 中使用 Eigen
问题描述
问题描述
我有一个简单的功能
void test2(Eigen::Matrix4f& mat){
std::cout << mat << std::endl;
}
在我的 Python 代码中,我这样做了
pylc.test2(np.ones((4,4), dtype=np.float32))
但它崩溃了
TypeError: test2(): incompatible function arguments. The following argument types are supported:
1. (arg0: Eigen::Matrix<float, 4, 4, 0, 4, 4>) -> None
Invoked with: array([[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.]], dtype=float32)
我做错什么了
解决方案
include <pybind11/eigen.h>
我忘了放这个。。
推荐阅读
- c# - 我从 SQL Server 获得的 ElasticSearch 索引数据
- c# - 更改表页面时的 C# System.Web.HttpUnhandledExcpetion
- iso8583 - ISO 8583 消息数字(以字节为单位)
- mysql - 如何使用 mysql join 执行此查询?
- excel - 使对象在VBA中向上增长
- swift - 在 SceneKit 中检测对象的子节点上的触摸
- python - Django项目给我TypeError:combine()在部署时最多接受2个参数(3个给定)
- ansible - Ansible bigip_command 模块
- java - Jhipster Prod 构建失败
- php - 如何在 Laravel 中为帖子创建描述性文本?