Re: [eigen] Question regarding an operation

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 25.08.2015 at 00:37, Nuno Marques wrote:
Ok! Just to let know that this is solved!
Solution:     float beta = std::sqrt((r*(S_I*r))(0));

The expression r*(S_I*r) should raise a run-time assertion (unless all sizes happen to match). Please do not disable assertions, unless you are sure your code is correct!

The correct solution would be, e.g., std::sqrt(r.dot(S_I*r));




Thanks for the help Trevor! Best regards,

---Nuno MarquesTenente Aluno de Transmissões (Eng)
+351 912 090 991Azambuja | 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 -Wfatal-errors.
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!
---Nuno MarquesTenente Aluno de Transmissões (Eng)
+351 912 090 991Azambuja | 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 -Wfatal-errors.




Any idea?



---
Nuno Marques
Tenente Aluno de Transmissões (Eng)





+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:
http://eigen.tuxfamily.org/dox/group__TutorialArrayClass.html



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,


---
Nuno Marques
Tenente Aluno de Transmissões (Eng)





+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.













  		 	   		   		 	   		



--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



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