This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Problem with Matrix-matrix and matrix-vector multiplication

Tags: None
(comma "," separated)
noealvaradotovar
Registered Member
Posts
5
Karma
0
Hi, i have been compiling the examples in the chapters, but i am having problem with Matrix-matrix and matrix-vector multiplication example, this is the error

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C2039: 'ReturnType' : no es un miembro de 'Eigen::ScalarBinaryOpTraits<ScalarA,ScalarB,BinaryOp>'
1> with
1> [
1> ScalarA=double,
1> ScalarB=Eigen::Matrix2d,
1> BinaryOp=Eigen::internal::scalar_product_op<double,Eigen::Matrix2d>
1> ]
1> c:\eigen\eigen\src\core\util\meta.h(371) : vea la referencia a la creación de instancias de plantilla de clase 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>' que se está compilando
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]
1> c:\ejemplos visual\dense matrix and array manipulation\matrix and vector arithmetic\multiplicación _mxm_mxv\multiplicación _mxm_mxv\main.cpp(10) : vea la referencia a la creación de instancias de plantilla de clase 'Eigen::internal::has_ReturnType<T>' que se está compilando
1> with
1> [
1> T=Eigen::ScalarBinaryOpTraits<double,Eigen::Matrix2d,Eigen::internal::scalar_product_op<double,Eigen::Matrix2d>>
1> ]
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C2146: error de sintaxis : falta ';' delante del identificador 'result_type'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C4430: falta el especificador de tipo; se presupone int. Nota: C++ no admite default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C4430: falta el especificador de tipo; se presupone int. Nota: C++ no admite default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C4430: falta el especificador de tipo; se presupone int. Nota: C++ no admite default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C2143: error de sintaxis : falta ';' delante de '('
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C2433: 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : '__forceinline' no se permite en las declaraciones de datos
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C4430: falta el especificador de tipo; se presupone int. Nota: C++ no admite default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2327: Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : no es un nombre de tipo, elemento estático o enumerador
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C4430: falta el especificador de tipo; se presupone int. Nota: C++ no admite default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2146: error de sintaxis : falta ';' delante del identificador 'predux'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2433: 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : '__forceinline' no se permite en las declaraciones de datos
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2086: 'const int Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : nueva definición
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]
1> c:\eigen\eigen\src\core\functors\binaryfunctors.h(86) : vea la declaración de 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type'
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2238: símbolos (token) inesperados delante de ';'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C4430: falta el especificador de tipo; se presupone int. Nota: C++ no admite default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2143: error de sintaxis : falta ';' delante de '<end Parse>'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): warning C4183: 'predux': falta el tipo de valor devuelto; se supone que se trata de una función miembro que devuelve 'int'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(93): error C2143: error de sintaxis : falta ';' delante de '}'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(93): error C2238: símbolos (token) inesperados delante de ';'

I am wotking with Visual C++
User avatar
emilf
Registered Member
Posts
29
Karma
0
OS
Could you change the compiler output to English and also post a minimal example producing the error?
It would greatly help to test the code.
noealvaradotovar
Registered Member
Posts
5
Karma
0
The example is the following :
#include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpose()*mat << std::endl;
std::cout << "Here is u^T*v:\n" << u.transpose()*v << std::endl;
std::cout << "Here is u*v^T:\n" << u*v.transpose() << std::endl;
std::cout << "Let's multiply mat by itself" << std::endl;
mat = mat*mat;
std::cout << "Now mat is mat:\n" << mat << std::endl;
}
and the error message is
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C2039: 'ReturnType' : is no a member of 'Eigen::ScalarBinaryOpTraits<ScalarA,ScalarB,BinaryOp>'
1> with
1> [
1> ScalarA=double,
1> ScalarB=Eigen::Matrix2d,
1> BinaryOp=Eigen::internal::scalar_product_op<double,Eigen::Matrix2d>
1> ]

