大家好,
我正在使用Eigen v.3.3.3,并尝试将Vector3f与浮点数相乘。
Eigen::MatrixXf weighted_adjacency_matrix(2,2); // [n,n]
weighted_adjacency_matrix << 0, 1, 1, 0;
Eigen::Matrix<Eigen::Vector3f, Eigen::Dynamic, 1> locations; // [n]
Eigen::Vector3f vec1(1, 2, 3), vec2(2, 3, 4);
locations << vec1, vec2;
Eigen::Matrix<Eigen::Vector3f, Eigen::Dynamic, Eigen::Dynamic> result = weighted_adjacency_matrix.cwiseProduct(locations);
在代码中,我尝试对两个矩阵进行逐点乘法。
stacktrace如下所示:
Severity Code Description Project File Line Suppression State
Error C2039 'ReturnType': is not a member of 'Eigen::ScalarBinaryOpTraits<LhsScalar,RhsScalar,Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>>' ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 78
Error C3646 'result_type': unknown override specifier ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 78
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 78
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 86
Error C2143 syntax error: missing ';' before '(' ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 86
Error C2433 'Eigen::internal::scalar_product_op<float,_Scalar>::result_type': '__forceinline' not permitted on data declarations ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 86
Error C2327 'Eigen::internal::scalar_product_op<float,_Scalar>::result_type': is not a type name, static, or enumerator ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 91
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 91
Error C2433 'result_type': '__forceinline' not permitted on data declarations ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 91
Error C2365 'Eigen::internal::scalar_product_op<float,_Scalar>::result_type': redefinition; previous definition was 'data member' ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 91
Error C2061 syntax error: identifier 'predux' ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 91
Error C2334 unexpected token(s) preceding '{'; skipping apparent function body ** *****\packages\eigen.3.3.3\build\native\include\eigen\src\core\functors\binaryfunctors.h 92
为什么不能将Vector3f与浮点数进行逐点乘法运算?
任何解决方案和/或想法将不胜感激!