将特征 "Transformation" class 设置为 post/right 乘法的主列

Setting eigen "Transformation" class as column major for post/right multiplication

我有一个函数可以对变换矩阵进行大量 post/right 乘法运算。现在我想将此函数转换为使用 Eigen,问题是 Eigen Transformation class 进行乘法运算 pre/left乘法。这意味着它在乘法时是行矩阵格式,而存储是列矩阵格式。

有没有办法将 Eigen::Transformation class 成员从行专业更改为列专业?

Eigen Matrix class 的完整签名是

Matrix<typename Scalar,
       int RowsAtCompileTime,
       int ColsAtCompileTime,
       int Options = 0,
       int MaxRowsAtCompileTime = RowsAtCompileTime,
       int MaxColsAtCompileTime = ColsAtCompileTime>

第 4 个参数 Optionsdescribed as

Options is a bit field. Here, we discuss only one bit: RowMajor. It specifies that the matrices of this type use row-major storage order; by default, the storage order is column-major. See the page on storage orders. For example, this type means row-major 3x3 matrices

所以你可以说,例如,

Matrix<int, 3, 4, ColMajor> foo;    // column major
Matrix<int, 4, 3, RowMajor> bar;    // row major

More documentation on Storage Orders

如果您指的转换是 Eigen::Transform,这也有一个 Options 模板参数,您也可以传递 RowMajorColMajor。它生成的任何矩阵都将遵循您指定的相同约定。

Transform<typename Scalar,
          int Dim,
          int Mode,
          int _Options = AutoAlign>

同样,_Options 参数被描述为

_Options has the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor. These Options are passed directly to the underlying matrix type.