Skip to content

Instantly share code, notes, and snippets.

View cartazio's full-sized avatar

Carter Tazio Schonwald cartazio

View GitHub Profile
-- This is the configuration file for the 'cabal' command line tool.
-- The available configuration options are listed below.
-- Some of them have default values listed.
-- Lines (like this one) beginning with '--' are comments.
-- Be careful with spaces and indentation because they are
-- used to indicate layout for nested sections.
Warning: ExtsCompat46: could not find link destinations for:
GHC.Prim.Char# GHC.Prim.Int# GHC.Prim.Word# GHC.Prim.Double# GHC.Prim.Float# GHC.Prim.Addr# GHC.Prim.MutableArray# GHC.Prim.MutableByteArray# GHC.Prim.MutableArrayArray# GHC.Prim.MutVar# GHC.Prim.TVar# GHC.Prim.MVar#
Warning: Encoding: could not find link destinations for:
GHC.Prim.Addr# GHC.Prim.Char# Encoding.UserString Encoding.EncodedString
Warning: FastBool: could not find link destinations for:
GHC.Prim.Int#
Warning: FastTypes: could not find link destinations for:
GHC.Prim.Int# GHC.Prim.Char# GHC.Prim.Addr#
Warning: MonadUtils: could not find link destinations for:
Data.Traversable.Id Data.Sequence.Id Compiler.Hoopl.Graph.VM Data.Traversable.StateL Data.Traversable.StateR Data.Sequence.State
reprocessing library hopenblas-0.1.0.0...
[4 of 4] Compiling Numerical.OpenBLAS.BLAS ( src/Numerical/OpenBLAS/BLAS.hs, dist/build/Numerical/OpenBLAS/BLAS.o )
src/Numerical/OpenBLAS/BLAS.hs:31:35:
Couldn't match expected type ‛b’ with actual type ‛a’
‛a’ is a rigid type variable bound by
the type signature for
coordSwapper :: Transpose -> (a, b) -> (b, a)
at src/Numerical/OpenBLAS/BLAS.hs:30:17
‛b’ is a rigid type variable bound by
4 of 4] Compiling Numerical.OpenBLAS.BLAS ( src/Numerical/OpenBLAS/BLAS.hs, dist/build/Numerical/OpenBLAS/BLAS.o )
src/Numerical/OpenBLAS/BLAS.hs:41:44:
A pattern match on a GADT requires GADTs or TypeFamilies
In the pattern: SRow
In the pattern: DenseMatrix SRow _ _ _ _
In an equation for ‛encodeNiceOrderHelper’:
encodeNiceOrderHelper (DenseMatrix SRow _ _ _ _)
= encodeOrder BLASRowMajor
{-# LANGUAGE ScopedTypeVariables, DataKinds #-}
import Numerical.OpenBLAS.BLAS.FFI
import Numerical.OpenBLAS.BLAS
import Numerical.OpenBLAS.MatrixTypes
import Data.Vector.Storable.Mutable as M
import qualified Data.Vector.Storable as S
main :: IO ()
main = do
-- Just test that the symbol resolves
data Eff :: * -> * where
Pure :: Eff ()
Mut :: s -> Eff s
data EVector :: * -> * -> * where
PureVector :: S.Vector el -> EVector Pure el
MutVector :: SM.MVector s el -> EVector (Mut s) el
@cartazio
cartazio / blas.hsc
Created February 24, 2014 02:07
c2hsc -g gcc-4.8 /usr/local/Cellar/openblas/0.2.8/include/cblas.h --prefix Numerical.Foreign
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#include <bindings.dsl.h>
#include "/usr/local/Cellar/openblas/0.2.8/include/cblas.h"
module Numerical.BLAS.Foreign.Cblas where
import Foreign.Ptr
#strict_import
import Numerical.BLAS.Foreign.OpenblasConfig
#ccall openblas_set_num_threads , CInt -> IO ()
#ccall goto_set_num_threads , CInt -> IO ()
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#include <bindings.dsl.h>
#include "/usr/local/Cellar/openblas/0.2.8/include/lapacke.h"
module Numerical.LAPACK.Foreign.Lapacke where
import Foreign.Ptr
#strict_import
import Numerical.LAPACK.Foreign.LapackeConfig
import Numerical.LAPACK.Foreign.LapackeMangling
#ccall lapack_make_complex_float , CFloat -> CFloat -> IO CFloat
# this is perl code, thats also the latexmk pref file
$pdf_mode = 1 ;
$pdf_previewer = "open -a skim %S --args %O";
# $pdf_update_command = "open -g -a skim %S --args %O";
instance (RealFloat a) => Fractional (Complex a) where
{-# SPECIALISE instance Fractional (Complex Float) #-}
{-# SPECIALISE instance Fractional (Complex Double) #-}
(x:+y) / (x':+y') = (x*x''+y*y'') / d :+ (y*x''-x*y'') / d
where x'' = scaleFloat k x'
y'' = scaleFloat k y'
k = - max (exponent x') (exponent y')
d = x'*x'' + y'*y''