linear-1.8.1: Linear Algebra

Portability non-portable experimental Edward Kmett Trustworthy

Linear.V

Description

n-D Vectors

Synopsis

# Documentation

data V n a Source

Instances

 Dim n => Monad (V n) Functor (V n) Dim n => Applicative (V n) Foldable (V n) Traversable (V n) Dim n => Distributive (V n) Dim n => Representable (V n) Apply (V n) Bind (V n) Dim n => Additive (V n) Dim n => Metric (V n) Dim n => Trace (V n) Dim n => Affine (V n) Eq a => Eq (V n a) (Dim n, Fractional a) => Fractional (V n a) (Dim n, Num a) => Num (V n a) Ord a => Ord (V n a) Read a => Read (V n a) Show a => Show (V n a) Generic (V n a) (Dim n, Storable a) => Storable (V n a) Ixed (V n a) (Dim n, Epsilon a) => Epsilon (V n a) Dim n => Dim (V 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.

`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 -> IntSource

class Dim n whereSource

Methods

reflectDim :: p n -> IntSource

Instances

 Dim n => Dim (V 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