Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 向量之间的本征差,VectorX,VectorXi_Arrays_Vector_Indexing_Eigen - Fatal编程技术网

Arrays 向量之间的本征差,VectorX,VectorXi

Arrays 向量之间的本征差,VectorX,VectorXi,arrays,vector,indexing,eigen,Arrays,Vector,Indexing,Eigen,上下文 我试图为int找到最佳的一维存储类型。我计划将Eigen::Vector对象用作“索引容器”(即存储表示更大向量的索引的int值),然后对这些“索引容器”进行一些自定义验证。虽然我可以从这个“索引容器”中删除值,但我永远不会向其中添加新值:因此size始终是没有typdefeigent::Vector或eigent::VectorX。这种方便类型定义的格式为Eigen::VectorNt,其中N和t的可能选择如下所述: 方便型 Eigen定义了以下矩阵类型: MatrixNt for M

上下文


我试图为
int
找到最佳的一维存储类型。我计划将Eigen::Vector对象用作“索引容器”(即存储表示更大向量的索引的
int
值),然后对这些“索引容器”进行一些自定义验证。虽然我可以从这个“索引容器”中删除值,但我永远不会向其中添加新值:因此
size
始终是没有typdef
eigent::Vector
eigent::VectorX
。这种方便类型定义的格式为
Eigen::VectorNt
,其中
N
t
的可能选择如下所述:

方便型 Eigen定义了以下矩阵类型:

MatrixNt for Matrix<type, N, N>. For example, MatrixXi for Matrix<int, Dynamic, Dynamic>.
VectorNt for Matrix<type, N, 1>. For example, Vector2f for Matrix<float, 2, 1>.
RowVectorNt for Matrix<type, 1, N>. For example, RowVector3d for Matrix<double, 1, 3>.
矩阵的矩阵NT。例如,MatrixXi表示矩阵。 矩阵的向量。例如,向量2f表示矩阵。 矩阵的行向量。例如,矩阵的RowVector3d。 其中:

N can be any one of 2, 3, 4, or X (meaning Dynamic).
t can be any one of i (meaning int), f (meaning float), d (meaning double), cf (meaning complex<float>), or cd (meaning complex<double>).
N可以是2、3、4或X(表示动态)中的任意一个。
t可以是i(表示int)、f(表示浮点)、d(表示双精度)、cf(表示复数)或cd(表示复数)中的任意一个。
这些都是稠密
特征::矩阵类的变体


对于将引用更大向量的元素的“索引容器”,您的意思并不完全清楚。索引号可以存储在
Eigen::VectorXi
容器中,但可能有更好的选择。如果只需要“索引容器”中列出的那些元素,而大向量的所有其他元素都是零,那么一个。如果您提供一个具体的示例,将更容易提供帮助。

谢谢!我甚至没想到去看矩阵部分。例如,我存储布尔向量的所有为真的索引,例如{true,false,true}={0,2}(索引容器)。
N can be any one of 2, 3, 4, or X (meaning Dynamic).
t can be any one of i (meaning int), f (meaning float), d (meaning double), cf (meaning complex<float>), or cd (meaning complex<double>).