vector-space-0.19: Vector & affine spaces, linear maps, and derivatives

Copyright | (c) Conal Elliott and Andy J Gill 2008
License | BSD3
Maintainer | conal@conal.net, andygill@ku.edu
Stability | experimental
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.AdditiveGroup

Description

Synopsis

- class AdditiveGroup v where
  - zeroV :: v
  - (^+^) :: v -> v -> v
  - negateV :: v -> v
  - (^-^) :: v -> v -> v
- sumV :: (Foldable f, AdditiveGroup v) => f v -> v
- newtype Sum a = Sum {
  - getSum :: a
  }
- inSum :: (a -> b) -> Sum a -> Sum b
- inSum2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c

# Documentation

class AdditiveGroup v where Source #

Additive group `v`.

Minimal complete definition

Nothing

Methods

zeroV :: v Source #

The zero element: identity for `(^+^)`

default zeroV :: (Generic v, AdditiveGroup (VRep v)) => v Source #

(^+^) :: v -> v -> v infixl 6 Source #

Add vectors

default (^+^) :: (Generic v, AdditiveGroup (VRep v)) => v -> v -> v Source #

negateV :: v -> v Source #

Additive inverse

default negateV :: (Generic v, AdditiveGroup (VRep v)) => v -> v Source #

(^-^) :: v -> v -> v infixl 6 Source #

Group subtraction

#### Instances

Instances details