1> c:\eigen\eigen\src\core\util\meta.h(371) : see the reference to the creation of instances of class template 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>' that is compiling
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1> c:\ejemplos visual\dense matrix and array manipulation\matrix and vector arithmetic\multiplicación _mxm_mxv\multiplicación _mxm_mxv\main.cpp(10) : see the reference to the creation of instances of class template 'Eigen::internal::has_ReturnType<T>' that is compiling
1> with
1> [
1> T=Eigen::ScalarBinaryOpTraits<double,Eigen::Matrix2d,Eigen::internal::scalar_product_op<double,Eigen::Matrix2d>>
1> ]


1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C2146: syntax error : missing ';' before identificador 'result_type'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C2143: syntax error : missing ';' before '('
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C2433: 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : '__forceinline' not permitted on data declarations
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2327: Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : is not a type name, static, or enumerator
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2146: syntax error : missing ';' before identificador 'predux'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2433: 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : '__forceinline'not permitted on data declarations
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2086: 'const int Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : redefinition
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1> c:\eigen\eigen\src\core\functors\binaryfunctors.h(86) : see declaration of 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type'
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2238:unexpected token(s) preceding 'token'';'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2143: syntax error : missing ';' before <end parse>
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2143: syntax error : missing ';' before '}'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2238:unexpected token(s) preceding 'token'';'
noealvaradotovar
Registered Member
Posts
5
Karma
0
emilf wrote:Could you change the compiler output to English and also post a minimal example producing the error?
It would greatly help to test the code.


The example is
#include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpose()*mat << std::endl;
std::cout << "Here is u^T*v:\n" << u.transpose()*v << std::endl;
std::cout << "Here is u*v^T:\n" << u*v.transpose() << std::endl;
std::cout << "Let's multiply mat by itself" << std::endl;
mat = mat*mat;
std::cout << "Now mat is mat:\n" << mat << std::endl;
}

and the error is
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C2039: 'ReturnType' : is no a member of 'Eigen::ScalarBinaryOpTraits<ScalarA,ScalarB,BinaryOp>'
1> with
1> [
1> ScalarA=double,
1> ScalarB=Eigen::Matrix2d,
1> BinaryOp=Eigen::internal::scalar_product_op<double,Eigen::Matrix2d>
1> ]

1> c:\eigen\eigen\src\core\util\meta.h(371) : see the reference to the creation of instances of class template 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>' that is compiling
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1> c:\ejemplos visual\dense matrix and array manipulation\matrix and vector arithmetic\multiplicación _mxm_mxv\multiplicación _mxm_mxv\main.cpp(10) : see the reference to the creation of instances of class template 'Eigen::internal::has_ReturnType<T>' that is compiling
1> with
1> [
1> T=Eigen::ScalarBinaryOpTraits<double,Eigen::Matrix2d,Eigen::internal::scalar_product_op<double,Eigen::Matrix2d>>
1> ]


1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C2146: syntax error : missing ';' before identificador 'result_type'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(78): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C2143: syntax error : missing ';' before '('
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C2433: 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : '__forceinline' not permitted on data declarations
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2327: Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : is not a type name, static, or enumerator
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2146: syntax error : missing ';' before identificador 'predux'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2433: 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : '__forceinline'not permitted on data declarations
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2086: 'const int Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type' : redefinition
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1> c:\eigen\eigen\src\core\functors\binaryfunctors.h(86) : see declaration of 'Eigen::internal::scalar_product_op<LhsScalar,RhsScalar>::result_type'
1> with
1> [
1> LhsScalar=double,
1> RhsScalar=Eigen::Matrix2d
1> ]

1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2238:unexpected token(s) preceding 'token'';'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2143: syntax error : missing ';' before <end parse>
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2143: syntax error : missing ';' before '}'
1>c:\eigen\eigen\src\core\functors\binaryfunctors.h(91): error C2238:unexpected token(s) preceding 'token'';'
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
This works fine here using 3.3 head and various versions of gcc and clang.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
This also works fine with msvc 2012, 2013, and 2015.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]