packages feed

blas 0.7.2 → 0.7.5

raw patch · 22 files changed

+470/−418 lines, 22 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Unsafe.BLAS: isHermIOBanded :: IOBanded np e -> !!Bool
+ Data.Elem.BLAS.Level1: acxpy :: (BLAS1 a) => Int -> a -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: asum :: (BLAS1 a) => Int -> Ptr a -> Int -> IO Double
+ Data.Elem.BLAS.Level1: axpy :: (BLAS1 a) => Int -> a -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: class (Elem a) => BLAS1 a
+ Data.Elem.BLAS.Level1: copy :: (BLAS1 a) => Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: dot :: (BLAS1 a) => ConjEnum -> ConjEnum -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO a
+ Data.Elem.BLAS.Level1: iamax :: (BLAS1 a) => Int -> Ptr a -> Int -> IO Int
+ Data.Elem.BLAS.Level1: instance BLAS1 (Complex Double)
+ Data.Elem.BLAS.Level1: instance BLAS1 Double
+ Data.Elem.BLAS.Level1: nrm2 :: (BLAS1 a) => Int -> Ptr a -> Int -> IO Double
+ Data.Elem.BLAS.Level1: rot :: (BLAS1 a) => Int -> Ptr a -> Int -> Ptr a -> Int -> Double -> Double -> IO ()
+ Data.Elem.BLAS.Level1: rotg :: (BLAS1 a) => Ptr a -> Ptr a -> Ptr a -> Ptr a -> IO ()
+ Data.Elem.BLAS.Level1: scal :: (BLAS1 a) => Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: swap :: (BLAS1 a) => Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: vcdiv :: (BLAS1 a) => Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: vcmul :: (BLAS1 a) => Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: vconj :: (BLAS1 a) => Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: vdiv :: (BLAS1 a) => Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level1: vmul :: (BLAS1 a) => Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: class (BLAS1 a) => BLAS2 a
+ Data.Elem.BLAS.Level2: gbmv :: (BLAS2 a) => TransEnum -> Int -> Int -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: gemv :: (BLAS2 a) => TransEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: gerc :: (BLAS2 a) => Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: geru :: (BLAS2 a) => Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: hbmv :: (BLAS2 a) => UpLoEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: hemv :: (BLAS2 a) => UpLoEnum -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: her :: (BLAS2 a) => UpLoEnum -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: her2 :: (BLAS2 a) => UpLoEnum -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: instance BLAS2 (Complex Double)
+ Data.Elem.BLAS.Level2: instance BLAS2 Double
+ Data.Elem.BLAS.Level2: tbmv :: (BLAS2 a) => UpLoEnum -> TransEnum -> DiagEnum -> Int -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: tbsv :: (BLAS2 a) => UpLoEnum -> TransEnum -> DiagEnum -> Int -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: trmv :: (BLAS2 a) => UpLoEnum -> TransEnum -> DiagEnum -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level2: trsv :: (BLAS2 a) => UpLoEnum -> TransEnum -> DiagEnum -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: class (BLAS2 a) => BLAS3 a
+ Data.Elem.BLAS.Level3: gemm :: (BLAS3 a) => TransEnum -> TransEnum -> Int -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: hemm :: (BLAS3 a) => SideEnum -> UpLoEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: her2k :: (BLAS3 a) => UpLoEnum -> TransEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: herk :: (BLAS3 a) => UpLoEnum -> TransEnum -> Int -> Int -> a -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: instance BLAS3 (Complex Double)
+ Data.Elem.BLAS.Level3: instance BLAS3 Double
+ Data.Elem.BLAS.Level3: symm :: (BLAS3 a) => SideEnum -> UpLoEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: syr2k :: (BLAS3 a) => UpLoEnum -> TransEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: syrk :: (BLAS3 a) => UpLoEnum -> TransEnum -> Int -> Int -> a -> Ptr a -> Int -> a -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: trmm :: (BLAS3 a) => SideEnum -> UpLoEnum -> TransEnum -> DiagEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Elem.BLAS.Level3: trsm :: (BLAS3 a) => SideEnum -> UpLoEnum -> TransEnum -> DiagEnum -> Int -> Int -> a -> Ptr a -> Int -> Ptr a -> Int -> IO ()
+ Data.Matrix.Banded: isHermBanded :: (BaseBanded a e) => a (n, p) e -> Bool
+ Data.Matrix.Banded: ldaBanded :: (BaseBanded a e) => a (n, p) e -> Int
+ Data.Matrix.Banded: transEnumBanded :: (BaseBanded a e) => a (n, p) e -> TransEnum
+ Data.Matrix.Banded.Class: transEnumBanded :: (BaseBanded a e) => a (n, p) e -> TransEnum
+ Data.Matrix.Class: Conj :: ConjEnum
+ Data.Matrix.Class: NoConj :: ConjEnum
+ Data.Matrix.Class: data ConjEnum
+ Data.Matrix.Class: flipConj :: ConjEnum -> ConjEnum
+ Data.Matrix.Dense: ldaMatrix :: (BaseMatrix a e) => a (n, p) e -> Int
+ Data.Matrix.Dense: transEnumMatrix :: (BaseMatrix a e) => a (n, p) e -> TransEnum
+ Data.Matrix.Dense.Class: transEnumMatrix :: (BaseMatrix a e) => a (n, p) e -> TransEnum
+ Data.Vector.Dense: conjEnum :: (BaseVector x e) => x n e -> ConjEnum
+ Data.Vector.Dense.Class: conjEnum :: (BaseVector x e) => x n e -> ConjEnum
+ Unsafe.BLAS: transEnumIOBanded :: IOBanded np e -> !!TransEnum
- Unsafe.BLAS: IOBanded :: !!ForeignPtr e -> !!Ptr e -> !!Int -> !!Int -> !!Int -> !!Int -> !!Int -> !!Bool -> IOBanded np e
+ Unsafe.BLAS: IOBanded :: !!TransEnum -> !!Int -> !!Int -> !!Int -> !!Int -> !!ForeignPtr e -> !!Ptr e -> !!Int -> IOBanded np e
- Unsafe.BLAS: IOMatrix :: !!ForeignPtr e -> !!Ptr e -> !!Int -> !!Int -> !!Int -> !!Bool -> IOMatrix np e
+ Unsafe.BLAS: IOMatrix :: !!TransEnum -> !!Int -> !!Int -> !!ForeignPtr e -> !!Ptr e -> !!Int -> IOMatrix np e
- Unsafe.BLAS: IOVector :: !!ForeignPtr e -> !!Ptr e -> !!Int -> !!Int -> !!Bool -> IOVector n e
+ Unsafe.BLAS: IOVector :: !!ConjEnum -> !!Int -> !!ForeignPtr e -> !!Ptr e -> !!Int -> IOVector n e

Files

