linear-1.20.9: Linear Algebra

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

Linear.V1

Description

1-D Vectors

Synopsis

- newtype V1 a = V1 a
- class R1 t where
  - _x :: Lens' (t a) a
- ex :: R1 t => E t

# Documentation

newtype V1 a Source #

A 1-dimensional vector

    >>> pure 1 :: V1 Int
    V1 1

    >>> V1 2 + V1 3
    V1 5

    >>> V1 2 * V1 3
    V1 6

    >>> sum (V1 2)
    2

Constructors

V1 a |

Instances

Monad V1 Source # |
Instance details Defined in Linear.V1 Methods (>>=) :: V1 a -> (a -> V1 b) -> V1 b Source # (>>) :: V1 a -> V1 b -> V1 b Source # return :: a -> V1 a Source # fail :: String -> V1 a Source #
Functor V1 Source # |
Instance details Defined in Linear.V1 Methods fmap :: (a -> b) -> V1 a -> V1 b Source # (<$) :: a -> V1 b -> V1 a Source #
MonadFix V1 Source # |
Instance details Defined in Linear.V1 Methods mfix :: (a -> V1 a) -> V1 a Source #
Applicative V1 Source # |
Instance details Defined in Linear.V1 Methods pure :: a -> V1 a Source # (<*>) :: V1 (a -> b) -> V1 a -> V1 b Source # liftA2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c Source # (*>) :: V1 a -> V1 b -> V1 b Source # (<*) :: V1 a -> V1 b -> V1 a Source #
Foldable V1 Source # |

Instance details

Defined in Linear.V1

Methods

fold :: Monoid m => V1 m -> m Source #

foldMap :: Monoid m => (a -> m) -> V1 a -> m Source #

foldr :: (a -> b -> b) -> b -> V1 a -> b Source #

foldr' :: (a -> b -> b) -> b -> V1 a -> b Source #

foldl :: (b -> a -> b) -> b -> V1 a -> b Source #

foldl' :: (b -> a -> b) -> b -> V1 a -> b Source #

foldr1 :: (a -> a -> a) -> V1 a -> a Source #

foldl1 :: (a -> a -> a) -> V1 a -> a Source #

toList :: V1 a -> [a] Source #

null :: V1 a -> Bool Source #

length :: V1 a -> Int Source #

elem :: Eq a => a -> V1 a -> Bool Source #

maximum :: Ord a => V1 a -> a Source #

minimum :: Ord a => V1 a -> a Source #

sum :: Num a => V1 a -> a Source #

product :: Num a => V1 a -> a Source #

