gpt4 book ai didi

c++ - 如何编写一个接受不同大小的特征矩阵的 std::vector 的函数?

转载 作者:行者123 更新时间:2023-11-28 06:52:07 27 4
gpt4 key购买 nike

我想写一个这样的函数:

void do_sth(const std::vector<Eigen::Matrix2d> >&); //http://eigen.tuxfamily.org

但它应该适用于不同的矩阵大小,例如Matrix4d.

即使读了这个我也想不通: http://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html

有人可以帮忙吗?

最佳答案

你可以使用类似的东西:

template <std::size_t W, std::size_t H>
void do_sth(const std::vector<Eigen::Matrix<double, W, H>>&);

关于c++ - 如何编写一个接受不同大小的特征矩阵的 std::vector 的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23758885/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com