linear- Linear Algebra

Copyright(C) 2012-2013 Edward Kmett,
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <>
Safe HaskellTrustworthy



n-D Vectors



newtype V n a Source




toVector :: Vector a


FunctorWithIndex Int (V k n) 
FoldableWithIndex Int (V k n) 
TraversableWithIndex Int (V k n) 
Dim k n => Dim * (V k n a) 
Dim k n => Monad (V k n) 
Functor (V k n) 
Dim k n => MonadFix (V k n) 
Dim k n => Applicative (V k n) 
Foldable (V k n) 
Traversable (V k n) 
Generic1 (V k n) 
Dim k n => Distributive (V k n) 
Dim k n => Representable (V k n) 
Dim k n => MonadZip (V k n) 
Dim k n => Serial1 (V k n) 
Apply (V k n) 
Bind (V k n) 
Dim k n => Eq1 (V k n) 
Dim k n => Ord1 (V k n) 
Dim k n => Read1 (V k n) 
Dim k n => Show1 (V k n) 
Dim k n => Additive (V k n) 
Dim k n => Metric (V k n) 
Dim * n => Trace (V * n) 
Dim * n => Affine (V * n) 
Typeable (k -> * -> *) (V k) 
(Bounded a, Dim k n) => Bounded (V k n a) 
Eq a => Eq (V k n a) 
(Dim k n, Floating a) => Floating (V k n a) 
(Dim k n, Fractional a) => Fractional (V k n a) 
(Typeable (* -> *) (V k n), Typeable * (V k n a), Dim k n, Data a) => Data (V k n a) 
(Dim k n, Num a) => Num (V k n a) 
Ord a => Ord (V k n a) 
Read a => Read (V k n a) 
Show a => Show (V k n a) 
Generic (V k n a) 
(Dim k n, Storable a) => Storable (V k n a) 
(Dim k n, Binary a) => Binary (V k n a) 
(Dim k n, Serial a) => Serial (V k n a) 
(Dim k n, Serialize a) => Serialize (V k n a) 
NFData a => NFData (V k n a) 
Ixed (V k n a) 
(Dim k n, Epsilon a) => Epsilon (V k n a) 
Each (V k n a) (V k n b) a b 
type Rep1 (V k n) 
type Rep (V k n) = Int 
type Diff (V * n) = V * n 
type Rep (V k n a) 
type Index (V k n a) = E (V k n) 
type IxValue (V k n a) = a 

int :: Int -> TypeQ

This can be used to generate a template haskell splice for a type level version of a given int.

This does not use GHC TypeLits, instead it generates a numeric type by hand similar to the ones used in the "Functional Pearl: Implicit Configurations" paper by Oleg Kiselyov and Chung-Chieh Shan.

instance Num (Q Exp) provided in this package allows writing $(3) instead of $(int 3). Sometimes the two will produce the same representation (if compiled without the -DUSE_TYPE_LITS preprocessor directive).

dim :: forall n a. Dim n => V n a -> Int Source

class Dim n where Source


reflectDim :: p n -> Int Source


KnownNat n => Dim Nat n 
Dim k n => Dim * (V k n a) 

reifyDim :: Int -> (forall n. Dim n => Proxy n -> r) -> r Source

reifyVector :: forall a r. Vector a -> (forall n. Dim n => V n a -> r) -> r Source

fromVector :: forall n a. Dim n => Vector a -> Maybe (V n a) Source