diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-09-07 12:04:03 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-09-07 12:04:03 +0200 |
commit | 505879855c6fa83b81ab31b57daaf8034634a19e (patch) | |
tree | 9c6c1ea08d9852adf57486ffe6673dd5166ffb6d /packages/base | |
parent | e90e605787402e7e1a8d33de1a889822fc25fdc9 (diff) |
fix min/maxIndex bug, add tests, thanks
Diffstat (limited to 'packages/base')
-rw-r--r-- | packages/base/THANKS.md | 2 | ||||
-rw-r--r-- | packages/base/hmatrix.cabal | 2 | ||||
-rw-r--r-- | packages/base/src/C/vector-aux.c | 8 |
3 files changed, 7 insertions, 5 deletions
diff --git a/packages/base/THANKS.md b/packages/base/THANKS.md index e17306b..07b75b8 100644 --- a/packages/base/THANKS.md +++ b/packages/base/THANKS.md | |||
@@ -157,3 +157,5 @@ module reorganization, monadic mapVectorM, and many other improvements. | |||
157 | 157 | ||
158 | - Denis Laxalde separated the gsl tests from the base ones. | 158 | - Denis Laxalde separated the gsl tests from the base ones. |
159 | 159 | ||
160 | - Ian Ross reported the max/minIndex bug. | ||
161 | |||
diff --git a/packages/base/hmatrix.cabal b/packages/base/hmatrix.cabal index 6858d7d..c2efadc 100644 --- a/packages/base/hmatrix.cabal +++ b/packages/base/hmatrix.cabal | |||
@@ -1,5 +1,5 @@ | |||
1 | Name: hmatrix | 1 | Name: hmatrix |
2 | Version: 0.16.0.4 | 2 | Version: 0.16.0.5 |
3 | License: BSD3 | 3 | License: BSD3 |
4 | License-file: LICENSE | 4 | License-file: LICENSE |
5 | Author: Alberto Ruiz | 5 | Author: Alberto Ruiz |
diff --git a/packages/base/src/C/vector-aux.c b/packages/base/src/C/vector-aux.c index 2f47c8f..a7eaa08 100644 --- a/packages/base/src/C/vector-aux.c +++ b/packages/base/src/C/vector-aux.c | |||
@@ -172,7 +172,7 @@ double vector_min(KDVEC(x)) { | |||
172 | double vector_max_index(KDVEC(x)) { | 172 | double vector_max_index(KDVEC(x)) { |
173 | int k, r = 0; | 173 | int k, r = 0; |
174 | for (k = 1; k<xn; k++) { | 174 | for (k = 1; k<xn; k++) { |
175 | if(xp[k]>xp[0]) { | 175 | if(xp[k]>xp[r]) { |
176 | r = k; | 176 | r = k; |
177 | } | 177 | } |
178 | } | 178 | } |
@@ -182,7 +182,7 @@ double vector_max_index(KDVEC(x)) { | |||
182 | double vector_min_index(KDVEC(x)) { | 182 | double vector_min_index(KDVEC(x)) { |
183 | int k, r = 0; | 183 | int k, r = 0; |
184 | for (k = 1; k<xn; k++) { | 184 | for (k = 1; k<xn; k++) { |
185 | if(xp[k]<xp[0]) { | 185 | if(xp[k]<xp[r]) { |
186 | r = k; | 186 | r = k; |
187 | } | 187 | } |
188 | } | 188 | } |
@@ -237,7 +237,7 @@ float vector_min_f(KFVEC(x)) { | |||
237 | float vector_max_index_f(KFVEC(x)) { | 237 | float vector_max_index_f(KFVEC(x)) { |
238 | int k, r = 0; | 238 | int k, r = 0; |
239 | for (k = 1; k<xn; k++) { | 239 | for (k = 1; k<xn; k++) { |
240 | if(xp[k]>xp[0]) { | 240 | if(xp[k]>xp[r]) { |
241 | r = k; | 241 | r = k; |
242 | } | 242 | } |
243 | } | 243 | } |
@@ -247,7 +247,7 @@ float vector_max_index_f(KFVEC(x)) { | |||
247 | float vector_min_index_f(KFVEC(x)) { | 247 | float vector_min_index_f(KFVEC(x)) { |
248 | int k, r = 0; | 248 | int k, r = 0; |
249 | for (k = 1; k<xn; k++) { | 249 | for (k = 1; k<xn; k++) { |
250 | if(xp[k]<xp[0]) { | 250 | if(xp[k]<xp[r]) { |
251 | r = k; | 251 | r = k; |
252 | } | 252 | } |
253 | } | 253 | } |