Traversable V1 Source # |
Instance details Defined in Linear.V1 Methods traverse :: Applicative f => (a -> f b) -> V1 a -> f (V1 b) Source # sequenceA :: Applicative f => V1 (f a) -> f (V1 a) Source # mapM :: Monad m => (a -> m b) -> V1 a -> m (V1 b) Source # sequence :: Monad m => V1 (m a) -> m (V1 a) Source #
Distributive V1 Source # |
Instance details Defined in Linear.V1 Methods distribute :: Functor f => f (V1 a) -> V1 (f a) Source # collect :: Functor f => (a -> V1 b) -> f a -> V1 (f b) Source # distributeM :: Monad m => m (V1 a) -> V1 (m a) Source # collectM :: Monad m => (a -> V1 b) -> m a -> V1 (m b) Source #
Representable V1 Source # |
Instance details Defined in Linear.V1 Associated Types type Rep V1 :: Type Source # Methods tabulate :: (Rep V1 -> a) -> V1 a Source # index :: V1 a -> Rep V1 -> a Source #
Eq1 V1 Source # |
Instance details Defined in Linear.V1 Methods liftEq :: (a -> b -> Bool) -> V1 a -> V1 b -> Bool Source #
Ord1 V1 Source # |
Instance details Defined in Linear.V1 Methods liftCompare :: (a -> b -> Ordering) -> V1 a -> V1 b -> Ordering Source #
Read1 V1 Source # |
Instance details Defined in Linear.V1 Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V1 a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V1 a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (V1 a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [V1 a] Source #
Show1 V1 Source # |
Instance details Defined in Linear.V1 Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V1 a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V1 a] -> ShowS Source #
MonadZip V1 Source # |
Instance details Defined in Linear.V1 Methods mzip :: V1 a -> V1 b -> V1 (a, b) Source # mzipWith :: (a -> b -> c) -> V1 a -> V1 b -> V1 c Source # munzip :: V1 (a, b) -> (V1 a, V1 b) Source #
Serial1 V1 Source # |
Instance details Defined in Linear.V1 Methods serializeWith :: MonadPut m => (a -> m ()) -> V1 a -> m () Source # deserializeWith :: MonadGet m => m a -> m (V1 a) Source #
Hashable1 V1 Source # |
Instance details Defined in Linear.V1 Methods liftHashWithSalt :: (Int -> a -> Int) -> Int -> V1 a -> Int Source #
Apply V1 Source # |
Instance details Defined in Linear.V1 Methods (<.>) :: V1 (a -> b) -> V1 a -> V1 b Source # (.>) :: V1 a -> V1 b -> V1 b Source # (<.) :: V1 a -> V1 b -> V1 a Source # liftF2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c Source #
Traversable1 V1 Source # |
Instance details Defined in Linear.V1 Methods traverse1 :: Apply f => (a -> f b) -> V1 a -> f (V1 b) Source # sequence1 :: Apply f => V1 (f b) -> f (V1 b) Source #
Foldable1 V1 Source # |
Instance details Defined in Linear.V1 Methods fold1 :: Semigroup m => V1 m -> m Source # foldMap1 :: Semigroup m => (a -> m) -> V1 a -> m Source # toNonEmpty :: V1 a -> NonEmpty a Source #
Bind V1 Source # |
Instance details Defined in Linear.V1 Methods (>>-) :: V1 a -> (a -> V1 b) -> V1 b Source # join :: V1 (V1 a) -> V1 a Source #
Additive V1 Source # |
Instance details Defined in Linear.V1 Methods zero :: Num a => V1 a Source # (^+^) :: Num a => V1 a -> V1 a -> V1 a Source # (^-^) :: Num a => V1 a -> V1 a -> V1 a Source # lerp :: Num a => a -> V1 a -> V1 a -> V1 a Source # liftU2 :: (a -> a -> a) -> V1 a -> V1 a -> V1 a Source # liftI2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c Source #
Metric V1 Source # |
Instance details Defined in Linear.V1 Methods dot :: Num a => V1 a -> V1 a -> a Source # quadrance :: Num a => V1 a -> a Source # qd :: Num a => V1 a -> V1 a -> a Source # distance :: Floating a => V1 a -> V1 a -> a Source # norm :: Floating a => V1 a -> a Source # signorm :: Floating a => V1 a -> V1 a Source #
Finite V1 Source # |
Instance details Defined in Linear.V1 Associated Types type Size V1 :: Nat Source # Methods toV :: V1 a -> V (Size V1) a Source # fromV :: V (Size V1) a -> V1 a Source #
R1 V1 Source # |
Instance details Defined in Linear.V1 Methods _x :: Lens' (V1 a) a Source #
Trace V1 Source # |
Instance details Defined in Linear.Trace Methods trace :: Num a => V1 (V1 a) -> a Source # diagonal :: V1 (V1 a) -> V1 a Source #
Affine V1 Source # |
Instance details Defined in Linear.Affine Associated Types type Diff V1 :: Type -> Type Source # Methods (.-.) :: Num a => V1 a -> V1 a -> Diff V1 a Source # (.+^) :: Num a => V1 a -> Diff V1 a -> V1 a Source # (.-^) :: Num a => V1 a -> Diff V1 a -> V1 a Source #
Unbox a => Vector Vector (V1 a) Source # |

Instance details

Defined in Linear.V1

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V1 a) -> m (Vector (V1 a)) Source #

basicUnsafeThaw :: PrimMonad m => Vector (V1 a) -> m (Mutable Vector (PrimState m) (V1 a)) Source #

basicLength :: Vector (V1 a) -> Int Source #

basicUnsafeSlice :: Int -> Int -> Vector (V1 a) -> Vector (V1 a) Source #

