yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05925
[Branch ~yade-dev/yade/trunk] Rev 2495: 1. Eigen3 compiles now (seems). Vaclav, sorry, I needed to change your template, because it gave ...
------------------------------------------------------------
revno: 2495
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-10-17 17:41:22 +0200
message:
1. Eigen3 compiles now (seems). Vaclav, sorry, I needed to change your template, because it gave an error on Eigen3.
modified:
lib/base/Math.hpp
--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'lib/base/Math.hpp'
--- lib/base/Math.hpp 2010-10-17 12:55:29 +0000
+++ lib/base/Math.hpp 2010-10-17 15:41:22 +0000
@@ -38,7 +38,10 @@
#define EIGEN_NO_DEBUG
#include<Eigen/Core>
#include<Eigen/Geometry>
-#include<Eigen/Array>
+ #if EIGEN_MAJOR_VERSION<20 //Eigen3 definition, while it is not realized
+
+ #include<Eigen/Array>
+ #endif
#include<Eigen/QR>
#include<Eigen/LU>
#include<Eigen/SVD>
@@ -124,12 +127,18 @@
template<typename MatrixT>
void Matrix_computeUnitaryPositive(const MatrixT& in, MatrixT* unitary, MatrixT* positive){
assert(unitary); assert(positive);
- #if EIGEN_WORLD_VERSION<3
+ #if EIGEN_MAJOR_VERSION<20 //Eigen3 definition, while it is not realized
+
Eigen::SVD<MatrixT>(in).computeUnitaryPositive(unitary,positive);
#else
Eigen::JacobiSVD<MatrixT> svd(in, Eigen::ComputeThinU | Eigen::ComputeThinV);
- *unitary=svd.matrixU() * svd.matrixV().adjoint();
- *positive=svd.matrixV() * svd.singularValues().asDiagonal() * svg.matrixV().adjoint;
+ MatrixT mU, mV, mS;
+ mU = svd.matrixU();
+ mV = svd.matrixV();
+ mS = svd.singularValues().asDiagonal();
+
+ *unitary=mU() * mV().adjoint();
+ *positive=mV() * mS().asDiagonal() * mV().adjoint;
#endif
}