gdl/gdl-array.patch
2017-02-01 10:05:47 -07:00

53 lines
1.6 KiB
Diff

From 965eb0af7a532740637c96ac31f7fc5d022d1953 Mon Sep 17 00:00:00 2001
From: Gilles Duvert <gilles-duvert@users.sourceforge.net>
Date: Tue, 24 Jan 2017 10:05:41 +0000
Subject: [PATCH] reverted to previous version since correction of bug#709 was
making a mess with array dimensions.
---
src/accessdesc.hpp | 3 ++-
src/dimension.hpp | 16 +++++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/accessdesc.hpp b/src/accessdesc.hpp
index 0309d11..b4d78a9 100644
--- a/src/accessdesc.hpp
+++ b/src/accessdesc.hpp
@@ -317,7 +317,8 @@ class DotAccessDescT
// dim >> topDim;
dim >> ix[d]->GetDim();
}
- dim.Purge();
+// Was added to solve bug 709 but may have side effects.
+// dim.Purge();
}
private:
diff --git a/src/dimension.hpp b/src/dimension.hpp
index 6469648..1345ff5 100644
--- a/src/dimension.hpp
+++ b/src/dimension.hpp
@@ -378,13 +378,15 @@ class dimension
// throw away unused ranks (ie. ranks == 1)
void Purge()
{
- //old version: produce bug #709
-// for(; rank>1 && dim[rank-1] <= 1; --rank);
- int m=rank-1;
- for (; m>0; --m) if (dim[m]<=1) {
- for (int j=m; j<rank-1; ++j) dim[j]=dim[j+1];
- rank--;
- }
+ //The following line produces bug #709
+ for(; rank>1 && dim[rank-1] <= 1; --rank);
+// However those following lines are too strict: test=fltarr(1, 1, 114) & help,test
+// gives: TEST FLOAT = Array[1, 114] instead of good answer TEST FLOAT = Array[1, 1, 114]
+// int m=rank-1;
+// for (; m>0; --m) if (dim[m]<=1) {
+// for (int j=m; j<rank-1; ++j) dim[j]=dim[j+1];
+// rank--;
+// }
}
// set the rank to r (pads 1s) if it is smaller than r