guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/14: gnu: eigen: Update to 3.3.7.


From: guix-commits
Subject: 03/14: gnu: eigen: Update to 3.3.7.
Date: Mon, 16 Mar 2020 23:50:58 -0400 (EDT)

nckx pushed a commit to branch master
in repository guix.

commit 5144e314925d6014b496bcc6090f46e97318b5fa
Author: Tobias Geerinckx-Rice <address@hidden>
AuthorDate: Tue Mar 17 00:19:01 2020 +0100

    gnu: eigen: Update to 3.3.7.
    
    * gnu/packages/algebra.scm (eigen): Update to 3.3.7.
    [source]: Add a patch to fix a test failure.
    * gnu/packages/patches/eigen-stabilise-sparseqr-test.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/algebra.scm                           |  7 +-
 .../patches/eigen-stabilise-sparseqr-test.patch    | 74 ++++++++++++++++++++++
 3 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 5cde920..caa73d4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -826,6 +826,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch     \
   %D%/packages/patches/dstat-skip-devices-without-io.patch     \
   %D%/packages/patches/dvd+rw-tools-add-include.patch          \
+  %D%/packages/patches/eigen-stabilise-sparseqr-test.patch     \
   %D%/packages/patches/einstein-build.patch                    \
   %D%/packages/patches/elfutils-tests-ptrace.patch             \
   %D%/packages/patches/elixir-path-length.patch                        \
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 50cb300..8682ecd 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -5,7 +5,7 @@
 ;;; Copyright © 2014, 2018 Mark H Weaver <address@hidden>
 ;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2017 Efraim Flashner <address@hidden>
-;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <address@hidden>
+;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <address@hidden>
 ;;; Copyright © 2017 Marius Bakke <address@hidden>
 ;;; Copyright © 2017, 2019 Eric Bavier <address@hidden>
 ;;; Copyright © 2020 Björn Höfling <address@hidden>
@@ -910,15 +910,16 @@ Sine Transform} (DST) and @dfn{Discrete Hartley 
Transform} (DHT).")
 (define-public eigen
   (package
     (name "eigen")
-    (version "3.3.5")
+    (version "3.3.7")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://bitbucket.org/eigen/eigen/get/";
                                   version ".tar.bz2"))
               (sha256
                (base32
-                "1qh3yrwn78ms5yhwbpl5wvblk4gbz02cacdygxylr7i9xbrvylkk"))
+                "1km3fyfzyqfdvmnl79drps3fjwnz3zbh0c7l34mfbqyvvs8cy4wz"))
               (file-name (string-append name "-" version ".tar.bz2"))
+              (patches (search-patches "eigen-stabilise-sparseqr-test.patch"))
               (modules '((guix build utils)))
               (snippet
                ;; There are 3 test failures in the "unsupported" directory,
diff --git a/gnu/packages/patches/eigen-stabilise-sparseqr-test.patch 
b/gnu/packages/patches/eigen-stabilise-sparseqr-test.patch
new file mode 100644
index 0000000..b95b460
--- /dev/null
+++ b/gnu/packages/patches/eigen-stabilise-sparseqr-test.patch
@@ -0,0 +1,74 @@
+From: Tobias Geerinckx-Rice <address@hidden>
+Date: Mon, 16 Mar 2020 22:51:37 +0000
+Subject: gnu: eigen: Stabilise sparseqr test.
+
+Taken verbatim from this[0] upstream commit.
+
+[0]: 
https://gitlab.com/libeigen/eigen/-/commit/3b5deeb546d4017b24846f5b0dc3296a50a039fe
+
+From 3b5deeb546d4017b24846f5b0dc3296a50a039fe Mon Sep 17 00:00:00 2001
+From: Gael Guennebaud <address@hidden>
+Date: Tue, 19 Feb 2019 22:57:51 +0100
+Subject: [PATCH] bug #899: make sparseqr unit test more stable by 1) trying
+ with larger threshold and 2) relax rank computation for rank-deficient
+ problems.
+
+---
+ test/sparseqr.cpp | 31 ++++++++++++++++++++++++++-----
+ 1 file changed, 26 insertions(+), 5 deletions(-)
+
+diff --git a/test/sparseqr.cpp b/test/sparseqr.cpp
+index 3ffe62314..3576cc626 100644
+--- a/test/sparseqr.cpp
++++ b/test/sparseqr.cpp
+@@ -43,6 +43,7 @@ int generate_sparse_rectangular_problem(MatrixType& A, 
DenseMat& dA, int maxRows
+ 
+ template<typename Scalar> void test_sparseqr_scalar()
+ {
++  typedef typename NumTraits<Scalar>::Real RealScalar;
+   typedef SparseMatrix<Scalar,ColMajor> MatrixType; 
+   typedef Matrix<Scalar,Dynamic,Dynamic> DenseMat;
+   typedef Matrix<Scalar,Dynamic,1> DenseVector;
+@@ -91,14 +92,34 @@ template<typename Scalar> void test_sparseqr_scalar()
+     exit(0);
+     return;
+   }
+-  
+-  VERIFY_IS_APPROX(A * x, b);
+-  
+-  //Compare with a dense QR solver
++
++  // Compare with a dense QR solver
+   ColPivHouseholderQR<DenseMat> dqr(dA);
+   refX = dqr.solve(b);
+   
+-  VERIFY_IS_EQUAL(dqr.rank(), solver.rank());
++  bool rank_deficient = A.cols()>A.rows() || dqr.rank()<A.cols();
++  if(rank_deficient)
++  {
++    // rank deficient problem -> we might have to increase the threshold
++    // to get a correct solution.
++    RealScalar th = 
RealScalar(20)*dA.colwise().norm().maxCoeff()*(A.rows()+A.cols()) * 
NumTraits<RealScalar>::epsilon();
++    for(Index k=0; (k<16) && !test_isApprox(A*x,b); ++k)
++    {
++      th *= RealScalar(10);
++      solver.setPivotThreshold(th);
++      solver.compute(A);
++      x = solver.solve(b);
++    }
++  }
++
++  VERIFY_IS_APPROX(A * x, b);
++  
++  // For rank deficient problem, the estimated rank might
++  // be slightly off, so let's only raise a warning in such cases.
++  if(rank_deficient) ++g_test_level;
++  VERIFY_IS_EQUAL(solver.rank(), dqr.rank());
++  if(rank_deficient) --g_test_level;
++
+   if(solver.rank()==A.cols()) // full rank
+     VERIFY_IS_APPROX(x, refX);
+ //   else
+-- 
+2.24.1
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]