summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Internal/Common.hs5
-rw-r--r--lib/Data/Packed/Internal/auxi.c6
-rw-r--r--lib/Data/Packed/Internal/auxi.h2
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index 3609bc2..bce9922 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -80,9 +80,14 @@ errorCode 2006 = "the input matrix is not positive definite"
80errorCode 2007 = "not yet supported in this OS" 80errorCode 2007 = "not yet supported in this OS"
81errorCode n = "code "++show n 81errorCode n = "code "++show n
82 82
83
84-- | clear the fpu
85foreign import ccall "auxi.h asm_finit" finit :: IO ()
86
83-- | check the error code 87-- | check the error code
84check :: String -> IO CInt -> IO () 88check :: String -> IO CInt -> IO ()
85check msg f = do 89check msg f = do
90 finit
86 err <- f 91 err <- f
87 when (err/=0) $ if err > 1024 92 when (err/=0) $ if err > 1024
88 then (error (msg++": "++errorCode err)) -- our errors 93 then (error (msg++": "++errorCode err)) -- our errors
diff --git a/lib/Data/Packed/Internal/auxi.c b/lib/Data/Packed/Internal/auxi.c
index 04dc7ad..bbb8cd4 100644
--- a/lib/Data/Packed/Internal/auxi.c
+++ b/lib/Data/Packed/Internal/auxi.c
@@ -149,3 +149,9 @@ int conjugate(KCVEC(x),CVEC(t)) {
149 } 149 }
150 OK 150 OK
151} 151}
152
153//---------------------------------------
154void asm_finit() {
155 asm("finit");
156}
157//---------------------------------------
diff --git a/lib/Data/Packed/Internal/auxi.h b/lib/Data/Packed/Internal/auxi.h
index 377a4a1..507a30d 100644
--- a/lib/Data/Packed/Internal/auxi.h
+++ b/lib/Data/Packed/Internal/auxi.h
@@ -26,3 +26,5 @@ const char * gsl_strerror (const int gsl_errno);
26int matrix_fscanf(char*filename, RMAT(a)); 26int matrix_fscanf(char*filename, RMAT(a));
27 27
28int conjugate(KCVEC(x),CVEC(t)); 28int conjugate(KCVEC(x),CVEC(t));
29
30void asm_finit();