basicUnsafeIndexM :: Monad m => Vector (V1 a) -> Int -> m (V1 a) Source #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V1 a) -> Vector (V1 a) -> m () Source #

elemseq :: Vector (V1 a) -> V1 a -> b -> b Source #

Unbox a => MVector MVector (V1 a) Source # |

Instance details

Defined in Linear.V1

Methods

basicLength :: MVector s (V1 a) -> Int Source #

basicUnsafeSlice :: Int -> Int -> MVector s (V1 a) -> MVector s (V1 a) Source #

basicOverlaps :: MVector s (V1 a) -> MVector s (V1 a) -> Bool Source #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V1 a)) Source #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V1 a) -> m () Source #

basicUnsafeReplicate :: PrimMonad m => Int -> V1 a -> m (MVector (PrimState m) (V1 a)) Source #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> m (V1 a) Source #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> V1 a -> m () Source #

basicClear :: PrimMonad m => MVector (PrimState m) (V1 a) -> m () Source #

basicSet :: PrimMonad m => MVector (PrimState m) (V1 a) -> V1 a -> m () Source #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V1 a) -> MVector (PrimState m) (V1 a) -> m () Source #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V1 a) -> MVector (PrimState m) (V1 a) -> m () Source #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> m (MVector (PrimState m) (V1 a)) Source #

Num r => Coalgebra r (E V1) Source # |
Instance details Defined in Linear.Algebra Methods comult :: (E V1 -> r) -> E V1 -> E V1 -> r Source # counital :: (E V1 -> r) -> r Source #
Num r => Algebra r (E V1) Source # |
Instance details Defined in Linear.Algebra Methods mult :: (E V1 -> E V1 -> r) -> E V1 -> r Source # unital :: r -> E V1 -> r Source #
Bounded a => Bounded (V1 a) Source # |
Instance details Defined in Linear.V1 Methods minBound :: V1 a Source # maxBound :: V1 a Source #
Eq a => Eq (V1 a) Source # |
Instance details Defined in Linear.V1 Methods (==) :: V1 a -> V1 a -> Bool Source # (/=) :: V1 a -> V1 a -> Bool Source #
Floating a => Floating (V1 a) Source # |

Instance details

Defined in Linear.V1

Methods

pi :: V1 a Source #

exp :: V1 a -> V1 a Source #

log :: V1 a -> V1 a Source #

sqrt :: V1 a -> V1 a Source #

(**) :: V1 a -> V1 a -> V1 a Source #

logBase :: V1 a -> V1 a -> V1 a Source #

sin :: V1 a -> V1 a Source #

cos :: V1 a -> V1 a Source #

tan :: V1 a -> V1 a Source #

asin :: V1 a -> V1 a Source #

acos :: V1 a -> V1 a Source #

atan :: V1 a -> V1 a Source #

sinh :: V1 a -> V1 a Source #

cosh :: V1 a -> V1 a Source #

tanh :: V1 a -> V1 a Source #

asinh :: V1 a -> V1 a Source #

acosh :: V1 a -> V1 a Source #

atanh :: V1 a -> V1 a Source #

log1p :: V1 a -> V1 a Source #

expm1 :: V1 a -> V1 a Source #

log1pexp :: V1 a -> V1 a Source #

log1mexp :: V1 a -> V1 a Source #

Fractional a => Fractional (V1 a) Source # |
Instance details Defined in Linear.V1 Methods (/) :: V1 a -> V1 a -> V1 a Source # recip :: V1 a -> V1 a Source # fromRational :: Rational -> V1 a Source #
Data a => Data (V1 a) Source # |

Instance details

Defined in Linear.V1

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V1 a -> c (V1 a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V1 a) Source #

toConstr :: V1 a -> Constr Source #

dataTypeOf :: V1 a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V1 a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 a)) Source #