NEWS view
@@ -1,11 +1,8 @@--Changes in 0.7.2:-* Put all exported unsafe functions in Unsafe.BLAS--Changes in 0.7.1:+Changes in 0.7.5: -* Update minimum Quickcheck version in cabal file+* Export all unsafe functions in Unsafe.BLAS. +* Use enumerations instead of Bools in data types.  Changes in 0.7: 
blas.cabal view
@@ -1,5 +1,5 @@ name:            blas-version:         0.7.2+version:         0.7.5 homepage:        http://github.com/patperry/blas synopsis:        Bindings to the BLAS library description:
configure view
@@ -3094,23 +3094,38 @@  fi -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)+# BLAS in Apple vecLib library? if test $ax_blas_ok = no; then-	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5-$as_echo_n "checking for $sgemm in -lblas... " >&6; }-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then+	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"+	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5+$as_echo_n "checking for $sgemm... " >&6; }+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else-  ac_check_lib_save_LIBS=$LIBS-LIBS="-lblas  $LIBS"-cat >conftest.$ac_ext <<_ACEOF+  cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h.  */+/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */+#define $sgemm innocuous_$sgemm +/* System header to define __stub macros and hopefully few prototypes,+    which can conflict with char $sgemm (); below.+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since+    <limits.h> exists even on freestanding compilers.  */++#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif++#undef $sgemm+ /* Override any GCC internal prototype to avoid an error.    Use char because int might match the return type of a GCC    builtin and then its argument prototype would still apply.  */@@ -3118,6 +3133,13 @@ extern "C" #endif char $sgemm ();+/* The GNU C library defines this for functions which it implements+    to always fail with ENOSYS.  Some functions are actually named+    something starting with __ and the normal name is an alias.  */+#if defined __stub_$sgemm || defined __stub___$sgemm+choke me+#endif+ int main () {@@ -3147,33 +3169,41 @@ 	 test "$cross_compiling" = yes || 	 $as_test_x conftest$ac_exeext        }; then-  eval "$as_ac_Lib=yes"+  eval "$as_ac_var=yes" else   $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -	eval "$as_ac_Lib=no"+	eval "$as_ac_var=no" fi  rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \       conftest$ac_exeext conftest.$ac_ext-LIBS=$ac_check_lib_save_LIBS fi-ac_res=`eval 'as_val=${'$as_ac_Lib'}+ac_res=`eval 'as_val=${'$as_ac_var'} 		 $as_echo "$as_val"'` 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; }-if test `eval 'as_val=${'$as_ac_Lib'}+if test `eval 'as_val=${'$as_ac_var'} 		 $as_echo "$as_val"'` = yes; then-  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5-$as_echo_n "checking for $dgemm in -ldgemm... " >&6; }+  ax_blas_ok=yes+	     BLAS_LIBS="-framework vecLib"+fi++	LIBS="$save_LIBS"+fi++# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)+if test $ax_blas_ok = no; then+	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5+$as_echo_n "checking for $sgemm in -lblas... " >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else   ac_check_lib_save_LIBS=$LIBS-LIBS="-ldgemm -lblas $LIBS"+LIBS="-lblas  $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF@@ -3187,11 +3217,11 @@ #ifdef __cplusplus extern "C" #endif-char $dgemm ();+char $sgemm (); int main () {-return $dgemm ();+return $sgemm ();   ;   return 0; }@@ -3236,14 +3266,14 @@ $as_echo "$ac_res" >&6; } if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5-$as_echo_n "checking for $sgemm in -lsgemm... " >&6; }+  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5+$as_echo_n "checking for $dgemm in -ldgemm... " >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else   ac_check_lib_save_LIBS=$LIBS-LIBS="-lsgemm -lblas $LIBS"+LIBS="-ldgemm -lblas $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF@@ -3257,11 +3287,11 @@ #ifdef __cplusplus extern "C" #endif-char $sgemm ();+char $dgemm (); int main () {-return $sgemm ();+return $dgemm ();   ;   return 0; }@@ -3306,25 +3336,14 @@ $as_echo "$ac_res" >&6; } if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"-fi--fi--fi--fi--# BLAS in Intel MKL library?-if test $ax_blas_ok = no; then-	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5-$as_echo_n "checking for $sgemm in -lmkl... " >&6; }+  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5+$as_echo_n "checking for $sgemm in -lsgemm... " >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else   ac_check_lib_save_LIBS=$LIBS-LIBS="-lmkl  $LIBS"+LIBS="-lsgemm -lblas $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF@@ -3387,43 +3406,32 @@ $as_echo "$ac_res" >&6; } if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  ax_blas_ok=yes;BLAS_LIBS="-lmkl"+  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas" fi  fi -# BLAS in Apple vecLib library?+fi++fi++# BLAS in Intel MKL library? if test $ax_blas_ok = no; then-	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"-	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5-$as_echo_n "checking for $sgemm... " >&6; }-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then+	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5+$as_echo_n "checking for $sgemm in -lmkl... " >&6; }+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else-  cat >conftest.$ac_ext <<_ACEOF+  ac_check_lib_save_LIBS=$LIBS+LIBS="-lmkl  $LIBS"+cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h.  */-/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */-#define $sgemm innocuous_$sgemm -/* System header to define __stub macros and hopefully few prototypes,-    which can conflict with char $sgemm (); below.-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since-    <limits.h> exists even on freestanding compilers.  */--#ifdef __STDC__-# include <limits.h>-#else-# include <assert.h>-#endif--#undef $sgemm- /* Override any GCC internal prototype to avoid an error.    Use char because int might match the return type of a GCC    builtin and then its argument prototype would still apply.  */@@ -3431,13 +3439,6 @@ extern "C" #endif char $sgemm ();-/* The GNU C library defines this for functions which it implements-    to always fail with ENOSYS.  Some functions are actually named-    something starting with __ and the normal name is an alias.  */-#if defined __stub_$sgemm || defined __stub___$sgemm-choke me-#endif- int main () {@@ -3467,28 +3468,29 @@ 	 test "$cross_compiling" = yes || 	 $as_test_x conftest$ac_exeext        }; then-  eval "$as_ac_var=yes"+  eval "$as_ac_Lib=yes" else   $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -	eval "$as_ac_var=no"+	eval "$as_ac_Lib=no" fi  rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \       conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS fi-ac_res=`eval 'as_val=${'$as_ac_var'}+ac_res=`eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; }-if test `eval 'as_val=${'$as_ac_var'}+if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"+  ax_blas_ok=yes+	     BLAS_LIBS="-lmkl" fi -	LIBS="$save_LIBS" fi  # BLAS in Alpha CXML library?@@ -4571,23 +4573,38 @@  fi -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)+# BLAS in Apple vecLib library? if test $ax_blas_ok = no; then-	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5-$as_echo_n "checking for $sgemm in -lblas... " >&6; }-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then+	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"+	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5+$as_echo_n "checking for $sgemm... " >&6; }+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else-  ac_check_lib_save_LIBS=$LIBS-LIBS="-lblas  $LIBS"-cat >conftest.$ac_ext <<_ACEOF+  cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h.  */+/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */+#define $sgemm innocuous_$sgemm +/* System header to define __stub macros and hopefully few prototypes,+    which can conflict with char $sgemm (); below.+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since+    <limits.h> exists even on freestanding compilers.  */++#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif++#undef $sgemm+ /* Override any GCC internal prototype to avoid an error.    Use char because int might match the return type of a GCC    builtin and then its argument prototype would still apply.  */@@ -4595,6 +4612,13 @@ extern "C" #endif char $sgemm ();+/* The GNU C library defines this for functions which it implements+    to always fail with ENOSYS.  Some functions are actually named+    something starting with __ and the normal name is an alias.  */+#if defined __stub_$sgemm || defined __stub___$sgemm+choke me+#endif+ int main () {@@ -4624,33 +4648,41 @@ 	 test "$cross_compiling" = yes || 	 $as_test_x conftest$ac_exeext        }; then-  eval "$as_ac_Lib=yes"+  eval "$as_ac_var=yes" else   $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -	eval "$as_ac_Lib=no"+	eval "$as_ac_var=no" fi  rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \       conftest$ac_exeext conftest.$ac_ext-LIBS=$ac_check_lib_save_LIBS fi-ac_res=`eval 'as_val=${'$as_ac_Lib'}+ac_res=`eval 'as_val=${'$as_ac_var'} 		 $as_echo "$as_val"'` 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; }-if test `eval 'as_val=${'$as_ac_Lib'}+if test `eval 'as_val=${'$as_ac_var'} 		 $as_echo "$as_val"'` = yes; then-  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5-$as_echo_n "checking for $dgemm in -ldgemm... " >&6; }+  ax_blas_ok=yes+	     BLAS_LIBS="-framework vecLib"+fi++	LIBS="$save_LIBS"+fi++# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)+if test $ax_blas_ok = no; then+	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5+$as_echo_n "checking for $sgemm in -lblas... " >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else   ac_check_lib_save_LIBS=$LIBS-LIBS="-ldgemm -lblas $LIBS"+LIBS="-lblas  $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF@@ -4664,11 +4696,11 @@ #ifdef __cplusplus extern "C" #endif-char $dgemm ();+char $sgemm (); int main () {-return $dgemm ();+return $sgemm ();   ;   return 0; }@@ -4713,14 +4745,14 @@ $as_echo "$ac_res" >&6; } if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5-$as_echo_n "checking for $sgemm in -lsgemm... " >&6; }+  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5+$as_echo_n "checking for $dgemm in -ldgemm... " >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else   ac_check_lib_save_LIBS=$LIBS-LIBS="-lsgemm -lblas $LIBS"+LIBS="-ldgemm -lblas $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF@@ -4734,11 +4766,11 @@ #ifdef __cplusplus extern "C" #endif-char $sgemm ();+char $dgemm (); int main () {-return $sgemm ();+return $dgemm ();   ;   return 0; }@@ -4783,25 +4815,14 @@ $as_echo "$ac_res" >&6; } if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"-fi--fi--fi--fi--# BLAS in Intel MKL library?-if test $ax_blas_ok = no; then-	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5-$as_echo_n "checking for $sgemm in -lmkl... " >&6; }+  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5+$as_echo_n "checking for $sgemm in -lsgemm... " >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else   ac_check_lib_save_LIBS=$LIBS-LIBS="-lmkl  $LIBS"+LIBS="-lsgemm -lblas $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF@@ -4864,43 +4885,32 @@ $as_echo "$ac_res" >&6; } if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  ax_blas_ok=yes;BLAS_LIBS="-lmkl"+  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas" fi  fi -# BLAS in Apple vecLib library?+fi++fi++# BLAS in Intel MKL library? if test $ax_blas_ok = no; then-	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"-	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`-{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5-$as_echo_n "checking for $sgemm... " >&6; }-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then+	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5+$as_echo_n "checking for $sgemm in -lmkl... " >&6; }+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then   $as_echo_n "(cached) " >&6 else-  cat >conftest.$ac_ext <<_ACEOF+  ac_check_lib_save_LIBS=$LIBS+LIBS="-lmkl  $LIBS"+cat >conftest.$ac_ext <<_ACEOF /* confdefs.h.  */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h.  */-/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */-#define $sgemm innocuous_$sgemm -/* System header to define __stub macros and hopefully few prototypes,-    which can conflict with char $sgemm (); below.-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since-    <limits.h> exists even on freestanding compilers.  */--#ifdef __STDC__-# include <limits.h>-#else-# include <assert.h>-#endif--#undef $sgemm- /* Override any GCC internal prototype to avoid an error.    Use char because int might match the return type of a GCC    builtin and then its argument prototype would still apply.  */@@ -4908,13 +4918,6 @@ extern "C" #endif char $sgemm ();-/* The GNU C library defines this for functions which it implements-    to always fail with ENOSYS.  Some functions are actually named-    something starting with __ and the normal name is an alias.  */-#if defined __stub_$sgemm || defined __stub___$sgemm-choke me-#endif- int main () {@@ -4944,28 +4947,29 @@ 	 test "$cross_compiling" = yes || 	 $as_test_x conftest$ac_exeext        }; then-  eval "$as_ac_var=yes"+  eval "$as_ac_Lib=yes" else   $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -	eval "$as_ac_var=no"+	eval "$as_ac_Lib=no" fi  rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \       conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS fi-ac_res=`eval 'as_val=${'$as_ac_var'}+ac_res=`eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; }-if test `eval 'as_val=${'$as_ac_var'}+if test `eval 'as_val=${'$as_ac_Lib'} 		 $as_echo "$as_val"'` = yes; then-  ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"+  ax_blas_ok=yes+	     BLAS_LIBS="-lmkl" fi -	LIBS="$save_LIBS" fi  # BLAS in Alpha CXML library?
lib/BLAS/Types.hs view
@@ -9,48 +9,63 @@  module BLAS.Types (     OrderEnum(..),+    flipOrder,+     TransEnum(..),+    flipTrans,+     UpLoEnum(..),+    flipUpLo,+     DiagEnum(..),+     SideEnum(..),-    -    flipOrder,-    flipTrans,-    flipUpLo,     flipSide,++    ConjEnum(..),+    flipConj,+             ) where  -- | Matrix element storage order.-data OrderEnum = RowMajor | ColMajor deriving (Eq, Show, Enum)---- | Transpose type.-data TransEnum = NoTrans | ConjTrans deriving (Eq, Show, Enum)---- | Lower or upper triangular storage.-data UpLoEnum = Upper | Lower deriving (Eq, Show, Enum)---- | Diagonal storage.-data DiagEnum = Unit | NonUnit deriving (Eq, Show, Enum)---- | Multiplication side.-data SideEnum = LeftSide | RightSide deriving (Eq, Show, Enum)+data OrderEnum = RowMajor | ColMajor deriving (Eq, Show)  -- | Exchange @RowMajor@ and @ColMajor@. flipOrder :: OrderEnum -> OrderEnum flipOrder RowMajor = ColMajor flipOrder ColMajor = RowMajor +-- | Transpose type.+data TransEnum = NoTrans | ConjTrans deriving (Eq, Show)+ -- | Exchange @NoTrans@ and @ConjTrans@. flipTrans :: TransEnum -> TransEnum flipTrans NoTrans = ConjTrans flipTrans ConjTrans = NoTrans +-- | Lower or upper triangular storage.+data UpLoEnum = Upper | Lower deriving (Eq, Show)+ -- | Exchange @Upper@ and @Lower@. flipUpLo :: UpLoEnum -> UpLoEnum flipUpLo Upper = Lower flipUpLo Lower = Upper-        ++-- | Diagonal storage.+data DiagEnum = Unit | NonUnit deriving (Eq, Show)++-- | Multiplication side.+data SideEnum = LeftSide | RightSide deriving (Eq, Show)+ -- | Exchange @LeftSide@ and @RigthSide@. flipSide :: SideEnum -> SideEnum flipSide LeftSide  = RightSide flipSide RightSide = LeftSide++-- | Vector conjugacy+data ConjEnum = NoConj | Conj deriving (Eq, Show)++-- | Exchange @NoConj@ and @Conj@.+flipConj :: ConjEnum -> ConjEnum+flipConj NoConj = Conj+flipConj Conj   = NoConj
lib/Data/Elem/BLAS/Level1.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -fno-excess-precision #-}-{-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | -- Module     : Data.Elem.BLAS.Level1@@ -9,25 +8,26 @@ -- Maintainer : Patrick Perry <patperry@stanford.edu> -- Stability  : experimental --+-- Vector operations.+--  module Data.Elem.BLAS.Level1     where      -import Prelude hiding ( div )-+import Control.Monad( liftM ) import Foreign ( Ptr, Storable, advancePtr, castPtr, peek, poke, with ) import Foreign.Storable.Complex () import Data.Complex ( Complex(..) )  import Data.Elem.BLAS.Base+import BLAS.Types import BLAS.CTypes import Data.Elem.BLAS.Double   import Data.Elem.BLAS.Zomplex          -- | Types with vector-vector operations. class (Elem a) => BLAS1 a where-    dotu  :: Int -> Ptr a -> Int -> Ptr a -> Int -> IO a-    dotc  :: Int -> Ptr a -> Int -> Ptr a -> Int -> IO a+    dot   :: ConjEnum -> ConjEnum -> Int -> Ptr a -> Int -> Ptr a -> Int -> IO a     nrm2  :: Int -> Ptr a -> Int -> IO Double     asum  :: Int -> Ptr a -> Int -> IO Double     iamax :: Int -> Ptr a -> Int -> IO Int@@ -41,29 +41,28 @@     rotg  :: Ptr a -> Ptr a -> Ptr a -> Ptr a -> IO ()     rot   :: Int -> Ptr a -> Int -> Ptr a -> Int -> Double -> Double -> IO () -    -- Replaces @y@ with @conj y@.+    -- | Replaces @y@ with @conj y@.     vconj  :: Int -> Ptr a -> Int -> IO () -    -- Replaces @y@ with @alpha (conj x) + y@+    -- | Replaces @y@ with @alpha (conj x) + y@     acxpy :: Int -> a -> Ptr a -> Int -> Ptr a -> Int -> IO () -    -- Replaces @y@ with @x*y@.+    -- | Replaces @y@ with @x*y@.     vmul :: Int -> Ptr a -> Int -> Ptr a -> Int -> IO () -    -- Replaces @y@ with @conj(x)*y@.+    -- | Replaces @y@ with @conj(x)*y@.     vcmul :: Int -> Ptr a -> Int -> Ptr a -> Int -> IO () -    -- Replaces @y@ with @y/x@.+    -- | Replaces @y@ with @y/x@.     vdiv :: Int -> Ptr a -> Int -> Ptr a -> Int -> IO () -    -- Replaces @y@ with @y/conj(x)@.+    -- | Replaces @y@ with @y/conj(x)@.     vcdiv :: Int -> Ptr a -> Int -> Ptr a -> Int -> IO ()    instance BLAS1 Double where-    dotu  = ddot-    dotc  = ddot+    dot _ _ = ddot     nrm2  = dnrm2     asum  = dasum     iamax = idamax@@ -81,15 +80,21 @@     vcdiv  = vdiv  instance BLAS1 (Complex Double) where-    dotu n pX incX pY incY =-        with 0 $ \pDotu -> do-            zdotu_sub n pX incX pY incY pDotu-            peek pDotu+    dot conjX conjY n pX incX pY incY =+        case (conjX, conjY) of+            (NoConj, NoConj) -> dotc+            (Conj  , NoConj) -> dotu+            (Conj  , Conj  ) -> liftM conjugate dotc+            (NoConj, Conj  ) -> liftM conjugate dotu+      where+        dotu = with 0 $ \pDotu -> do+                   zdotu_sub n pX incX pY incY pDotu+                   peek pDotu -    dotc n pX incX pY incY =-        with 0 $ \pDotc -> do-            zdotc_sub n pX incX pY incY pDotc-            peek pDotc+        dotc = with 0 $ \pDotc -> do+                   zdotc_sub n pX incX pY incY pDotc+                   peek pDotc+    {-# INLINE dot #-}      nrm2  = znrm2     asum  = zasum
lib/Data/Elem/BLAS/Level2.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE FlexibleInstances #-}-{-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | -- Module     : Data.Elem.BLAS.Level2@@ -7,6 +6,8 @@ -- License    : BSD3 -- Maintainer : Patrick Perry <patperry@stanford.edu> -- Stability  : experimental+--+-- Matrix-Vector operations. --  module Data.Elem.BLAS.Level2
lib/Data/Elem/BLAS/Level3.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE FlexibleInstances #-}-{-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | -- Module     : Data.Elem.BLAS.Level3@@ -7,6 +6,8 @@ -- License    : BSD3 -- Maintainer : Patrick Perry <patperry@stanford.edu> -- Stability  : experimental+--+-- Matrix-Matrix operations. --  module Data.Elem.BLAS.Level3
lib/Data/Matrix/Banded.hs view
@@ -14,8 +14,10 @@     Banded,      -- * Overloaded interface for banded matrices-    BaseBanded( numLower, numUpper, bandwidths-              , maybeMatrixStorageFromBanded, maybeBandedFromMatrixStorage, coerceBanded ),+    BaseBanded( numLower, numUpper, bandwidths, ldaBanded+              , isHermBanded, transEnumBanded+              , maybeMatrixStorageFromBanded +              , maybeBandedFromMatrixStorage, coerceBanded ),      -- * Overloaded interface for matrices     module Data.Matrix.Class,
lib/Data/Matrix/Banded/Base.hs view
@@ -96,9 +96,14 @@     -- banded matrix.     ldaBanded :: a (n,p) e -> Int     -    -- | Indicate whether or not the banded matrix is transposed and-    -- conjugated.+    -- | Get the storage type of the banded matrix.+    transEnumBanded :: a (n,p) e -> TransEnum++    -- | Indicate whether or not the banded matrix storage is +    -- transposed and conjugated.     isHermBanded :: a (n,p) e -> Bool+    isHermBanded = (ConjTrans ==) . transEnumBanded+    {-# INLINE isHermBanded #-}      -- | Cast the shape type of the banded matrix.     coerceBanded :: a np e -> a np' e@@ -425,8 +430,8 @@     {-# INLINE bandwidths #-}     ldaBanded = IO.ldaIOBanded     {-# INLINE ldaBanded #-}-    isHermBanded = IO.isHermIOBanded-    {-# INLINE isHermBanded #-}+    transEnumBanded = IO.transEnumIOBanded+    {-# INLINE transEnumBanded #-}     maybeMatrixStorageFromBanded = IO.maybeMatrixStorageFromIOBanded     {-# INLINE maybeMatrixStorageFromBanded #-}     maybeBandedFromMatrixStorage = IO.maybeIOBandedFromMatrixStorage@@ -652,8 +657,8 @@     {-# INLINE bandwidths #-}     ldaBanded (Banded a) = IO.ldaIOBanded a     {-# INLINE ldaBanded #-}-    isHermBanded (Banded a) = IO.isHermIOBanded a-    {-# INLINE isHermBanded #-}+    transEnumBanded (Banded a) = IO.transEnumIOBanded a+    {-# INLINE transEnumBanded #-}     maybeMatrixStorageFromBanded (Banded a) = liftM Matrix $ IO.maybeMatrixStorageFromIOBanded a     {-# INLINE maybeMatrixStorageFromBanded #-}     maybeBandedFromMatrixStorage mn kl (Matrix a) = 
lib/Data/Matrix/Banded/Class.hs view
@@ -15,7 +15,8 @@ module Data.Matrix.Banded.Class (     -- * Banded matrix type classes     BaseBanded( numLower, numUpper, bandwidths, ldaBanded, isHermBanded-              , maybeMatrixStorageFromBanded, maybeBandedFromMatrixStorage, coerceBanded ),+              , transEnumBanded, maybeMatrixStorageFromBanded+              , maybeBandedFromMatrixStorage, coerceBanded ),     ReadBanded,     WriteBanded, 
lib/Data/Matrix/Banded/IOBase.hs view
@@ -56,34 +56,40 @@ --       are supported. -- data IOBanded np e =-    IOBanded { fptrIOBanded     :: {-# UNPACK #-} !(ForeignPtr e)-             , ptrIOBanded      :: {-# UNPACK #-} !(Ptr e)-             , numRowsIOBanded  :: {-# UNPACK #-} !Int-             , numColsIOBanded  :: {-# UNPACK #-} !Int-             , numLowerIOBanded :: {-# UNPACK #-} !Int-             , numUpperIOBanded :: {-# UNPACK #-} !Int-             , ldaIOBanded      :: {-# UNPACK #-} !Int-             , isHermIOBanded   :: {-# UNPACK #-} !Bool+    IOBanded { transEnumIOBanded :: {-# UNPACK #-} !TransEnum+             , numRowsIOBanded   :: {-# UNPACK #-} !Int+             , numColsIOBanded   :: {-# UNPACK #-} !Int+             , numLowerIOBanded  :: {-# UNPACK #-} !Int+             , numUpperIOBanded  :: {-# UNPACK #-} !Int+             , fptrIOBanded      :: {-# UNPACK #-} !(ForeignPtr e)+             , ptrIOBanded       :: {-# UNPACK #-} !(Ptr e)+             , ldaIOBanded       :: {-# UNPACK #-} !Int              }  hermIOBanded :: IOBanded np e -> IOBanded pn e-hermIOBanded a = a{ numRowsIOBanded  = numColsIOBanded a-                  , numColsIOBanded  = numRowsIOBanded a-                  , numLowerIOBanded = numUpperIOBanded a-                  , numUpperIOBanded = numLowerIOBanded a-                  , isHermIOBanded   = not (isHermIOBanded a)+hermIOBanded a = a{ numRowsIOBanded   = numColsIOBanded a+                  , numColsIOBanded   = numRowsIOBanded a+                  , numLowerIOBanded  = numUpperIOBanded a+                  , numUpperIOBanded  = numLowerIOBanded a+                  , transEnumIOBanded = flipTrans (transEnumIOBanded a)                   } {-# INLINE hermIOBanded #-} +isHermIOBanded :: IOBanded np e -> Bool+isHermIOBanded = (ConjTrans ==) . transEnumIOBanded+{-# INLINE isHermIOBanded #-}+ indexIOBanded :: IOBanded np e -> (Int,Int) -> Int-indexIOBanded (IOBanded _ _ _ _ kl ku ld h) (i,j) =-    let (ku',i',j') = if h then (kl,j,i) else (ku,i,j)+indexIOBanded (IOBanded h _ _ kl ku _ _ ld) (i,j) =+    let (ku',i',j') = if h == ConjTrans then (kl,j,i) else (ku,i,j)     in ku' + (i' - j') + j' * ld {-# INLINE indexIOBanded #-}  hasStorageIOBanded :: IOBanded np e -> (Int,Int) -> Bool-hasStorageIOBanded (IOBanded _ _ m n kl ku _ h) (i,j) =-    let (m',kl',ku',i',j') = if h then (n,ku,kl,j,i) else (m,kl,ku,i,j)+hasStorageIOBanded (IOBanded h m n kl ku _ _ _) (i,j) =+    let (m',kl',ku',i',j') = if h == ConjTrans+                                 then (n,ku,kl,j,i) +                                 else (m,kl,ku,i,j)     in inRange (max 0 (j'-ku'), min (m'-1) (j'+kl')) i' {-# INLINE hasStorageIOBanded #-} @@ -104,16 +110,16 @@ {-# INLINE withIOBandedElem #-}  maybeMatrixStorageFromIOBanded :: IOBanded (n,p) e -> Maybe (IOMatrix (k,p) e)-maybeMatrixStorageFromIOBanded (IOBanded f p _ n kl ku l h)-    | h         = Nothing-    | otherwise = Just $ IOMatrix f p (kl+1+ku) n l False+maybeMatrixStorageFromIOBanded (IOBanded h _ n kl ku f p l)+    | h == ConjTrans = Nothing+    | otherwise      = Just $ IOMatrix NoTrans (kl+1+ku) n f p l {-# INLINE maybeMatrixStorageFromIOBanded #-}  maybeIOBandedFromMatrixStorage :: (Int,Int)                    -> (Int,Int)                    -> IOMatrix np e                    -> Maybe (IOBanded np' e)-maybeIOBandedFromMatrixStorage (m,n) (kl,ku) (IOMatrix f p m' n' l h)+maybeIOBandedFromMatrixStorage (m,n) (kl,ku) (IOMatrix h m' n' f p l)     | m < 0 || n < 0 =         err "dimensions must be non-negative."     | kl < 0 =@@ -130,30 +136,32 @@     | n' /= n =         err $ "numbers of columns must be equal"             ++ " to the number of columns in the underlying matrix."-    | h =+    | h == ConjTrans =         Nothing         | otherwise =-        Just $ IOBanded f p m n kl ku l False+        Just $ IOBanded NoTrans m n kl ku f p l   where     err s =        error $ "maybeBandedFromMatrixStorage " ++ show (m,n) ++ " " ++ show (kl,ku)              ++ " <matrix of shape " ++ show (m',n') ++ ">: " ++ show s  viewVectorAsIOBanded :: (Int,Int) -> IOVector k e -> IOBanded (n,p) e-viewVectorAsIOBanded (m,n) (IOVector f p k l c)+viewVectorAsIOBanded (m,n) (IOVector c k f p l)     | k /= m && k /= n =         error $ "viewVectorAsBanded " ++ show (m,n) ++ " "               ++ " <vector of dim " ++ show k ++ ">: "               ++ "vector must have length equal to one of the specified"               ++ " diemsion sizes"     | otherwise =-        IOBanded f p m n 0 0 l c+        let h = if c == Conj then ConjTrans else NoTrans+        in IOBanded h m n 0 0 f p l {-# INLINE viewVectorAsIOBanded #-}  maybeViewIOBandedAsVector :: IOBanded (n,p) e -> Maybe (IOVector k e)-maybeViewIOBandedAsVector (IOBanded f p m n kl ku l h)+maybeViewIOBandedAsVector (IOBanded h m n kl ku f p l)     | kl == 0 && ku == 0 =-        Just $ IOVector f p (min m n) l h+        let c = if h == ConjTrans then Conj else NoConj+        in Just $ IOVector c (min m n) f p l     | otherwise =         Nothing {-# INLINE maybeViewIOBandedAsVector #-}@@ -176,7 +184,7 @@ {-# INLINE boundsIOBanded #-}  sizeIOBanded :: IOBanded np e -> Int-sizeIOBanded (IOBanded _ _ m n kl ku _ _) =+sizeIOBanded (IOBanded _ m n kl ku _ _ _) =     foldl' (+) 0 $ map (diagLen (m,n)) [(-kl)..ku]  indicesIOBanded :: IOBanded np e -> [(Int,Int)]@@ -266,11 +274,11 @@     | otherwise =         let m'  = kl + 1 + ku             l   = m'-            h   = False+            h   = NoTrans         in do             fp <- mallocForeignPtrArray (m' * n)             let p = unsafeForeignPtrToPtr fp-            return $ IOBanded fp p m n kl ku l h+            return $ IOBanded h m n kl ku fp p l     where       err s = fail $ "newBanded_ " ++ show (m,n) ++ " " ++ show (kl,ku) ++ ": " ++ s @@ -353,8 +361,8 @@                       => IOBanded np e                       -> Int                       -> (Int, IOVector k e, Int)-unsafeRowViewIOBanded a@(IOBanded f p _ n kl ku ld h) i =-    if h then+unsafeRowViewIOBanded a@(IOBanded h _ n kl ku f p ld) i =+    if h == ConjTrans then         case unsafeColViewIOBanded (hermIOBanded a) i of             (nb, v, na) -> (nb, conj v, na)     else@@ -365,14 +373,14 @@             p'  = p `advancePtr` (r + c * ld)             inc = max (ld - 1) 1             len = n - (nb + na)-        in (nb, IOVector f p' len inc False, na)+        in (nb, IOVector NoConj len f p' inc, na)  unsafeColViewIOBanded :: (Elem e)                       => IOBanded np e                       -> Int                       -> (Int, IOVector k e, Int)-unsafeColViewIOBanded a@(IOBanded f p m _ kl ku ld h) j =-    if h then+unsafeColViewIOBanded a@(IOBanded h m _ kl ku f p ld) j =+    if h == ConjTrans then         case unsafeRowViewIOBanded (hermIOBanded a) j of             (nb, v, na) -> (nb, conj v, na)     else@@ -383,19 +391,19 @@             p'  = p `advancePtr` (r + c * ld)             inc = 1             len = m - (nb + na)-        in (nb, IOVector f p' len inc False, na)+        in (nb, IOVector NoConj len f p' inc, na)  unsafeDiagViewIOBanded :: (Elem e) =>      IOBanded np e -> Int -> IOVector k e-unsafeDiagViewIOBanded a@(IOBanded fp p m n _ _ ld h) d-    | h         = conj $ unsafeDiagViewIOBanded (hermIOBanded a) (negate d)+unsafeDiagViewIOBanded a@(IOBanded h m n _ _ fp p ld) d+    | h == ConjTrans =+         conj $ unsafeDiagViewIOBanded (hermIOBanded a) (negate d)     | otherwise =         let off = indexIOBanded a (diagStart d)             p'  = p `advancePtr` off             len = diagLen (m,n) d             inc = ld-            c   = False-        in (IOVector fp p' len inc c)+        in (IOVector NoConj len fp p' inc)   unsafeGetRowIOBanded :: (WriteVector y e IO, BLAS1 e) @@ -426,7 +434,7 @@         gbmv alpha a x beta (conj y)         doConjVector y     | otherwise =-        let transA = transIOBanded a+        let transA = transEnumIOBanded a             (m,n)  = case (isHermIOBanded a) of                          False -> shape a                          True  -> (flipShape . shape) a@@ -683,11 +691,3 @@     {-# INLINE unsafeDoSSolve #-}     unsafeDoSSolveMat  = tbsm'     {-# INLINE unsafeDoSSolveMat #-}    --transIOBanded :: IOBanded np e -> TransEnum-transIOBanded a =-    case (isHermIOBanded a) of-          False -> NoTrans-          True  -> ConjTrans-{-# INLINE transIOBanded #-}-
lib/Data/Matrix/Banded/STBase.hs view
@@ -111,8 +111,8 @@     {-# INLINE bandwidths #-}     ldaBanded (STBanded a) = IO.ldaIOBanded a     {-# INLINE ldaBanded #-}-    isHermBanded (STBanded a) = IO.isHermIOBanded a-    {-# INLINE isHermBanded #-}+    transEnumBanded (STBanded a) = IO.transEnumIOBanded a+    {-# INLINE transEnumBanded #-}     maybeMatrixStorageFromBanded (STBanded a) =          liftM STMatrix $ IO.maybeMatrixStorageFromIOBanded a     {-# INLINE maybeMatrixStorageFromBanded #-}
lib/Data/Matrix/Dense.hs view
@@ -15,7 +15,7 @@     Matrix,      -- * Overloaded interface for dense matrices-    BaseMatrix( isHermMatrix, coerceMatrix ),+    BaseMatrix( ldaMatrix, isHermMatrix, transEnumMatrix, coerceMatrix ),      -- * Overloaded interface for matrices     module Data.Matrix.Class,
lib/Data/Matrix/Dense/Base.hs view
@@ -71,9 +71,18 @@ -- | Common functionality for all dense matrix types. class (HasVectorView a, Elem e, MatrixShaped a       , BaseVector (VectorView a) e) => BaseMatrix a e where-          +      +    -- | Get the leading dimension of the storage of the matrix.         ldaMatrix :: a (n,p) e -> Int+    +    -- | Get the storage type of the matrix.+    transEnumMatrix :: a (n,p) e -> TransEnum+    +    -- | Indicate whether or not the underlying matrix storage is+    -- transposed and conjugated.     isHermMatrix :: a (n,p) e -> Bool+    isHermMatrix = (ConjTrans ==) . transEnumMatrix+    {-# INLINE isHermMatrix #-}      -- | Cast the shape type of the matrix.     coerceMatrix :: a np e -> a np' e@@ -708,7 +717,7 @@              | isConj y && (isConj x || stride x == 1) =         let transA = if isConj x then NoTrans else ConjTrans-            transB = transMatrix (herm a)+            transB = transEnumMatrix (herm a)             m      = 1             n      = dim y             k      = dim x@@ -731,7 +740,7 @@         doConjVector y              | otherwise =-        let transA = transMatrix a+        let transA = transEnumMatrix a             (m,n)  = case (isHermMatrix a) of                          False -> shape a                          True  -> (flipShape . shape) a@@ -757,8 +766,8 @@         scaleByMatrix beta c     | isHermMatrix c = gemm (conjugate alpha) (herm b) (herm a) (conjugate beta) (herm c)     | otherwise =-        let transA = transMatrix a-            transB = transMatrix b+        let transA = transEnumMatrix a+            transB = transEnumMatrix b             (m,n)  = shape c             k      = numCols a             ldA    = ldaMatrix a@@ -1197,8 +1206,8 @@ instance (Elem e) => BaseMatrix IOMatrix e where     ldaMatrix = ldaMatrixIOMatrix     {-# INLINE ldaMatrix #-}-    isHermMatrix = isHermIOMatrix-    {-# INLINE isHermMatrix #-}+    transEnumMatrix = transEnumIOMatrix+    {-# INLINE transEnumMatrix #-}     unsafeSubmatrixView = unsafeSubmatrixViewIOMatrix     {-# INLINE unsafeSubmatrixView #-}     unsafeDiagView = unsafeDiagViewIOMatrix@@ -1411,8 +1420,8 @@ {-# INLINE unsafeDiag #-}  unsafeAtMatrix :: (Elem e) => Matrix np e -> (Int,Int) -> e-unsafeAtMatrix (Matrix (IOMatrix f p _ _ l h)) (i,j)-    | h = inlinePerformIO $ do+unsafeAtMatrix (Matrix (IOMatrix h _ _ f p l)) (i,j)+    | h == ConjTrans = inlinePerformIO $ do         e  <- liftM conjugate $ peekElemOff p (i*l+j)         io <- touchForeignPtr f         e `seq` io `seq` return e@@ -1480,8 +1489,8 @@ instance (Elem e) => BaseMatrix Matrix e where     ldaMatrix (Matrix a) = ldaMatrixIOMatrix a     {-# INLINE ldaMatrix #-}-    isHermMatrix (Matrix a) = isHermMatrix a-    {-# INLINE isHermMatrix #-}+    transEnumMatrix (Matrix a) = transEnumIOMatrix a+    {-# INLINE transEnumMatrix #-}     unsafeSubmatrixView (Matrix a) ij mn =         Matrix (unsafeSubmatrixViewIOMatrix a ij mn)     {-# INLINE unsafeSubmatrixView #-}@@ -1781,13 +1790,6 @@     c <- newCopyMatrix a     f c b     return c--transMatrix :: (BaseMatrix a e) => a (n,p) e -> TransEnum-transMatrix a = -    case (isHermMatrix a) of-          False -> NoTrans-          True  -> ConjTrans-{-# INLINE transMatrix #-}  indexOfMatrix :: (BaseMatrix a e) => a (n,p) e -> (Int,Int) -> Int indexOfMatrix a (i,j) = 
lib/Data/Matrix/Dense/Class.hs view
@@ -14,7 +14,7 @@  module Data.Matrix.Dense.Class (     -- * Dense matrix type classes-    BaseMatrix( ldaMatrix, isHermMatrix, coerceMatrix ),+    BaseMatrix( ldaMatrix, isHermMatrix, transEnumMatrix, coerceMatrix ),     ReadMatrix,     WriteMatrix,     
lib/Data/Matrix/Dense/IOBase.hs view
@@ -41,12 +41,12 @@ --       are supported. -- data IOMatrix np e =-      IOMatrix {-# UNPACK #-} !(ForeignPtr e) -- a pointer to the storage region-               {-# UNPACK #-} !(Ptr e)        -- a pointer to the first element+      IOMatrix {-# UNPACK #-} !TransEnum      -- indicates whether or not the matrix is transposed and conjugated                {-# UNPACK #-} !Int            -- the number of rows in the matrix                {-# UNPACK #-} !Int            -- the number of colunps in the matrix+               {-# UNPACK #-} !(ForeignPtr e) -- a pointer to the storage region+               {-# UNPACK #-} !(Ptr e)        -- a pointer to the first element                {-# UNPACK #-} !Int            -- the leading dimension size of the matrix-               {-# UNPACK #-} !Bool           -- indicates whether or not the matrix is transposed and conjugated  -- | View an array in memory as a matrix. matrixViewArray :: (Elem e)@@ -67,113 +67,118 @@                        -> IOMatrix (n,p) e matrixViewArrayWithLda l f o (m,n) =     let p = unsafeForeignPtrToPtr f `advancePtr` o-    in IOMatrix f p m n l False+    in IOMatrix NoTrans m n f p l {-# INLINE matrixViewArrayWithLda #-}   numRowsIOMatrix :: IOMatrix np e -> Int-numRowsIOMatrix (IOMatrix _ _ m _ _ _) = m+numRowsIOMatrix (IOMatrix _ m _ _ _ _) = m {-# INLINE numRowsIOMatrix #-}  numColsIOMatrix :: IOMatrix np e -> Int-numColsIOMatrix (IOMatrix _ _ _ n _ _) = n+numColsIOMatrix (IOMatrix _ _ n _ _ _) = n {-# INLINE numColsIOMatrix #-}  ldaMatrixIOMatrix :: IOMatrix np e -> Int-ldaMatrixIOMatrix (IOMatrix _ _ _ _ l _) = l+ldaMatrixIOMatrix (IOMatrix _ _ _ _ _ l) = l {-# INLINE ldaMatrixIOMatrix #-} +transEnumIOMatrix :: IOMatrix np e -> TransEnum+transEnumIOMatrix (IOMatrix h _ _ _ _ _) = h+{-# INLINE transEnumIOMatrix #-}+ isHermIOMatrix :: IOMatrix np e -> Bool-isHermIOMatrix (IOMatrix _ _ _ _ _ h) = h+isHermIOMatrix = (ConjTrans ==) . transEnumIOMatrix {-# INLINE isHermIOMatrix #-}  hermIOMatrix :: IOMatrix np e -> IOMatrix nm e-hermIOMatrix (IOMatrix f p m n l h) = (IOMatrix f p n m l (not h))+hermIOMatrix (IOMatrix h m n f p l) = (IOMatrix (flipTrans h) n m f p l) {-# INLINE hermIOMatrix #-}  unsafeSubmatrixViewIOMatrix :: (Elem e) =>     IOMatrix np e -> (Int,Int) -> (Int,Int) -> IOMatrix np' e-unsafeSubmatrixViewIOMatrix (IOMatrix f p _ _ l h) (i,j) (m',n') =-    let o = if h then i*l+j else i+j*l+unsafeSubmatrixViewIOMatrix (IOMatrix h _ _ f p l) (i,j) (m',n') =+    let o = if h == ConjTrans then i*l+j else i+j*l         p' = p `advancePtr` o-    in IOMatrix f p' m' n' l h+    in IOMatrix h m' n' f p' l {-# INLINE unsafeSubmatrixViewIOMatrix #-}  unsafeRowViewIOMatrix :: (Elem e) => IOMatrix np e -> Int -> IOVector p e-unsafeRowViewIOMatrix (IOMatrix f p _ n l h) i =-    let (o,s) = if h then (i*l,1) else (i,l)-        p'    = p `advancePtr` o-    in IOVector f p' n s h+unsafeRowViewIOMatrix (IOMatrix h _ n f p l) i =+    let (c,o,s) = if h == ConjTrans then (Conj,i*l,1) else (NoConj,i,l)+        p'      = p `advancePtr` o+    in IOVector c n f p' s {-# INLINE unsafeRowViewIOMatrix #-}  unsafeColViewIOMatrix :: (Elem e) => IOMatrix np e -> Int -> IOVector n e-unsafeColViewIOMatrix (IOMatrix f p m _ l h) j =-    let (o,s) = if h then (j,l) else (j*l,1)-        p'    = p `advancePtr` o-    in IOVector f p' m s h+unsafeColViewIOMatrix (IOMatrix h m _ f p l) j =+    let (c,o,s) = if h == ConjTrans then (Conj,j,l) else (NoConj,j*l,1)+        p'      = p `advancePtr` o+    in IOVector c m f p' s {-# INLINE unsafeColViewIOMatrix #-}  unsafeDiagViewIOMatrix :: (Elem e) => IOMatrix np e -> Int -> IOVector k e-unsafeDiagViewIOMatrix (IOMatrix f p m n l h) i =+unsafeDiagViewIOMatrix (IOMatrix h m n f p l) i =     let o = if i >= 0 -                then if h then  i   else  i*l-                else if h then -i*l else -i+                then if h == ConjTrans then  i   else  i*l+                else if h == ConjTrans then -i*l else -i+        c  = if h == ConjTrans then Conj else NoConj         p' = p `advancePtr` o         k  = diagLen (m,n) i         s  = l+1-    in IOVector f p' k s h+    in IOVector c k f p' s {-# INLINE unsafeDiagViewIOMatrix #-}  maybeViewVectorAsRowIOMatrix :: (Elem e) => IOVector p e -> Maybe (IOMatrix p1 e)-maybeViewVectorAsRowIOMatrix (IOVector f p n s c)-    | c && (s == 1) =-        Just $ IOMatrix f p 1 n (max 1 n) True-    | not c =-        Just $ IOMatrix f p 1 n s         False+maybeViewVectorAsRowIOMatrix (IOVector c n f p s)+    | c == Conj && s == 1 =+        Just $ IOMatrix ConjTrans 1 n f p (max 1 n)+    | c == NoConj =+        Just $ IOMatrix NoTrans   1 n f p s     | otherwise =         Nothing {-# INLINE maybeViewVectorAsRowIOMatrix #-}  maybeViewVectorAsColIOMatrix :: (Elem e) => IOVector n e -> Maybe (IOMatrix n1 e)-maybeViewVectorAsColIOMatrix (IOVector f p n s c)-    | c =-        Just $ IOMatrix f p n 1 s         True+maybeViewVectorAsColIOMatrix (IOVector c n f p s)+    | c == Conj =+        Just $ IOMatrix ConjTrans n 1 f p s             | s == 1 =-        Just $ IOMatrix f p n 1 (max 1 n) False+        Just $ IOMatrix NoTrans   n 1 f p (max 1 n)     | otherwise =         Nothing {-# INLINE maybeViewVectorAsColIOMatrix #-}  maybeViewIOMatrixAsVector :: (Elem e) => IOMatrix np e -> Maybe (IOVector k e)-maybeViewIOMatrixAsVector (IOMatrix f p m n l h)-    | h         = Nothing-    | l /= m    = Nothing-    | otherwise = Just $ IOVector f p (m*n) 1 False+maybeViewIOMatrixAsVector (IOMatrix h m n f p l)+    | h == ConjTrans = Nothing+    | l /= m         = Nothing+    | otherwise      = Just $ IOVector NoConj (m*n) f p 1 {-# INLINE maybeViewIOMatrixAsVector #-}  maybeViewVectorAsIOMatrix :: (Elem e) => (Int,Int) -> IOVector k e -> Maybe (IOMatrix np e)-maybeViewVectorAsIOMatrix (m,n) (IOVector f p k inc c)+maybeViewVectorAsIOMatrix (m,n) (IOVector c k f p inc)     | m*n /= k =         error $ "maybeViewVectorAsMatrix " ++ show (m,n)               ++ " <vector of dim " ++ show k ++ ">: vector dimension"               ++ " must equal product of specified dimensions"-    | c         = Nothing+    | c == Conj = Nothing     | inc /= 1  = Nothing-    | otherwise = Just $ IOMatrix f p m n m False+    | otherwise = Just $ IOMatrix NoTrans m n f p m {-# INLINE maybeViewVectorAsIOMatrix #-}  liftIOMatrix :: (Elem e) => (forall n. IOVector n e -> IO ()) -> IOMatrix np e -> IO ()-liftIOMatrix g (IOMatrix f p m n l h)-    | h && (l == n) =-        g (IOVector f p (m*n) 1 True)-    | (not h) && (l == m) =-        g (IOVector f p (m*n) 1 False)+liftIOMatrix g (IOMatrix h m n f p l)+    | h == ConjTrans && l == n =+        g (IOVector Conj   (m*n) f p 1)+    | h == NoTrans   && l == m =+        g (IOVector NoConj (m*n) f p 1)     | otherwise =-        let (m',n') = if h then (n,m) else (m,n)+        let (c,m',n') = if h == ConjTrans then (Conj,n,m) else (NoConj,m,n)             end     = p `advancePtr` (n'*l)             go p' | p' == end = return ()                   | otherwise = do-                      g (IOVector f p' m' 1 h)+                      g (IOVector c m' f p' 1)                       go (p' `advancePtr` l)         in go p @@ -203,7 +208,7 @@ -- | Perform an 'IO' action with a pointer to the first element of the -- matrix. withIOMatrix :: IOMatrix (n,p) e -> (Ptr e -> IO a) -> IO a-withIOMatrix (IOMatrix f p _ _ _ _) g = do+withIOMatrix (IOMatrix _ _ _ f p _) g = do     a <- g p     touchForeignPtr f     return a@@ -217,15 +222,15 @@             "Tried to create a matrix with shape `" ++ show (m,n) ++ "'"     | otherwise =  do         f <- mallocForeignPtrArray (m*n)-        return (IOMatrix f (unsafeForeignPtrToPtr f) m n (max 1 m) False)+        return $ IOMatrix NoTrans m n f (unsafeForeignPtrToPtr f) (max 1 m) {-# INLINE newIOMatrix_ #-}  newCopyIOMatrix :: (BLAS1 e) => IOMatrix np e -> IO (IOMatrix np e)-newCopyIOMatrix (IOMatrix f p m n l h) = -    let (m',n') = if h then (n,m) else (m,n)+newCopyIOMatrix (IOMatrix h m n f p l) = +    let (m',n') = if h == ConjTrans then (n,m) else (m,n)         l'      = max 1 m'     in do-        (IOMatrix f' p' _ _ _ _) <- newIOMatrix_ (m',n')+        (IOMatrix _ _ _ f' p' _) <- newIOMatrix_ (m',n')         if l == m'             then do                 BLAS.copy (m*n) p 1 p' 1@@ -237,11 +242,11 @@                 in go p p' 0         touchForeignPtr f         touchForeignPtr f'-        return (IOMatrix f' p' m n l' h)+        return (IOMatrix h m n f' p' l') {-# INLINE newCopyIOMatrix #-}  shapeIOMatrix :: IOMatrix np e -> (Int,Int)-shapeIOMatrix (IOMatrix _ _ m n _ _) = (m,n)+shapeIOMatrix (IOMatrix _ m n _ _ _) = (m,n) {-# INLINE shapeIOMatrix #-}  boundsIOMatrix :: IOMatrix np e -> ((Int,Int), (Int,Int))@@ -249,7 +254,7 @@ {-# INLINE boundsIOMatrix #-}  sizeIOMatrix :: IOMatrix np e -> Int-sizeIOMatrix (IOMatrix _ _ m n _ _) = m*n+sizeIOMatrix (IOMatrix _ m n _ _ _) = m*n {-# INLINE sizeIOMatrix #-}  getSizeIOMatrix :: IOMatrix np e -> IO Int@@ -261,9 +266,9 @@ {-# INLINE getMaxSizeIOMatrix #-}  indicesIOMatrix :: IOMatrix np e -> [(Int,Int)]-indicesIOMatrix (IOMatrix _ _ m n _ h)-    | h         = [ (i,j) | i <- [ 0..m-1 ], j <- [ 0..n-1 ] ]-    | otherwise = [ (i,j) | j <- [ 0..n-1 ], i <- [ 0..m-1 ] ]+indicesIOMatrix (IOMatrix h m n _ _ _)+    | h == ConjTrans = [ (i,j) | i <- [ 0..m-1 ], j <- [ 0..n-1 ] ]+    | otherwise      = [ (i,j) | j <- [ 0..n-1 ], i <- [ 0..m-1 ] ] {-# INLINE indicesIOMatrix #-}  getIndicesIOMatrix :: IOMatrix np e -> IO [(Int,Int)]@@ -275,15 +280,17 @@ {-# INLINE getIndicesIOMatrix' #-}  getElemsIOMatrix :: (Elem e) => IOMatrix np e -> IO [e]-getElemsIOMatrix (IOMatrix f p m n l h) -    | h         = liftM (map conjugate) $ -                      getElemsIOMatrix (IOMatrix f p n m l False)-    | l == m    = getElemsIOVector (IOVector f p (m*n) 1 False)+getElemsIOMatrix (IOMatrix h m n f p l)+    | h == ConjTrans = +        liftM (map conjugate) $ +            getElemsIOMatrix (IOMatrix NoTrans n m f p l)+    | l == m = +        getElemsIOVector (IOVector NoConj (m*n) f p 1)     | otherwise =         let end   = p `advancePtr` (n*l)             go p' | p' == end = return []                   | otherwise = unsafeInterleaveIO $ do-                        c  <- getElemsIOVector (IOVector f p' m 1 False)+                        c  <- getElemsIOVector (IOVector NoConj m f p' 1)                         cs <- go (p' `advancePtr` l)                         return (c ++ cs)         in go p@@ -291,15 +298,17 @@ {-# SPECIALIZE INLINE getElemsIOMatrix :: IOMatrix np (Complex Double) -> IO [Complex Double] #-}  getElemsIOMatrix' :: (Elem e) => IOMatrix np e -> IO [e]-getElemsIOMatrix' (IOMatrix f p m n l h) -    | h         = liftM (map conjugate) $ -                      getElemsIOMatrix' (IOMatrix f p n m l False)-    | l == m    = getElemsIOVector' (IOVector f p (m*n) 1 False)+getElemsIOMatrix' (IOMatrix h m n f p l) +    | h == ConjTrans = +        liftM (map conjugate) $ +            getElemsIOMatrix' (IOMatrix NoTrans n m f p l)+    | l == m    = +        getElemsIOVector' (IOVector NoConj (m*n) f p 1)     | otherwise =         let end   = p `advancePtr` (n*l)             go p' | p' == end = return []                   | otherwise = do-                        c  <- getElemsIOVector' (IOVector f p' m 1 False)+                        c  <- getElemsIOVector' (IOVector NoConj m f p' 1)                         cs <- go (p' `advancePtr` l)                         return (c ++ cs)         in go p@@ -321,8 +330,8 @@ {-# INLINE getAssocsIOMatrix' #-}  unsafeReadElemIOMatrix :: (Elem e) => IOMatrix np e -> (Int,Int) -> IO e-unsafeReadElemIOMatrix (IOMatrix f p _ _ l h) (i,j)-    | h = do+unsafeReadElemIOMatrix (IOMatrix h _ _ f p l) (i,j)+    | h == ConjTrans = do         e <- liftM conjugate $ peekElemOff p (i*l+j)         touchForeignPtr f         return e@@ -339,8 +348,8 @@  unsafeWriteElemIOMatrix :: (Elem e) =>      IOMatrix np e -> (Int,Int) -> e -> IO ()-unsafeWriteElemIOMatrix (IOMatrix f p _ _ l h) (i,j) e-    | h = do+unsafeWriteElemIOMatrix (IOMatrix h _ _ f p l) (i,j) e+    | h == ConjTrans = do         pokeElemOff p (i*l+j) (conjugate e)         touchForeignPtr f     | otherwise = do@@ -351,9 +360,10 @@  unsafeModifyElemIOMatrix :: (Elem e) =>      IOMatrix n e -> (Int,Int) -> (e -> e) -> IO ()-unsafeModifyElemIOMatrix (IOMatrix f p _ _ l h) (i,j) g =-    let g' = if h then conjugate . g . conjugate else g-        p' = if h then p `advancePtr` (i*l+j) else p `advancePtr` (i+j*l)+unsafeModifyElemIOMatrix (IOMatrix h _ _ f p l) (i,j) g =+    let g' = if h == ConjTrans then conjugate . g . conjugate else g+        p' = if h == ConjTrans then p `advancePtr` (i*l+j) +                               else p `advancePtr` (i+j*l)     in do         e <- peek p'         poke p' (g' e)@@ -363,9 +373,11 @@  unsafeSwapElemsIOMatrix :: (Elem e) =>      IOMatrix n e -> (Int,Int) -> (Int,Int) -> IO ()-unsafeSwapElemsIOMatrix (IOMatrix f p _ _ l h) (i1,j1) (i2,j2) =-    let (p1,p2) = if h then (p `advancePtr` (i1*l+j1), p `advancePtr` (i2*l+j2))-                       else (p `advancePtr` (i1+j1*l), p `advancePtr` (i2+j2*l))+unsafeSwapElemsIOMatrix (IOMatrix h _ _ f p l) (i1,j1) (i2,j2) =+    let (p1,p2) = +            if h == ConjTrans +                then (p `advancePtr` (i1*l+j1), p `advancePtr` (i2*l+j2))+                else (p `advancePtr` (i1+j1*l), p `advancePtr` (i2+j2*l))     in do         e1 <- peek p1         e2 <- peek p2
lib/Data/Matrix/Dense/STBase.hs view
@@ -156,8 +156,8 @@ instance (Elem e) => BaseMatrix (STMatrix s) e where     ldaMatrix (STMatrix a) = ldaMatrixIOMatrix a     {-# INLINE ldaMatrix #-}-    isHermMatrix (STMatrix a) = isHermMatrix a-    {-# INLINE isHermMatrix #-}+    transEnumMatrix (STMatrix a) = transEnumIOMatrix a+    {-# INLINE transEnumMatrix #-}     unsafeSubmatrixView (STMatrix a) ij mn =         STMatrix (unsafeSubmatrixViewIOMatrix a ij mn)     {-# INLINE unsafeSubmatrixView #-}
lib/Data/Vector/Dense.hs view
@@ -13,7 +13,7 @@     Vector,      -- * Overloaded interface for vectors-    BaseVector( dim, conj, isConj, coerceVector ),+    BaseVector( dim, conj, isConj, conjEnum, coerceVector ),      -- * Creating new vectors     vector, 
lib/Data/Vector/Dense/Base.hs view
@@ -20,6 +20,7 @@  import BLAS.Internal( checkBinaryOp, clearArray, inlinePerformIO,     checkedSubvector, checkedSubvectorWithStride, checkVecVecOp )+import BLAS.Types( ConjEnum(..) )  import Data.Elem.BLAS ( Complex, Elem, BLAS1, conjugate ) import qualified Data.Elem.BLAS.Level1 as BLAS@@ -67,7 +68,12 @@     -- | Indicate whether or not internally the vector stores the complex     -- conjugates of its elements.     isConj :: x n e -> Bool+    isConj x = conjEnum x == Conj+    {-# INLINE isConj #-} +    -- | Get the storage type.+    conjEnum :: x n e -> ConjEnum+         -- | Get a view into the complex conjugate of a vector.     conj :: x n e -> x n e @@ -495,11 +501,7 @@ unsafeGetDot :: (ReadVector x e m, ReadVector y e m) =>      x n e -> y n e -> m e unsafeGetDot x y =-    case (isConj x, isConj y) of-        (False, False) -> vectorCall2 BLAS.dotc x y-        (True , False) -> vectorCall2 BLAS.dotu x y-        (False, True ) -> liftM conjugate $ vectorCall2 BLAS.dotu x y-        (True , True)  -> liftM conjugate $ vectorCall2 BLAS.dotc x y+    vectorCall2 (BLAS.dot (conjEnum x) (conjEnum y)) x y {-# INLINE unsafeGetDot #-}  instance (Elem e) => BaseVector IOVector e where@@ -507,8 +509,8 @@     {-# INLINE dim #-}     stride = strideIOVector     {-# INLINE stride #-}-    isConj = isConjIOVector-    {-# INLINE isConj #-}+    conjEnum = conjEnumIOVector+    {-# INLINE conjEnum #-}     conj = conjIOVector     {-# INLINE conj #-}     unsafeSubvectorViewWithStride = unsafeSubvectorViewWithStrideIOVector@@ -628,7 +630,7 @@  elemsVector :: (Elem e) => Vector n e -> [e] elemsVector x | isConj x  = (map conjugate . elemsVector . conj) x-              | otherwise = case x of { (Vector (IOVector f p n incX _)) ->+              | otherwise = case x of { (Vector (IOVector _ n f p incX)) ->     let end = p `advancePtr` (n*incX)         go p' | p' == end = inlinePerformIO $ do                                 io <- touchForeignPtr f@@ -646,7 +648,7 @@  unsafeAtVector :: (Elem e) => Vector n e -> Int -> e unsafeAtVector x i | isConj x  = conjugate $ unsafeAtVector (conj x) i-                   | otherwise = case x of { (Vector (IOVector f p _ inc _)) ->+                   | otherwise = case x of { (Vector (IOVector _ _ f p inc)) ->     inlinePerformIO $ do         e  <- peekElemOff p (i*inc)         io <- touchForeignPtr f@@ -758,8 +760,8 @@     {-# INLINE dim #-}     stride (Vector x) = strideIOVector x     {-# INLINE stride #-}-    isConj (Vector x) = isConjIOVector x-    {-# INLINE isConj #-}+    conjEnum (Vector x) = conjEnumIOVector x+    {-# INLINE conjEnum #-}     conj (Vector x) = (Vector (conjIOVector x))     {-# INLINE conj #-}     unsafeSubvectorViewWithStride s (Vector x) o n = 
lib/Data/Vector/Dense/Class.hs view
@@ -14,7 +14,7 @@  module Data.Vector.Dense.Class (     -- * Dense vector type classes-    BaseVector( dim, conj, stride, isConj, coerceVector ),+    BaseVector( dim, conj, stride, isConj, conjEnum, coerceVector ),     ReadVector,     WriteVector,     
lib/Data/Vector/Dense/IOBase.hs view
@@ -17,6 +17,7 @@ import System.IO.Unsafe  import BLAS.Internal ( clearArray )+import BLAS.Types( ConjEnum(..), flipConj ) import Data.Elem.BLAS ( Complex, Elem, BLAS1, conjugate ) import qualified Data.Elem.BLAS.Level1 as BLAS @@ -31,11 +32,11 @@ --       are supported. -- data IOVector n e = -      IOVector {-# UNPACK #-} !(ForeignPtr e) -- memory owner-               {-# UNPACK #-} !(Ptr e)        -- pointer to the first element+      IOVector {-# UNPACK #-} !ConjEnum                       {-# UNPACK #-} !Int            -- the length of the vector+               {-# UNPACK #-} !(ForeignPtr e) -- memory owner+               {-# UNPACK #-} !(Ptr e)        -- pointer to the first element                {-# UNPACK #-} !Int            -- the stride (in elements, not bytes) between elements.-               {-# UNPACK #-} !Bool           -- indicates whether or not the vector is conjugated  -- | View an array in memory as a vector. vectorViewArray :: (Elem e)@@ -55,35 +56,39 @@                           -> IOVector n e vectorViewArrayWithStride s f o n =     let p = unsafeForeignPtrToPtr f `advancePtr` o-    in IOVector f p n s False+    in IOVector NoConj n f p s {-# INLINE vectorViewArrayWithStride #-}                            dimIOVector :: IOVector n e -> Int-dimIOVector (IOVector _ _ n _ _) = n+dimIOVector (IOVector _ n _ _ _) = n {-# INLINE dimIOVector #-}  strideIOVector :: IOVector n e -> Int-strideIOVector (IOVector _ _ _ incX _) = incX+strideIOVector (IOVector _ _ _ _ incX) = incX {-# INLINE strideIOVector #-} +conjEnumIOVector :: IOVector n e -> ConjEnum+conjEnumIOVector (IOVector c _ _ _ _) = c+{-# INLINE conjEnumIOVector #-}+ isConjIOVector :: IOVector n e -> Bool-isConjIOVector (IOVector _ _ _ _ c) = c+isConjIOVector x = conjEnumIOVector x == Conj {-# INLINE isConjIOVector #-}  conjIOVector :: IOVector n e -> IOVector n e-conjIOVector (IOVector f p n incX c) = (IOVector f p n incX (not c))+conjIOVector (IOVector c n f p incX) = (IOVector (flipConj c) n f p incX) {-# INLINE conjIOVector #-}  unsafeSubvectorViewWithStrideIOVector :: (Elem e) =>     Int -> IOVector n e -> Int -> Int -> IOVector n' e-unsafeSubvectorViewWithStrideIOVector s' (IOVector f p _ inc c) o' n' =-    IOVector f (p `advancePtr` (inc*o')) n' (inc*s') c+unsafeSubvectorViewWithStrideIOVector s' (IOVector c _ f p inc) o' n' =+    IOVector c n' f (p `advancePtr` (inc*o')) (inc*s') {-# INLINE unsafeSubvectorViewWithStrideIOVector #-}  -- | Execute an 'IO' action with a pointer to the first element in the -- vector. withIOVector :: IOVector n e -> (Ptr e -> IO a) -> IO a-withIOVector (IOVector f p _ _ _) g = do+withIOVector (IOVector _ _ f p _) g = do     a <- g p     touchForeignPtr f     return a@@ -95,15 +100,15 @@         fail $ "Tried to create a vector with `" ++ show n ++ "' elements."     | otherwise = do         arr <- mallocForeignPtrArray n-        return $ IOVector arr (unsafeForeignPtrToPtr arr) n 1 False+        return $ IOVector NoConj n arr (unsafeForeignPtrToPtr arr) 1  newCopyIOVector :: (BLAS1 e) => IOVector n e -> IO (IOVector n e)-newCopyIOVector (IOVector f p n incX c) = do-    (IOVector f' p' _ _ _) <- newIOVector_ n+newCopyIOVector (IOVector c n f p incX) = do+    (IOVector _ _ f' p' _) <- newIOVector_ n     BLAS.copy n p incX p' 1     touchForeignPtr f     touchForeignPtr f'-    return (IOVector f' p' n 1 c)+    return (IOVector c n f' p' 1)  shapeIOVector :: IOVector n e -> Int shapeIOVector = dimIOVector@@ -138,10 +143,10 @@ {-# INLINE getIndicesIOVector' #-}  getElemsIOVector :: (Elem e) => IOVector n e -> IO [e]-getElemsIOVector (IOVector f p n incX True) = do-    es <- getElemsIOVector (IOVector f p n incX False)+getElemsIOVector (IOVector Conj n f p incX) = do+    es <- getElemsIOVector (IOVector NoConj n f p incX)     return $ map conjugate es-getElemsIOVector (IOVector f p n incX False) =+getElemsIOVector (IOVector NoConj n f p incX) =     let end = p `advancePtr` (n*incX)         go p' | p' == end = do                    touchForeignPtr f@@ -154,11 +159,11 @@ {-# SPECIALIZE INLINE getElemsIOVector :: IOVector n Double -> IO [Double] #-} {-# SPECIALIZE INLINE getElemsIOVector :: IOVector n (Complex Double) -> IO [Complex Double] #-} -getElemsIOVector' :: (Elem e) => IOVector n e -> IO [e]-getElemsIOVector' (IOVector f p n incX True) = do-    es <- getElemsIOVector' (IOVector f p n incX False)+getElemsIOVector' :: (Elem e) => IOVector      n e -> IO [e]+getElemsIOVector' (IOVector Conj n f p incX) = do+    es <- getElemsIOVector' (IOVector NoConj n f p incX)     return $ map conjugate es    -getElemsIOVector' (IOVector f p n incX False) =+getElemsIOVector' (IOVector NoConj n f p incX) =     let end = p `advancePtr` (-incX)         go p' es | p' == end = do                       touchForeignPtr f@@ -179,12 +184,12 @@ {-# INLINE getAssocsIOVector' #-}  unsafeReadElemIOVector :: (Elem e) => IOVector n e -> Int -> IO e-unsafeReadElemIOVector (IOVector f p n incX c) i-    | c = liftM conjugate $ unsafeReadElemIOVector (IOVector f p n incX False) i-    | otherwise = do-        e <- peekElemOff p (i*incX)-        touchForeignPtr f-        return e+unsafeReadElemIOVector (IOVector Conj   n f p incX) i = +    liftM conjugate $ unsafeReadElemIOVector (IOVector NoConj n f p incX) i+unsafeReadElemIOVector (IOVector NoConj _ f p incX) i = do+    e <- peekElemOff p (i*incX)+    touchForeignPtr f+    return e {-# SPECIALIZE INLINE unsafeReadElemIOVector :: IOVector n Double -> Int -> IO (Double) #-} {-# SPECIALIZE INLINE unsafeReadElemIOVector :: IOVector n (Complex Double) -> Int -> IO (Complex Double) #-} @@ -193,8 +198,8 @@ {-# INLINE canModifyElemIOVector #-}  unsafeWriteElemIOVector :: (Elem e) => IOVector n e -> Int -> e -> IO ()-unsafeWriteElemIOVector (IOVector f p _ incX c) i e =-    let e' = if c then conjugate e else e+unsafeWriteElemIOVector (IOVector c _ f p incX) i e =+    let e' = if c == Conj then conjugate e else e     in do         pokeElemOff p (i*incX) e'         touchForeignPtr f@@ -202,8 +207,8 @@ {-# SPECIALIZE INLINE unsafeWriteElemIOVector :: IOVector n (Complex Double) -> Int -> Complex Double -> IO () #-}  unsafeModifyElemIOVector :: (Elem e) => IOVector n e -> Int -> (e -> e) -> IO ()-unsafeModifyElemIOVector (IOVector f p _ incX c) i g =-    let g' = if c then conjugate . g . conjugate else g+unsafeModifyElemIOVector (IOVector c _ f p incX) i g =+    let g' = if c == Conj then conjugate . g . conjugate else g         p' = p `advancePtr` (i*incX)     in do         e <- peek p'@@ -213,7 +218,7 @@ {-# SPECIALIZE INLINE unsafeModifyElemIOVector :: IOVector n (Complex Double) -> Int -> (Complex Double -> Complex Double) -> IO () #-}  unsafeSwapElemsIOVector :: (Elem e) => IOVector n e -> Int -> Int -> IO ()-unsafeSwapElemsIOVector (IOVector f p _ incX _) i1 i2 =+unsafeSwapElemsIOVector (IOVector _ _ f p incX) i1 i2 =     let p1 = p `advancePtr` (i1*incX)         p2 = p `advancePtr` (i2*incX)     in do@@ -226,8 +231,8 @@ {-# SPECIALIZE INLINE unsafeSwapElemsIOVector :: IOVector n (Complex Double) -> Int -> Int -> IO () #-}                              modifyWithIOVector :: (Elem e) => (e -> e) -> IOVector n e -> IO ()-modifyWithIOVector g (IOVector f p n incX c) =-    let g'  = if c then (conjugate . g . conjugate) else g+modifyWithIOVector g (IOVector c n f p incX) =+    let g'  = if c == Conj then (conjugate . g . conjugate) else g         end = p `advancePtr` (n*incX)         go p' | p' == end = touchForeignPtr f               | otherwise = do@@ -239,15 +244,15 @@ {-# SPECIALIZE INLINE modifyWithIOVector :: (Complex Double -> Complex Double) -> IOVector n (Complex Double) -> IO () #-}  setZeroIOVector :: (Elem e) => IOVector n e -> IO ()-setZeroIOVector x@(IOVector f p n incX _)+setZeroIOVector x@(IOVector _ n f p incX)     | incX == 1 = clearArray p n >> touchForeignPtr f     | otherwise = setConstantIOVector 0 x {-# INLINE setZeroIOVector #-}  setConstantIOVector :: (Elem e) => e -> IOVector n e -> IO () setConstantIOVector 0 x | strideIOVector x == 1 = setZeroIOVector x-setConstantIOVector e (IOVector f p n incX c) =-    let e'   = if c then conjugate e else e+setConstantIOVector e (IOVector c n f p incX) =+    let e'   = if c == Conj then conjugate e else e         end = p `advancePtr` (n*incX)         go p' | p' == end = touchForeignPtr f               | otherwise = do@@ -257,14 +262,14 @@ {-# INLINE setConstantIOVector #-}  doConjIOVector :: (BLAS1 e) => IOVector n e -> IO ()-doConjIOVector (IOVector f p n incX _) =+doConjIOVector (IOVector _ n f p incX) =     BLAS.vconj n p incX >> touchForeignPtr f {-# INLINE doConjIOVector #-}  scaleByIOVector :: (BLAS1 e) => e -> IOVector n e -> IO () scaleByIOVector 1 _ = return ()-scaleByIOVector k (IOVector f p n incX c) =-    let k' = if c then conjugate k else k+scaleByIOVector k (IOVector c n f p incX) =+    let k' = if c == Conj then conjugate k else k     in BLAS.scal n k' p incX >> touchForeignPtr f {-# INLINE scaleByIOVector #-}                     
lib/Data/Vector/Dense/STBase.hs view
@@ -93,8 +93,8 @@     {-# INLINE dim #-}     stride (STVector x) = strideIOVector x     {-# INLINE stride #-}-    isConj (STVector x) = isConjIOVector x-    {-# INLINE isConj #-}+    conjEnum (STVector x) = conjEnumIOVector x+    {-# INLINE conjEnum #-}     conj (STVector x) = STVector (conjIOVector x)     {-# INLINE conj #-}     unsafeSubvectorViewWithStride s (STVector x) o n =