summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/base/THANKS.md2
-rw-r--r--packages/base/hmatrix.cabal2
-rw-r--r--packages/base/src/C/vector-aux.c8
-rw-r--r--packages/tests/hmatrix-tests.cabal2
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests.hs21
5 files changed, 29 insertions, 6 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 @@
1Name: hmatrix 1Name: hmatrix
2Version: 0.16.0.4 2Version: 0.16.0.5
3License: BSD3 3License: BSD3
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: 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)) {
172double vector_max_index(KDVEC(x)) { 172double 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)) {
182double vector_min_index(KDVEC(x)) { 182double 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)) {
237float vector_max_index_f(KFVEC(x)) { 237float 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)) {
247float vector_min_index_f(KFVEC(x)) { 247float 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 }
diff --git a/packages/tests/hmatrix-tests.cabal b/packages/tests/hmatrix-tests.cabal
index a417096..0514843 100644
--- a/packages/tests/hmatrix-tests.cabal
+++ b/packages/tests/hmatrix-tests.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix-tests 1Name: hmatrix-tests
2Version: 0.4.0.1 2Version: 0.4.1.0
3License: BSD3 3License: BSD3
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
index 841b0d8..8587561 100644
--- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
+++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
@@ -398,12 +398,33 @@ staticTest = utest "static" (fst $ checkT (undefined :: L 3 5))
398 398
399-------------------------------------------------------------------------------- 399--------------------------------------------------------------------------------
400 400
401indexProp g f x = a1 == g a2 && a2 == a3 && b1 == g b2 && b2 == b3
402 where
403 l = map g (toList (f x))
404 a1 = maximum l
405 b1 = minimum l
406 a2 = x `atIndex` maxIndex x
407 b2 = x `atIndex` minIndex x
408 a3 = maxElement x
409 b3 = minElement x
410
411--------------------------------------------------------------------------------
412
401-- | All tests must pass with a maximum dimension of about 20 413-- | All tests must pass with a maximum dimension of about 20
402-- (some tests may fail with bigger sizes due to precision loss). 414-- (some tests may fail with bigger sizes due to precision loss).
403runTests :: Int -- ^ maximum dimension 415runTests :: Int -- ^ maximum dimension
404 -> IO () 416 -> IO ()
405runTests n = do 417runTests n = do
406 let test p = qCheck n p 418 let test p = qCheck n p
419 putStrLn "------ index"
420 test( \m -> indexProp id flatten (single (m :: RM)) )
421 test( \v -> indexProp id id (single (v :: Vector Double)) )
422 test( \m -> indexProp id flatten (m :: RM) )
423 test( \v -> indexProp id id (v :: Vector Double) )
424 test( \m -> indexProp magnitude flatten (single (m :: CM)) )
425 test( \v -> indexProp magnitude id (single (v :: Vector (Complex Double))) )
426 test( \m -> indexProp magnitude flatten (m :: CM) )
427 test( \v -> indexProp magnitude id (v :: Vector (Complex Double)) )
407 putStrLn "------ mult Double" 428 putStrLn "------ mult Double"
408 test (multProp1 10 . rConsist) 429 test (multProp1 10 . rConsist)
409 test (multProp1 10 . cConsist) 430 test (multProp1 10 . cConsist)