gmapT :: (forall b. Data b => b -> b) -> V1 a -> V1 a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> V1 a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> V1 a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> V1 a -> m (V1 a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V1 a -> m (V1 a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V1 a -> m (V1 a) Source #

Num a => Num (V1 a) Source # |
Instance details Defined in Linear.V1 Methods (+) :: V1 a -> V1 a -> V1 a Source # (-) :: V1 a -> V1 a -> V1 a Source # (*) :: V1 a -> V1 a -> V1 a Source # negate :: V1 a -> V1 a Source # abs :: V1 a -> V1 a Source # signum :: V1 a -> V1 a Source # fromInteger :: Integer -> V1 a Source #
Ord a => Ord (V1 a) Source # |
Instance details Defined in Linear.V1 Methods compare :: V1 a -> V1 a -> Ordering Source # (<) :: V1 a -> V1 a -> Bool Source # (<=) :: V1 a -> V1 a -> Bool Source # (>) :: V1 a -> V1 a -> Bool Source # (>=) :: V1 a -> V1 a -> Bool Source # max :: V1 a -> V1 a -> V1 a Source # min :: V1 a -> V1 a -> V1 a Source #
Read a => Read (V1 a) Source # |
Instance details Defined in Linear.V1 Methods readsPrec :: Int -> ReadS (V1 a) Source # readList :: ReadS [V1 a] Source # readPrec :: ReadPrec (V1 a) Source # readListPrec :: ReadPrec [V1 a] Source #
Show a => Show (V1 a) Source # |
Instance details Defined in Linear.V1 Methods showsPrec :: Int -> V1 a -> ShowS Source # show :: V1 a -> String Source # showList :: [V1 a] -> ShowS Source #
Ix a => Ix (V1 a) Source # |
Instance details Defined in Linear.V1 Methods range :: (V1 a, V1 a) -> [V1 a] Source # index :: (V1 a, V1 a) -> V1 a -> Int Source # unsafeIndex :: (V1 a, V1 a) -> V1 a -> Int inRange :: (V1 a, V1 a) -> V1 a -> Bool Source # rangeSize :: (V1 a, V1 a) -> Int Source # unsafeRangeSize :: (V1 a, V1 a) -> Int
Generic (V1 a) Source # |
Instance details Defined in Linear.V1 Associated Types type Rep (V1 a) :: Type -> Type Source # Methods from :: V1 a -> Rep (V1 a) x Source # to :: Rep (V1 a) x -> V1 a Source #
Lift a => Lift (V1 a) Source # |
Instance details Defined in Linear.V1 Methods lift :: V1 a -> Q Exp Source #
Storable a => Storable (V1 a) Source # |

Instance details

Defined in Linear.V1

Methods

sizeOf :: V1 a -> Int Source #

alignment :: V1 a -> Int Source #

peekElemOff :: Ptr (V1 a) -> Int -> IO (V1 a) Source #

pokeElemOff :: Ptr (V1 a) -> Int -> V1 a -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO (V1 a) Source #

pokeByteOff :: Ptr b -> Int -> V1 a -> IO () Source #

peek :: Ptr (V1 a) -> IO (V1 a) Source #

poke :: Ptr (V1 a) -> V1 a -> IO () Source #

Binary a => Binary (V1 a) Source # |
Instance details Defined in Linear.V1 Methods put :: V1 a -> Put Source # get :: Get (V1 a) Source # putList :: [V1 a] -> Put Source #
Serial a => Serial (V1 a) Source # |
Instance details Defined in Linear.V1 Methods serialize :: MonadPut m => V1 a -> m () Source # deserialize :: MonadGet m => m (V1 a) Source #
Serialize a => Serialize (V1 a) Source # |
Instance details Defined in Linear.V1 Methods put :: Putter (V1 a) Source # get :: Get (V1 a) Source #
NFData a => NFData (V1 a) Source # |
Instance details Defined in Linear.V1 Methods rnf :: V1 a -> () Source #
Hashable a => Hashable (V1 a) Source # |
Instance details Defined in Linear.V1 Methods hashWithSalt :: Int -> V1 a -> Int Source # hash :: V1 a -> Int Source #
Unbox a => Unbox (V1 a) Source # |
Instance details Defined in Linear.V1
Ixed (V1 a) Source # |
Instance details Defined in Linear.V1 Methods ix :: Index (V1 a) -> Traversal' (V1 a) (IxValue (V1 a)) Source #
Epsilon a => Epsilon (V1 a) Source # |
Instance details Defined in Linear.V1 Methods nearZero :: V1 a -> Bool Source #
Generic1 V1 Source # |
Instance details Defined in Linear.V1 Associated Types type Rep1 V1 :: k -> Type Source # Methods from1 :: V1 a -> Rep1 V1 a Source # to1 :: Rep1 V1 a -> V1 a Source #
FunctorWithIndex (E V1) V1 Source # |
Instance details Defined in Linear.V1 Methods imap :: (E V1 -> a -> b) -> V1 a -> V1 b Source # imapped :: IndexedSetter (E V1) (V1 a) (V1 b) a b Source #
FoldableWithIndex (E V1) V1 Source # |
Instance details Defined in Linear.V1 Methods ifoldMap :: Monoid m => (E V1 -> a -> m) -> V1 a -> m Source # ifolded :: IndexedFold (E V1) (V1 a) a Source # ifoldr :: (E V1 -> a -> b -> b) -> b -> V1 a -> b Source # ifoldl :: (E V1 -> b -> a -> b) -> b -> V1 a -> b Source # ifoldr' :: (E V1 -> a -> b -> b) -> b -> V1 a -> b Source # ifoldl' :: (E V1 -> b -> a -> b) -> b -> V1 a -> b Source #
TraversableWithIndex (E V1) V1 Source # |
Instance details Defined in Linear.V1 Methods itraverse :: Applicative f => (E V1 -> a -> f b) -> V1 a -> f (V1 b) Source # itraversed :: IndexedTraversal (E V1) (V1 a) (V1 b) a b Source #
Each (V1 a) (V1 b) a b Source # |
Instance details Defined in Linear.V1 Methods each :: Traversal (V1 a) (V1 b) a b Source #
Field1 (V1 a) (V1 b) a b Source # |
Instance details Defined in Linear.V1 Methods _1 :: Lens (V1 a) (V1 b) a b Source #
type Rep V1 Source # |
Instance details Defined in Linear.V1 type Rep V1 = E V1
type Size V1 Source # |
Instance details Defined in Linear.V1 type Size V1 = 1
type Diff V1 Source # |
Instance details Defined in Linear.Affine type Diff V1 = V1
newtype MVector s (V1 a) Source # |
Instance details Defined in Linear.V1 newtype MVector s (V1 a) = MV_V1 (MVector s a)
type Rep (V1 a) Source # |
Instance details Defined in Linear.V1 type Rep (V1 a) = D1 (MetaData "V1" "Linear.V1" "linear-1.20.9-AXvcltmUzhAPqVQGbnzsL" True) (C1 (MetaCons "V1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
newtype Vector (V1 a) Source # |
Instance details Defined in Linear.V1 newtype Vector (V1 a) = V_V1 (Vector a)
type Index (V1 a) Source # |
Instance details Defined in Linear.V1 type Index (V1 a) = E V1
type IxValue (V1 a) Source # |
Instance details Defined in Linear.V1 type IxValue (V1 a) = a
type Rep1 V1 Source # |
Instance details Defined in Linear.V1 type Rep1 V1 = D1 (MetaData "V1" "Linear.V1" "linear-1.20.9-AXvcltmUzhAPqVQGbnzsL" True) (C1 (MetaCons "V1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))

class R1 t where Source #

A space that has at least 1 basis vector `_x`.

Methods

_x :: Lens' (t a) a Source #

    >>> V1 2 ^._x
    2

    >>> V1 2 & _x .~ 3
    V1 3

Instances

R1 Identity Source # |
Instance details Defined in Linear.V1 Methods _x :: Lens' (Identity a) a Source #
R1 V1 Source # |
Instance details Defined in Linear.V1 Methods _x :: Lens' (V1 a) a Source #
R1 V2 Source # |
Instance details Defined in Linear.V2 Methods _x :: Lens' (V2 a) a Source #
R1 V3 Source # |
Instance details Defined in Linear.V3 Methods _x :: Lens' (V3 a) a Source #
R1 V4 Source # |
Instance details Defined in Linear.V4 Methods _x :: Lens' (V4 a) a Source #
R1 f => R1 (Point f) Source # |
Instance details Defined in Linear.Affine Methods _x :: Lens' (Point f a) a Source #

ex :: R1 t => E t Source #