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 | Haskell2010 |
Linear.V
Description
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 :: Type). Dim n => Proxy n -> r) -> r
- reifyVector :: forall a r. Vector a -> (forall (n :: Type). 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
Generic1 (V n :: Type -> Type) Source # | |
FoldableWithIndex Int (V n) Source # | |
Defined in Linear.V Methods ifoldMap :: Monoid m => (Int -> a -> m) -> V n a -> m Source # ifoldMap' :: Monoid m => (Int -> a -> m) -> V n a -> m Source # ifoldr :: (Int -> a -> b -> b) -> b -> V n a -> b Source # ifoldl :: (Int -> b -> a -> b) -> b -> V n a -> b Source # | |
FunctorWithIndex Int (V n) Source # | |
TraversableWithIndex Int (V n) Source # | |
Dim n => Dim (V n a :: Type) Source # | |
(Dim n, Unbox a) => Vector Vector (V n a) Source # | |
Defined in Linear.V Methods basicUnsafeFreeze :: Mutable Vector s (V n a) -> ST s (Vector (V n a)) Source # basicUnsafeThaw :: Vector (V n a) -> ST s (Mutable Vector s (V n a)) Source # basicLength :: Vector (V n a) -> Int Source # basicUnsafeSlice :: Int -> Int -> Vector (V n a) -> Vector (V n a) Source # basicUnsafeIndexM :: Vector (V n a) -> Int -> Box (V n a) Source # basicUnsafeCopy :: Mutable Vector s (V n a) -> Vector (V n a) -> ST s () Source # | |
(Dim n, Unbox a) => MVector MVector (V n a) Source # | |
Defined in Linear.V Methods basicLength :: MVector s (V n a) -> Int Source # basicUnsafeSlice :: Int -> Int -> MVector s (V n a) -> MVector s (V n a) Source # basicOverlaps :: MVector s (V n a) -> MVector s (V n a) -> Bool Source # basicUnsafeNew :: Int -> ST s (MVector s (V n a)) Source # basicInitialize :: MVector s (V n a) -> ST s () Source # basicUnsafeReplicate :: Int -> V n a -> ST s (MVector s (V n a)) Source # basicUnsafeRead :: MVector s (V n a) -> Int -> ST s (V n a) Source # basicUnsafeWrite :: MVector s (V n a) -> Int -> V n a -> ST s () Source # basicClear :: MVector s (V n a) -> ST s () Source # basicSet :: MVector s (V n a) -> V n a -> ST s () Source # basicUnsafeCopy :: MVector s (V n a) -> MVector s (V n a) -> ST s () Source # basicUnsafeMove :: MVector s (V n a) -> MVector s (V n a) -> ST s () Source # basicUnsafeGrow :: MVector s (V n a) -> Int -> ST s (MVector s (V n a)) Source # | |
Dim n => Representable (V n) Source # | |
Dim n => MonadFix (V n) Source # | |
Dim n => MonadZip (V n) Source # | |
Foldable (V n) Source # | |
Defined in Linear.V Methods fold :: Monoid m => V n m -> m Source # foldMap :: Monoid m => (a -> m) -> V n a -> m Source # foldMap' :: Monoid m => (a -> m) -> V n a -> m Source # foldr :: (a -> b -> b) -> b -> V n a -> b Source # foldr' :: (a -> b -> b) -> b -> V n a -> b Source # foldl :: (b -> a -> b) -> b -> V n a -> b Source # foldl' :: (b -> a -> b) -> b -> V n a -> b Source # foldr1 :: (a -> a -> a) -> V n a -> a Source # foldl1 :: (a -> a -> a) -> V n a -> a Source # toList :: V n a -> [a] Source # null :: V n a -> Bool Source # length :: V n a -> Int Source # elem :: Eq a => a -> V n a -> Bool Source # maximum :: Ord a => V n a -> a Source # minimum :: Ord a => V n a -> a Source # | |
Eq1 (V n) Source # | |
Ord1 (V n) Source # | |
Dim n => Read1 (V n) Source # | |
Defined in Linear.V Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V n a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V n a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (V n a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [V n a] Source # | |
Show1 (V n) Source # | |
Traversable (V n) Source # | |
Dim n => Applicative (V n) Source # | |
Functor (V n) Source # | |
Dim n => Monad (V n) Source # | |
Dim n => Serial1 (V n) Source # | |
Dim n => Distributive (V n) Source # | |
Dim n => Hashable1 (V n) Source # | |
Dim n => Affine (V n) Source # | |
Dim n => Metric (V n) Source # | |
Dim n => Trace (V n) Source # | |
Finite (V n) Source # | |
Dim n => Additive (V n) Source # | |
Apply (V n) Source # | |
Bind (V n) Source # | |
(Typeable (V n), Typeable (V n a), Dim n, Data a) => Data (V n a) Source # | |
Defined in Linear.V Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V n a -> c (V n a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V n a) Source # toConstr :: V n a -> Constr Source # dataTypeOf :: V n a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V n a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V n a)) Source # gmapT :: (forall b. Data b => b -> b) -> V n a -> V n a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V n a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V n a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> V n a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> V n a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> V n a -> m (V n a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V n a -> m (V n a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V n a -> m (V n a) Source # | |
(Dim n, Storable a) => Storable (V n a) Source # | |
Defined in Linear.V Methods sizeOf :: V n a -> Int Source # alignment :: V n a -> Int Source # peekElemOff :: Ptr (V n a) -> Int -> IO (V n a) Source # pokeElemOff :: Ptr (V n a) -> Int -> V n a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO (V n a) Source # pokeByteOff :: Ptr b -> Int -> V n a -> IO () Source # | |
(Dim n, Monoid a) => Monoid (V n a) Source # | |
(Dim n, Semigroup a) => Semigroup (V n a) Source # | |
(Bounded a, Dim n) => Bounded (V n a) Source # | |
(Dim n, Floating a) => Floating (V n a) Source # | |
Defined in Linear.V Methods exp :: V n a -> V n a Source # log :: V n a -> V n a Source # sqrt :: V n a -> V n a Source # (**) :: V n a -> V n a -> V n a Source # logBase :: V n a -> V n a -> V n a Source # sin :: V n a -> V n a Source # cos :: V n a -> V n a Source # tan :: V n a -> V n a Source # asin :: V n a -> V n a Source # acos :: V n a -> V n a Source # atan :: V n a -> V n a Source # sinh :: V n a -> V n a Source # cosh :: V n a -> V n a Source # tanh :: V n a -> V n a Source # asinh :: V n a -> V n a Source # acosh :: V n a -> V n a Source # atanh :: V n a -> V n a Source # log1p :: V n a -> V n a Source # expm1 :: V n a -> V n a Source # | |
Generic (V n a) Source # | |
(Dim n, Num a) => Num (V n a) Source # | |
Read a => Read (V n a) Source # | |
(Dim n, Fractional a) => Fractional (V n a) Source # | |
Show a => Show (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 # | |
Eq a => Eq (V n a) Source # | |
Ord a => Ord (V n a) Source # | |
Defined in Linear.V | |
Hashable a => Hashable (V n a) Source # | |
Ixed (V n a) Source # | |
(Dim n, Epsilon a) => Epsilon (V n a) Source # | |
(Dim n, Random a) => Random (V n a) Source # | |
(Dim n, Unbox a) => Unbox (V n a) Source # | |
Defined in Linear.V | |
Each (V n a) (V n b) a b Source # | |
1 <= n => Field1 (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 # | |
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 # | |
type Rep1 (V n :: Type -> Type) Source # | |
data MVector s (V n a) Source # | |
type Rep (V n) Source # | |
type Diff (V n) Source # | |
Defined in Linear.Affine | |
type Size (V n) Source # | |
type Rep (V n a) Source # | |
type Index (V n a) Source # | |
type IxValue (V n a) Source # | |
data Vector (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).
Methods
reflectDim :: p n -> Int Source #
reifyVectorNat :: forall a r. Vector a -> (forall (n :: Nat). KnownNat n => V n a -> r) -> r Source #
Minimal complete definition
Instances
Finite Complex Source # | |
Finite Plucker Source # | |
Finite Quaternion Source # | |
Defined in Linear.Quaternion Associated Types type Size Quaternion :: Nat Source # Methods toV :: Quaternion a -> V (Size Quaternion) a Source # fromV :: V (Size Quaternion) a -> Quaternion a Source # | |
Finite V0 Source # | |
Finite V1 Source # | |
Finite V2 Source # | |
Finite V3 Source # | |
Finite V4 Source # | |
Finite f => Finite (Point f) Source # | |
Finite (V n) Source # | |