RE: [eigen] Question regarding an operation 
[ Thread Index  Date Index  More lists.tuxfamily.org/eigen Archives ]
Ok! Just to let know that this is solved!
Solution: float beta = std::sqrt((r*(S_I*r))(0)); Thanks for the help Trevor! Best regards,  +351 912 090 991 Azambuja  Portugal As the creation appears, the path is driven in the conscious feeling of madness and happiness, which returns, in multiple ways, to what we achieve in greatness... Follow me in: This message and any files herewith attached may contain confidential or privileged information and is intended solely for the use of the entity to which it is addressed. If you receive this message in error, please notify the sender immediately and delete this message and any files attached without copying them in any way. From: n.marques21@xxxxxxxxxxx To: eigen@xxxxxxxxxxxxxxxxxxx Subject: RE: [eigen] Question regarding an operation Date: Mon, 24 Aug 2015 23:05:26 +0100 Ok thanks. I think we are near, but still having trouble: ../Eigen/src/Core/GeneralProduct.h: In instantiation of 'const Eigen::Product<Derived, OtherDerived> Eigen::MatrixBase<Derived>::operator*(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = Eigen::Product<Eigen::Matrix<float, 2, 2>, Eigen::Matrix<float, 2, 1>, 0>; Derived = Eigen::Matrix<float, 2, 1>]': ...: required from here ../Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG); ^ ../Eigen/src/Core/GeneralProduct.h:405:3: note: in expansion of macro 'EIGEN_STATIC_ASSERT' EIGEN_STATIC_ASSERT(ProductIsValid  !(AreVectors && SameSizes), ^ compilation terminated due to Wfatalerrors. The vectors and matrices are as follows: Matrix<float, n_y, n_x> _P; Matrix<float, n_y, n_x> R; Matrix<float, n_y, n_x> C; Matrix<float, n_y, n_y> S_I = (C * _P * C.transpose() + R).inverse(); Matrix<float, n_x, 1> _x; Vector2f y; Vector2f r = y  C * _x; Thanks!  +351 912 090 991 Azambuja  Portugal As the creation appears, the path is driven in the conscious feeling of madness and happiness, which returns, in multiple ways, to what we achieve in greatness... Follow me in: This message and any files herewith attached may contain confidential or privileged information and is intended solely for the use of the entity to which it is addressed. If you receive this message in error, please notify the sender immediately and delete this message and any files attached without copying them in any way. From: tirons@xxxxxxxxxxxx To: eigen@xxxxxxxxxxxxxxxxxxx Subject: RE: [eigen] Question regarding an operation Date: Mon, 24 Aug 2015 21:56:14 +0000 Ah, I didn't look closely enough, you are not writing to an Eigen type. So
float beta = (exp).array().sqrt()(0);
should work. or
float beta = std::sqrt( exp(0) )
sorry.
/*************************************************
* Trevor P. Irons, PhD
* Mobile: +1 720.635.8218
* EM Modelling API: http://lemmasoftware.org
*************************************************/
From: Nuno Marques [n.marques21@xxxxxxxxxxx]
Sent: Monday, August 24, 2015 3:53 PM To: eigen@xxxxxxxxxxxxxxxxxxx Subject: RE: [eigen] Question regarding an operation Hi Trevor,
Thanks for the feedback.
Your suggestion issues a problem:
error: cannot convert 'const SqrtReturnType {aka const Eigen::CwiseUnaryOp<Eigen::internal::scalar_sqrt_op<float>, const Eigen::ArrayWrapper<const Eigen::Product<Eigen::Matrix<float,
2, 1>, Eigen::Product<Eigen::Matrix<float,
2, 2>, Eigen::Matrix<float,
2, 1>,
0>, 0> > >}' to 'float' in initialization
float beta = (r * (S_I * r)).array().sqrt();
^
compilation terminated due to Wfatalerrors.
Any idea?

+351 912 090 991
Azambuja  Portugal
As the creation appears, the path is driven in the conscious
feeling of madness and happiness, which returns, in multiple ways, to what we achieve in greatness...
Follow me in:
This message and any files herewith attached may contain confidential or privileged information and is intended solely for the use of the
entity to which it is addressed. If you receive this message in error, please notify the sender immediately and delete this message
and any files attached without copying them in any way.
From: tirons@xxxxxxxxxxxx To: eigen@xxxxxxxxxxxxxxxxxxx Subject: RE: [eigen] Question regarding an operation Date: Mon, 24 Aug 2015 21:43:10 +0000 You need to read up about array's to understand this:
As long as your algebra is correct,
float beta = (r*(S_I*R)).array().sqrt();
should work.
/*************************************************
* Trevor P. Irons, PhD
* Mobile: +1 720.635.8218
* EM Modelling API: http://lemmasoftware.org
*************************************************/
From: Nuno Marques [n.marques21@xxxxxxxxxxx]
Sent: Monday, August 24, 2015 3:39 PM To: eigen@xxxxxxxxxxxxxxxxxxx Subject: [eigen] Question regarding an operation Hello there,
I want to question the community regarding the following:
Matrix<float,
n_y, n_x> C;
Vector2f r = y  C * _x;
Matrix<float,
n_y, n_y> S_I = (C * _P * C.transpose() + R).inverse();
I want to compute,
float beta =
sqrt(r * (S_I * r));
... but I'm not being able to. Can anyone suggest a solution to this? I tried many combinations, but without luck.
Thanks in advance! Best regards,

+351 912 090 991
Azambuja  Portugal
As the creation appears, the path is driven in the conscious
feeling of madness and happiness, which returns, in multiple ways, to what we achieve in greatness...
Follow me in:
This message and any files herewith attached may contain confidential or privileged information and is intended solely for the use of the
entity to which it is addressed. If you receive this message in error, please notify the sender immediately and delete this message
and any files attached without copying them in any way.

Mail converted by MHonArc 2.6.19+  http://listengine.tuxfamily.org/ 