From 01744e1df9448a405696d91af709a7416db0cb78 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 15 Oct 2008 12:41:28 +0000 Subject: expose-bug flag --- hmatrix.cabal | 10 +++++++++- lib/Numeric/LinearAlgebra/Algorithms.hs | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hmatrix.cabal b/hmatrix.cabal index aeef52c..cae34a2 100644 --- a/hmatrix.cabal +++ b/hmatrix.cabal @@ -33,6 +33,10 @@ flag no-workaround description: Expose the NaN problem default: False +flag expose-bug + description: Expose the NaN problem with debug information + default: False + library if flag(splitBase) build-depends: base >= 3, array, QuickCheck, HUnit, storable-complex @@ -107,9 +111,13 @@ library if flag(unsafe) cpp-options: -DUNSAFE - if arch(i386) && !flag(no-workaround) && !flag(mkl) + if arch(i386) && !flag(no-workaround) && !flag(expose-bug) && !flag(mkl) cpp-options: -DWORKAROUND + if flag(expose-bug) + cpp-options: -DEXPOSEBUG + + if flag(mkl) if arch(x86_64) extra-libraries: gsl mkl_lapack mkl_intel_lp64 mkl_sequential mkl_core diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 2c5f44c..00a0ab0 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs @@ -142,9 +142,13 @@ instance Field (Complex Double) where #if defined(WORKAROUND) multiply = mulCW +#else +#if defined(EXPOSEBUG) + multiply = multiplyC #else multiply = multiplyC3 #endif +#endif -- | Eigenvalues and Eigenvectors of a complex hermitian or real symmetric matrix using lapack's dsyev or zheev. -- @@ -664,7 +668,9 @@ cmultiply f st a b = unsafePerformIO $ do s <- createMatrix RowMajor (rows a) (cols b) app3 f mat a mat b mat s st - if toLists s== toLists s then return s else error $ "BRUTAL " ++ (show (toLists s)) + if toLists s== toLists s + then return s + else error $ "NaN FOUND!! " ++ (show (toLists s)) -- return s -- | otherwise = error $ st ++ " (matrix product) of nonconformant matrices" -- cgit v1.2.3