首页 > 解决方案 > 是否可以在 cython 中声明一个指向具有特定大小的浮点的指针向量?

问题描述

基本上我有一个向量定义如下:

cdef vector[float*] x_sets

我现在决定我想用一个特定的大小来做,这样我就可以将每个集合的向量分配给 x_sets 中的一个指针。当我尝试以下操作时:

cdef vector[float*] x_sets = new vector[float*](num_sets)

我得到一个错误cannot assign type vector[float*] to vector[float*]

编辑:为了获得更多背景知识,我基本上是在尝试将多个数据集传递给一些 c++ 代码,并且在 c++ 代码中,它们存储在一个浮点**中,对于 x 集和 ys_list 分别称为 xs_list 和 y_sets。

标签: pointersvectorsizecythondeclaration

解决方案


推荐阅读