AdditiveGroup CDouble Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CDouble Source # (^+^) :: CDouble -> CDouble -> CDouble Source # negateV :: CDouble -> CDouble Source # (^-^) :: CDouble -> CDouble -> CDouble Source #
AdditiveGroup CFloat Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CFloat Source # (^+^) :: CFloat -> CFloat -> CFloat Source # negateV :: CFloat -> CFloat Source # (^-^) :: CFloat -> CFloat -> CFloat Source #
AdditiveGroup CInt Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CInt Source # (^+^) :: CInt -> CInt -> CInt Source # negateV :: CInt -> CInt Source # (^-^) :: CInt -> CInt -> CInt Source #
AdditiveGroup CIntMax Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CIntMax Source # (^+^) :: CIntMax -> CIntMax -> CIntMax Source # negateV :: CIntMax -> CIntMax Source # (^-^) :: CIntMax -> CIntMax -> CIntMax Source #
AdditiveGroup CLLong Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CLLong Source # (^+^) :: CLLong -> CLLong -> CLLong Source # negateV :: CLLong -> CLLong Source # (^-^) :: CLLong -> CLLong -> CLLong Source #
AdditiveGroup CLong Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CLong Source # (^+^) :: CLong -> CLong -> CLong Source # negateV :: CLong -> CLong Source # (^-^) :: CLong -> CLong -> CLong Source #
AdditiveGroup CSChar Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CSChar Source # (^+^) :: CSChar -> CSChar -> CSChar Source # negateV :: CSChar -> CSChar Source # (^-^) :: CSChar -> CSChar -> CSChar Source #
AdditiveGroup CShort Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: CShort Source # (^+^) :: CShort -> CShort -> CShort Source # negateV :: CShort -> CShort Source # (^-^) :: CShort -> CShort -> CShort Source #
AdditiveGroup Integer Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Integer Source # (^+^) :: Integer -> Integer -> Integer Source # negateV :: Integer -> Integer Source # (^-^) :: Integer -> Integer -> Integer Source #
AdditiveGroup () Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: () Source # (^+^) :: () -> () -> () Source # negateV :: () -> () Source # (^-^) :: () -> () -> () Source #
AdditiveGroup Double Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Double Source # (^+^) :: Double -> Double -> Double Source # negateV :: Double -> Double Source # (^-^) :: Double -> Double -> Double Source #
AdditiveGroup Float Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Float Source # (^+^) :: Float -> Float -> Float Source # negateV :: Float -> Float Source # (^-^) :: Float -> Float -> Float Source #
AdditiveGroup Int Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Int Source # (^+^) :: Int -> Int -> Int Source # negateV :: Int -> Int Source # (^-^) :: Int -> Int -> Int Source #
(RealFloat v, AdditiveGroup v) => AdditiveGroup (Complex v) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Complex v Source # (^+^) :: Complex v -> Complex v -> Complex v Source # negateV :: Complex v -> Complex v Source # (^-^) :: Complex v -> Complex v -> Complex v Source #
Integral a => AdditiveGroup (Ratio a) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Ratio a Source # (^+^) :: Ratio a -> Ratio a -> Ratio a Source # negateV :: Ratio a -> Ratio a Source # (^-^) :: Ratio a -> Ratio a -> Ratio a Source #
AdditiveGroup a => AdditiveGroup (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Sum a Source # (^+^) :: Sum a -> Sum a -> Sum a Source # negateV :: Sum a -> Sum a Source # (^-^) :: Sum a -> Sum a -> Sum a Source #
AdditiveGroup a => AdditiveGroup (Maybe a) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Maybe a Source # (^+^) :: Maybe a -> Maybe a -> Maybe a Source # negateV :: Maybe a -> Maybe a Source # (^-^) :: Maybe a -> Maybe a -> Maybe a Source #
(HasTrie u, AdditiveGroup v) => AdditiveGroup (u :->: v) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: u :->: v Source # (^+^) :: (u :->: v) -> (u :->: v) -> u :->: v Source # negateV :: (u :->: v) -> u :->: v Source # (^-^) :: (u :->: v) -> (u :->: v) -> u :->: v Source #
(HasTrie (Basis u), AdditiveGroup v) => AdditiveGroup (u :-* v) Source # |
Instance details Defined in Data.LinearMap Methods zeroV :: u :-* v Source # (^+^) :: (u :-* v) -> (u :-* v) -> u :-* v Source # negateV :: (u :-* v) -> u :-* v Source # (^-^) :: (u :-* v) -> (u :-* v) -> u :-* v Source #
(HasBasis a, HasTrie (Basis a), AdditiveGroup u) => AdditiveGroup (a :> u) Source # |
Instance details Defined in Data.Maclaurin Methods zeroV :: a :> u Source # (^+^) :: (a :> u) -> (a :> u) -> a :> u Source # negateV :: (a :> u) -> a :> u Source # (^-^) :: (a :> u) -> (a :> u) -> a :> u Source #
(AdditiveGroup u, AdditiveGroup v) => AdditiveGroup (u, v) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: (u, v) Source # (^+^) :: (u, v) -> (u, v) -> (u, v) Source # negateV :: (u, v) -> (u, v) Source # (^-^) :: (u, v) -> (u, v) -> (u, v) Source #
AdditiveGroup v => AdditiveGroup (a -> v) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: a -> v Source # (^+^) :: (a -> v) -> (a -> v) -> a -> v Source # negateV :: (a -> v) -> a -> v Source # (^-^) :: (a -> v) -> (a -> v) -> a -> v Source #
AdditiveGroup a => AdditiveGroup (Rec0 a s) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Rec0 a s Source # (^+^) :: Rec0 a s -> Rec0 a s -> Rec0 a s Source # negateV :: Rec0 a s -> Rec0 a s Source # (^-^) :: Rec0 a s -> Rec0 a s -> Rec0 a s Source #
(AdditiveGroup u, AdditiveGroup v, AdditiveGroup w) => AdditiveGroup (u, v, w) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: (u, v, w) Source # (^+^) :: (u, v, w) -> (u, v, w) -> (u, v, w) Source # negateV :: (u, v, w) -> (u, v, w) Source # (^-^) :: (u, v, w) -> (u, v, w) -> (u, v, w) Source #
(AdditiveGroup (f p), AdditiveGroup (g p)) => AdditiveGroup ((f :*: g) p) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: (f :*: g) p Source # (^+^) :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p Source # negateV :: (f :*: g) p -> (f :*: g) p Source # (^-^) :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p Source #
(AdditiveGroup u, AdditiveGroup v, AdditiveGroup w, AdditiveGroup x) => AdditiveGroup (u, v, w, x) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: (u, v, w, x) Source # (^+^) :: (u, v, w, x) -> (u, v, w, x) -> (u, v, w, x) Source # negateV :: (u, v, w, x) -> (u, v, w, x) Source # (^-^) :: (u, v, w, x) -> (u, v, w, x) -> (u, v, w, x) Source #
AdditiveGroup (f p) => AdditiveGroup (M1 i c f p) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: M1 i c f p Source # (^+^) :: M1 i c f p -> M1 i c f p -> M1 i c f p Source # negateV :: M1 i c f p -> M1 i c f p Source # (^-^) :: M1 i c f p -> M1 i c f p -> M1 i c f p Source #

sumV :: (Foldable f, AdditiveGroup v) => f v -> v Source #

Sum over several vectors

newtype Sum a Source #

Monoid under group addition. Alternative to the `Sum` in Data.Monoid, which uses `Num` instead of `AdditiveGroup`.

Constructors

Sum |

Fields

- getSum :: a

#### Instances

Instances details

Applicative Sum Source # |
Instance details Defined in Data.AdditiveGroup Methods pure :: a -> Sum a Source # (<*>) :: Sum (a -> b) -> Sum a -> Sum b Source # liftA2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c Source # (*>) :: Sum a -> Sum b -> Sum b Source # (<*) :: Sum a -> Sum b -> Sum a Source #
Functor Sum Source # |
Instance details Defined in Data.AdditiveGroup Methods fmap :: (a -> b) -> Sum a -> Sum b Source # (<$) :: a -> Sum b -> Sum a Source #
AdditiveGroup a => Monoid (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods mempty :: Sum a Source # mappend :: Sum a -> Sum a -> Sum a Source # mconcat :: [Sum a] -> Sum a Source #
AdditiveGroup a => Semigroup (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods (<>) :: Sum a -> Sum a -> Sum a Source # sconcat :: NonEmpty (Sum a) -> Sum a Source # stimes :: Integral b => b -> Sum a -> Sum a Source #
Bounded a => Bounded (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods minBound :: Sum a Source # maxBound :: Sum a Source #
Read a => Read (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods readsPrec :: Int -> ReadS (Sum a) Source # readList :: ReadS [Sum a] Source # readPrec :: ReadPrec (Sum a) Source # readListPrec :: ReadPrec [Sum a] Source #
Show a => Show (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods showsPrec :: Int -> Sum a -> ShowS Source # show :: Sum a -> String Source # showList :: [Sum a] -> ShowS Source #
Eq a => Eq (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods (==) :: Sum a -> Sum a -> Bool Source # (/=) :: Sum a -> Sum a -> Bool Source #
Ord a => Ord (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods compare :: Sum a -> Sum a -> Ordering Source # (<) :: Sum a -> Sum a -> Bool Source # (<=) :: Sum a -> Sum a -> Bool Source # (>) :: Sum a -> Sum a -> Bool Source # (>=) :: Sum a -> Sum a -> Bool Source # max :: Sum a -> Sum a -> Sum a Source # min :: Sum a -> Sum a -> Sum a Source #
AdditiveGroup a => AdditiveGroup (Sum a) Source # |
Instance details Defined in Data.AdditiveGroup Methods zeroV :: Sum a Source # (^+^) :: Sum a -> Sum a -> Sum a Source # negateV :: Sum a -> Sum a Source # (^-^) :: Sum a -> Sum a -> Sum a Source #

inSum :: (a -> b) -> Sum a -> Sum b Source #

Application a unary function inside a `Sum`

inSum2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c Source #

Application a binary function inside a `Sum`