LATS 0.4.1 → 0.4.2
raw patch · 3 files changed
+16/−9 lines, 3 files
Files
- LATS.cabal +3/−1
- src/LinearAlgebra/TypedSpaces/Classes.hs +4/−2
- src/LinearAlgebra/TypedSpaces/Matrix.hs +9/−6
LATS.cabal view
@@ -1,5 +1,5 @@ name: LATS-version: 0.4.1+version: 0.4.2 synopsis: Linear Algebra on Typed Spaces description: Please see README.org homepage: http://github.com/guaraqe/lats#readme@@ -28,6 +28,8 @@ , hmatrix >= 0.17 && < 0.18 , semigroups >= 0.18 && < 0.19 , vector >= 0.11 && < 0.12++ extra-libraries: openblas default-language: Haskell2010
src/LinearAlgebra/TypedSpaces/Classes.hs view
@@ -10,7 +10,7 @@ , IsList (..) , module CC ) where -import GHC.Exts (IsList (..))+import GHC.Exts (IsList (..), Constraint) import Control.ConstraintClasses as CC ----------------------------------------------------------------------@@ -35,7 +35,9 @@ ---------------------------------------------------------------------- class CFunctor f => CIndexed f i | f -> i where+ type CInd f a :: Constraint+ type CInd f a = () - (!) :: CFun f a => f a -> i -> a+ (!) :: (CFun f a, CInd f a) => f a -> i -> a ----------------------------------------------------------------------
src/LinearAlgebra/TypedSpaces/Matrix.hs view
@@ -37,18 +37,21 @@ newtype Matrix i j a = Matrix { matrix :: L.Matrix a } deriving (Show) -instance (Isomorphism Int i, Isomorphism Int j)- => CIndexed (Matrix i j) (i,j) where-- (Matrix v) ! (m,n) = v `L.atIndex` (bw m, bw n)- instance CFunctor (Matrix i j) where - type CFun (Matrix i j) a = ( L.Container L.Matrix a+ type CFun (Matrix i j) a = ( L.Container L.Vector a , L.Storable a , Num a ) cmap f (Matrix m) = Matrix (L.cmap f m)+++instance (Isomorphism Int i, Isomorphism Int j)+ => CIndexed (Matrix i j) (i,j) where++ type CInd (Matrix i j) a = (L.Container L.Vector a)++ (Matrix v) ! (m,n) = v `L.atIndex` (bw m, bw n) ----------------------------------------------------------------------