DLIB C++如何制作DLIB::矩阵的std::向量
DLIB C++ how to make an std::vector of dlib::matrix
我需要dlib::matrix
的std::vector
,但在编译时我不知道矩阵大小;文档告诉我:
// (Note that if you don't know the dimensionality of your vectors at compile time
// you can change the 2 to a 0 and then set the size at runtime)
typedef matrix<double,2,1> sample_type;
好的,但我需要这个对象的std::vector
,那么我必须在std::vector
上设置什么模板参数?示例(get_dimensionality()
给了我正确的维度(:
matrix<double,0,1> m;
m.set_size(get_dimensionality(),1);
std::vector<matrix<double,????????,1> v;
v.push_back(m);
????????
的号码是多少?
您的问题已经得到了答案。将矢量用作
std::vector<matrix<double, 0, 1> v;
因此,您可以在运行时设置每个元素的大小,就像处理矩阵本身一样。
相关文章:
- 使用std::multimap迭代器创建std::list
- C++中std::resize(n)和std::shrink_to_fit之间的区别
- 来自 std::list 的迭代器 .end() 按预期返回"0xcdcdcdcdcdcdcdcd"但 .begin()
- C++17复制构造函数,在std::unordereded_map上进行深度复制
- 如何导出包含具有"std::unique_ptr"值的"std::map"属性的
- 从持续时间构造std::chrono::system_clock::time_point
- std::具有相同基类的类的变体
- std::向量与传递值的动态数组
- 使用std::vector的OpenCL矩阵乘法
- std::map<struct,struct>::find 找不到匹配项,但是如果我循环通过 begin() 到 end(),我在那里看到匹配项
- std::condition_variable::wait()如何评估给定的谓词
- 如何获取std::result_of函数的返回类型
- std::原子加载和存储都需要吗
- 将对象移动到std::shared_ptr
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- POCO::PostgreSQL:如何将std::vector支持添加到`Binder::bind`
- 使用一个考虑到std::map中键值的滚动或换行的键
- 为什么我不能将 dlib 中的matrix_exp分配给 std::vector?
- DLIB C++如何制作DLIB::矩阵的std::向量
- 如何将dlib中的矩阵转换为std::向量