Copyright | (C) 2012-2015 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Trustworthy |
Language | Haskell98 |
n-D Vectors
Synopsis
- newtype V n a = V {}
- int :: Int -> TypeQ
- dim :: forall n a. Dim n => V n a -> Int
- class Dim n where
- reflectDim :: p n -> Int
- reifyDim :: Int -> (forall (n :: *). Dim n => Proxy n -> r) -> r
- reifyVector :: forall a r. Vector a -> (forall (n :: *). Dim n => V n a -> r) -> r
- reifyDimNat :: Int -> (forall (n :: Nat). KnownNat n => Proxy n -> r) -> r
- reifyVectorNat :: forall a r. Vector a -> (forall (n :: Nat). KnownNat n => V n a -> r) -> r
- fromVector :: forall n a. Dim n => Vector a -> Maybe (V n a)
- class Finite v where
- _V :: (Finite u, Finite v) => Iso (V (Size u) a) (V (Size v) b) (u a) (v b)
- _V' :: Finite v => Iso (V (Size v) a) (V (Size v) b) (v a) (v b)
Documentation
Instances
FunctorWithIndex Int (V n) Source # | |
FoldableWithIndex Int (V n) Source # | |
Defined in Linear.V | |
TraversableWithIndex Int (V n) Source # | |
Defined in Linear.V itraverse :: Applicative f => (Int -> a -> f b) -> V n a -> f (V n b) # itraversed :: IndexedTraversal Int (V n a) (V n b) a b # | |
(Dim n, Unbox a) => Vector Vector (V n a) Source # | |
Defined in Linear.V basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V n a) -> m (Vector (V n a)) # basicUnsafeThaw :: PrimMonad m => Vector (V n a) -> m (Mutable Vector (PrimState m) (V n a)) # basicLength :: Vector (V n a) -> Int # basicUnsafeSlice :: Int -> Int -> Vector (V n a) -> Vector (V n a) # basicUnsafeIndexM :: Monad m => Vector (V n a) -> Int -> m (V n a) # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V n a) -> Vector (V n a) -> m () # | |
(Dim n, Unbox a) => MVector MVector (V n a) Source # | |
Defined in Linear.V basicLength :: MVector s (V n a) -> Int # basicUnsafeSlice :: Int -> Int -> MVector s (V n a) -> MVector s (V n a) # basicOverlaps :: MVector s (V n a) -> MVector s (V n a) -> Bool # basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V n a)) # basicInitialize :: PrimMonad m => MVector (PrimState m) (V n a) -> m () # basicUnsafeReplicate :: PrimMonad m => Int -> V n a -> m (MVector (PrimState m) (V n a)) # basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V n a) -> Int -> m (V n a) # basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V n a) -> Int -> V n a -> m () # basicClear :: PrimMonad m => MVector (PrimState m) (V n a) -> m () # basicSet :: PrimMonad m => MVector (PrimState m) (V n a) -> V n a -> m () # basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V n a) -> MVector (PrimState m) (V n a) -> m () # basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V n a) -> MVector (PrimState m) (V n a) -> m () # basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V n a) -> Int -> m (MVector (PrimState m) (V n a)) # | |
Generic1 (V n :: Type -> Type) Source # | |
Dim n => Dim (V n a :: Type) Source # | |
Dim n => Monad (V n) Source # | |
Functor (V n) Source # | |
Dim n => MonadFix (V n) Source # | |
Dim n => Applicative (V n) Source # | |
Foldable (V n) Source # | |
Defined in Linear.V fold :: Monoid m => V n m -> m # foldMap :: Monoid m => (a -> m) -> V n a -> m # foldr :: (a -> b -> b) -> b -> V n a -> b # foldr' :: (a -> b -> b) -> b -> V n a -> b # foldl :: (b -> a -> b) -> b -> V n a -> b # foldl' :: (b -> a -> b) -> b -> V n a -> b # foldr1 :: (a -> a -> a) -> V n a -> a # foldl1 :: (a -> a -> a) -> V n a -> a # elem :: Eq a => a -> V n a -> Bool # maximum :: Ord a => V n a -> a # | |
Traversable (V n) Source # | |
Dim n => Distributive (V n) Source # | |
Dim n => Representable (V n) Source # | |
Eq1 (V n) Source # | |
Ord1 (V n) Source # | |
Dim n => Read1 (V n) Source # | |
Show1 (V n) Source # | |
Dim n => MonadZip (V n) Source # | |
Dim n => Serial1 (V n) Source # | |
Defined in Linear.V serializeWith :: MonadPut m => (a -> m ()) -> V n a -> m () # deserializeWith :: MonadGet m => m a -> m (V n a) # | |
Dim n => Hashable1 (V n) Source # | |
Apply (V n) Source # | |
Bind (V n) Source # | |
Dim n => Additive (V n) Source # | |
Dim n => Metric (V n) Source # | |
Finite (V n) Source # | |
Dim n => Trace (V n) Source # | |
Dim n => Affine (V n) Source # | |
(Bounded a, Dim n) => Bounded (V n a) Source # | |
Eq a => Eq (V n a) Source # | |
(Dim n, Floating a) => Floating (V n a) Source # | |
(Dim n, Fractional a) => Fractional (V n a) Source # | |
(Typeable (V n), Typeable (V n a), Dim n, Data a) => Data (V n a) Source # | |
Defined in Linear.V gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V n a -> c (V n a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V n a) # dataTypeOf :: V n a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V n a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V n a)) # gmapT :: (forall b. Data b => b -> b) -> V n a -> V n a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V n a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V n a -> r # gmapQ :: (forall d. Data d => d -> u) -> V n a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> V n a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> V n a -> m (V n a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V n a -> m (V n a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V n a -> m (V n a) # | |
(Dim n, Num a) => Num (V n a) Source # | |
Ord a => Ord (V n a) Source # | |
Read a => Read (V n a) Source # | |
Show a => Show (V n a) Source # | |
Generic (V n a) Source # | |
(Dim n, Storable a) => Storable (V n a) Source # | |
(Dim n, Binary a) => Binary (V n a) Source # | |
(Dim n, Serial a) => Serial (V n a) Source # | |
(Dim n, Serialize a) => Serialize (V n a) Source # | |
NFData a => NFData (V n a) Source # | |
Hashable a => Hashable (V n a) Source # | |
(Dim n, Unbox a) => Unbox (V n a) Source # | |
Defined in Linear.V | |
Ixed (V n a) Source # | |
(Dim n, Epsilon a) => Epsilon (V n a) Source # | |
Each (V n a) (V n b) a b Source # | |
1 <= n => Field1 (V n a) (V n a) a a Source # | |
2 <= n => Field2 (V n a) (V n a) a a Source # | |
3 <= n => Field3 (V n a) (V n a) a a Source # | |
4 <= n => Field4 (V n a) (V n a) a a Source # | |
5 <= n => Field5 (V n a) (V n a) a a Source # | |
6 <= n => Field6 (V n a) (V n a) a a Source # | |
7 <= n => Field7 (V n a) (V n a) a a Source # | |
8 <= n => Field8 (V n a) (V n a) a a Source # | |
9 <= n => Field9 (V n a) (V n a) a a Source # | |
10 <= n => Field10 (V n a) (V n a) a a Source # | |
11 <= n => Field11 (V n a) (V n a) a a Source # | |
12 <= n => Field12 (V n a) (V n a) a a Source # | |
13 <= n => Field13 (V n a) (V n a) a a Source # | |
14 <= n => Field14 (V n a) (V n a) a a Source # | |
15 <= n => Field15 (V n a) (V n a) a a Source # | |
16 <= n => Field16 (V n a) (V n a) a a Source # | |
17 <= n => Field17 (V n a) (V n a) a a Source # | |
18 <= n => Field18 (V n a) (V n a) a a Source # | |
19 <= n => Field19 (V n a) (V n a) a a Source # | |
data MVector s (V n a) Source # | |
type Rep1 (V n :: Type -> Type) Source # | |
type Rep (V n) Source # | |
type Size (V n) Source # | |
type Diff (V n) Source # | |
Defined in Linear.Affine | |
type Rep (V n a) Source # | |
data Vector (V n a) Source # | |
type Index (V n a) Source # | |
type IxValue (V n a) Source # | |
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).
reflectDim :: p n -> Int Source #
reifyVectorNat :: forall a r. Vector a -> (forall (n :: Nat). KnownNat n => V n a -> r) -> r Source #
Instances
Finite Complex Source # | |
Finite V1 Source # | |
Finite V2 Source # | |
Finite V3 Source # | |
Finite V4 Source # | |
Finite V0 Source # | |
Finite Quaternion Source # | |
Defined in Linear.Quaternion type Size Quaternion :: Nat Source # toV :: Quaternion a -> V (Size Quaternion) a Source # fromV :: V (Size Quaternion) a -> Quaternion a Source # | |
Finite Plucker Source # | |
Finite f => Finite (Point f) Source # | |
Finite (V n) Source # | |