From 86f045441468724de9fb45af67b982be26c8a48b Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Wed, 25 Nov 2015 17:08:23 +0100 Subject: [PATCH] Sketcher: Solver: FullPivLU::compute for Eigen-3.3 ================================================== This fix enables usage of the Eigen SparseQR starting in Eigen-3.3. It optimizes the code enabling it to work with the new assignation interface of Eigen-3.3, which is more strict than that of Eigen-3.2. It provides the same optimization for DenseQR code, and omits the extraction of the Q matrix in DenseQR as this is not used anywhere else. [NOTE: This is only to be merged after Debian has updated the Eigen-3.3-alpha1 package] See: http://forum.freecadweb.org/viewtopic.php?f=10&t=12769&start=30#p104740 https://forum.kde.org/viewtopic.php?f=74&t=129115 --- src/Mod/Sketcher/App/planegcs/GCS.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index cf0fefc63..f6930dd92 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -42,9 +42,7 @@ + EIGEN_MINOR_VERSION) #if EIGEN_VERSION >= 30202 -#if EIGEN_VERSION < 30290 // this is eigen3.3. Bad numbering? This should be safe anyway #define EIGEN_SPARSEQR_COMPATIBLE -#endif #if EIGEN_VERSION > 30290 // This regulates that only starting in Eigen 3.3, the problem with // http://forum.freecadweb.org/viewtopic.php?f=3&t=4651&start=40 // was solved in Eigen: @@ -3434,9 +3432,9 @@ int System::diagnose(Algorithm alg) if(qrAlgorithm==EigenDenseQR){ if (J.rows() > 0) { - qrJT=Eigen::FullPivHouseholderQR(J.topRows(count).transpose()); - Eigen::MatrixXd Q = qrJT.matrixQ (); - + qrJT.compute(J.topRows(count).transpose()); + //Eigen::MatrixXd Q = qrJT.matrixQ (); + paramsNum = qrJT.rows(); constrNum = qrJT.cols(); qrJT.setThreshold(qrpivotThreshold); @@ -3452,7 +3450,7 @@ int System::diagnose(Algorithm alg) #ifdef EIGEN_SPARSEQR_COMPATIBLE else if(qrAlgorithm==EigenSparseQR){ if (SJ.rows() > 0) { - SqrJT=Eigen::SparseQR, Eigen::COLAMDOrdering >(SJ.topRows(count).transpose()); + SqrJT.compute(SJ.topRows(count).transpose()); // Do not ask for Q Matrix!! // At Eigen 3.2 still has a bug that this only works for square matrices // if enabled it will crash