linear-1.1.2: Linear Algebra

Linear.V

Synopsis

# Documentation

data V n a Source

Instances

 Dim k n => Dim * (V k n a) Dim k n => Monad (V k n) Functor (V k n) Dim k n => Applicative (V k n) Foldable (V k n) Traversable (V k n) Dim k n => Distributive (V k n) Apply (V k n) Bind (V k n) Dim k n => Additive (V k n) Dim k n => Metric (V k n) Dim k n => Core (V k n) Dim * n => Affine (V * n) Eq a => Eq (V k n a) (Dim k n, Fractional a) => Fractional (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) (Dim k n, Storable a) => Storable (V k n a) (Dim k n, Epsilon a) => Epsilon (V k n 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.

dim :: forall n a. Dim n => V n a -> IntSource

class Dim n whereSource

Methods

reflectDim :: p n -> IntSource

Instances

 SingRep Nat n Integer => Dim Nat n Dim k n => Dim * (V k n a)

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

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

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