39 namespace eigen_converter {
46 template <
class T,
int M,
int N,
int A>
49 Eigen::Matrix<T, M, N, Eigen::RowMajor> matrix_row_major = matrix;
50 return core::Tensor(matrix_row_major.data(), {matrix.rows(), matrix.cols()},
59 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
67 Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
75 Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
105 const std::vector<Eigen::Vector3d> &values,
118 const std::vector<Eigen::Vector3i> &values,
core::Tensor EigenVector3iVectorToTensor(const std::vector< Eigen::Vector3i > &values, core::Dtype dtype, const core::Device &device)
Converts a vector of Eigen::Vector3i to a (N, 3) tensor. This function also takes care of dtype conve...
Definition: EigenConverter.cpp:160
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > TensorToEigenMatrixXd(const core::Tensor &tensor)
Converts a 2D Tensor to Eigen::MatrixXd of same shape. Regardless of the tensor dtype, the output will be converted to double.
Definition: EigenConverter.cpp:69
Definition: PinholeCameraIntrinsic.cpp:35
Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > TensorToEigenMatrixXi(const core::Tensor &tensor)
Converts a 2D Tensor to Eigen::MatrixXi of same shape. Regardless of the tensor dtype, the output will be converted to int.
Definition: EigenConverter.cpp:79
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > TensorToEigenMatrixXf(const core::Tensor &tensor)
Converts a 2D Tensor to Eigen::MatrixXf of same shape. Regardless of the tensor dtype, the output will be converted to float.
Definition: EigenConverter.cpp:74
core::Tensor EigenMatrixToTensor(const Eigen::Matrix< T, M, N, A > &matrix)
Converts a Eigen matrix of shape (M, N) with alignment A and type T to a Tensor.
Definition: EigenConverter.h:47
core::Tensor EigenVector3dVectorToTensor(const std::vector< Eigen::Vector3d > &values, core::Dtype dtype, const core::Device &device)
Converts a vector of Eigen::Vector3d to a (N, 3) tensor. This function also takes care of dtype conve...
Definition: EigenConverter.cpp:153
std::vector< Eigen::Vector3i > TensorToEigenVector3iVector(const core::Tensor &tensor)
Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3i>. An exception will be thrown if the...
Definition: EigenConverter.cpp:148
std::vector< Eigen::Vector3d > TensorToEigenVector3dVector(const core::Tensor &tensor)
Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3d>. An exception will be thrown if the...
Definition: EigenConverter.cpp:143