问题描述
在 Eigen
文档中,我看到了很多这样的东西:
In the Eigen
documentation I see a lot of these:
Array (const Scalar &val0, const Scalar &val1)
Array (const Scalar &val0, const Scalar &val1, const Scalar &val2)
Array (const Scalar &val0, const Scalar &val1, const Scalar &val2, const Scalar &val3)
文档()这些构造函数用给定的系数构造初始化的 N
D向量。
According to the documentation (http://eigen.tuxfamily.org/dox/classEigen_1_1Array.html) these constructors "constructs an initialized N
D vector with given coefficients".
这是什么意思?如果我做Array(1,2,3),结果是什么?
What does that mean? If I do Array(1,2,3), what is the result?
具体来说,它在每个维度上放置什么系数,数组在其中有多大这些尺寸各不相同?根据文档,构造函数 Array(1,2,3)
应该构造一个3D数组,并使用给定系数初始化其内容。结果应如何显示?
Specifically, what coefficients does it place in each dimension, and how large is the array in each of those respective dimensions? The constructor Array(1,2,3)
, according to the docs, should construct an 3D array, and initialise its contents with "the given coefficients". How should the result look?
推荐答案
构造函数用于固定大小的数组。假设声明为 Eigen :: Array3i
,则您提到的构造函数将初始化一个一维int数组,并将三个元素初始化为所述值。
The constructors are for fixed sized Arrays. Assuming the declaration is Eigen::Array3i
then the constructor you mentioned initializes a 1D int array with three elements initialized to the stated values.
这篇关于初始化的Array构造函数做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!