--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: release.debian.org: Permission to upload armadillo: sparse matrix bug fix
- From: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
- Date: Mon, 21 Jun 2021 09:49:31 +0530
- Message-id: <YNATU4gJqgM/Kjzk@odessa>
Package: release.debian.org
Severity: normal
Dear Release Team,
Please permit me to upload the attached targeted fix from upstream
that fixed erroneous calculations relating to sparse diagonal
matrices. This fix is needed to prevent some numerical errors, and I
request you to consider this positively.
Thanks.
Kumar
>From 158c2a523c29b1aa883fd410e4b695c8f9859944 Mon Sep 17 00:00:00 2001
From: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Date: Mon, 21 Jun 2021 09:43:47 +0530
Subject: [PATCH] Add patch from upstream for fixing sparse matrix related bug.
---
debian/changelog | 6 +++
debian/patches/armadillo_spdiag_bugfix.patch | 53 ++++++++++++++++++++
debian/patches/series | 2 +-
3 files changed, 60 insertions(+), 1 deletion(-)
create mode 100644 debian/patches/armadillo_spdiag_bugfix.patch
diff --git a/debian/changelog b/debian/changelog
index 730ef566..1a405ec6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+armadillo (1:10.1.2+dfsg-6) unstable; urgency=medium
+
+ * Add patch from upstream for fixing sparse matrix related bug.
+
+ -- Kumar Appaiah <akumar@debian.org> Mon, 21 Jun 2021 09:43:00 +0530
+
armadillo (1:10.1.2+dfsg-5) unstable; urgency=medium
* Add patches from upstream for pinv and rcond bugs
diff --git a/debian/patches/armadillo_spdiag_bugfix.patch b/debian/patches/armadillo_spdiag_bugfix.patch
new file mode 100644
index 00000000..e0c62748
--- /dev/null
+++ b/debian/patches/armadillo_spdiag_bugfix.patch
@@ -0,0 +1,53 @@
+--- armadillo-10.1.2/include/armadillo_bits/spglue_merge_meat.hpp 2016-06-17 02:22:12.000000000 +1000
++++ armadillo-10.1.2-spdiag-bugfix/include/armadillo_bits/spglue_merge_meat.hpp 2021-06-21 12:10:16.212683012 +1000
+@@ -485,7 +485,7 @@
+
+ while( (x_it != x_end) || (y_it != y_end) )
+ {
+- eT out_val;
++ eT out_val = eT(0);
+
+ const uword x_it_col = x_it.col();
+ const uword x_it_row = x_it.row();
+@@ -508,28 +508,29 @@
+ {
+ if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end
+ {
+- out_val = (*x_it);
++ if(x_it_col != x_it_row) { out_val = (*x_it); } // don't take values from the main diagonal of A
+
+ ++x_it;
+ }
+ else
+ {
+- out_val = (*y_it);
++ if(y_it_col == y_it_row) { out_val = (*y_it); use_y_loc = true; } // take values only from the main diagonal of B
+
+ ++y_it;
+-
+- use_y_loc = true;
+ }
+ }
+
+- access::rw(out.values[count]) = out_val;
+-
+- const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row;
+- const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col;
+-
+- access::rw(out.row_indices[count]) = out_row;
+- access::rw(out.col_ptrs[out_col + 1])++;
+- ++count;
++ if(out_val != eT(0))
++ {
++ access::rw(out.values[count]) = out_val;
++
++ const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row;
++ const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col;
++
++ access::rw(out.row_indices[count]) = out_row;
++ access::rw(out.col_ptrs[out_col + 1])++;
++ ++count;
++ }
+ }
+
+ const uword out_n_cols = out.n_cols;
diff --git a/debian/patches/series b/debian/patches/series
index 4a679fbd..83b685e8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,4 +2,4 @@ armadillo_sign_bugfix.patch
armadillo_princomp_bugfix.patch
armadillo_pinv_bugfix.patch
armadillo_rcond_bugfix.patch
-
+armadillo_spdiag_bugfix.patch
--
2.30.1
--- End Message ---