Reputation: 2903
I want to know if getting the scalar type from the array type by ArrayType::Scalar
is documented for the Eigen library.
The following compiles (g++ test.cpp -I<Path to Eigen> -frtti
)
#include <Eigen/Eigen>
#include <typeinfo>
#include <iostream>
int main() {
Eigen::ArrayXf::Scalar i = 0;
std::cout << typeid(i).name() << "\n";
}
Result (float type as expected):
f
That also works for MatrixXf
type.
Upvotes: 4
Views: 3088
Reputation: 2903
Yes. It is documented by doxygen, at least for DenseBase
. I found it when I searched for "scalar" in https://eigen.tuxfamily.org/dox/
template<typename Derived>
typedef internal::traits<Derived>::Scalar Eigen::DenseBase< Derived >::Scalar
The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc.
Upvotes: 4