generative-art-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Algebra.VectorSpace

Synopsis

Documentation

class VectorSpace v where Source #

A generic vector space. Not only classic vectors like Vec2 form a vector space, but also concepts like Angles – anything that can be added, inverted, and multiplied with a scalar.

Vector spaces come with a number of laws that you can look up on Wikipedia. The short version is: each operation behaves like addition/multiplication on normal numbers.

Minimal complete definition

(+.), (*.), ((-.) | negateV), zero

Methods

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

Vector addition

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

Vector subtraction

(*.) :: Double -> v -> v infixl 7 Source #

Multiplication with a scalar

(/.) :: v -> Double -> v infixl 7 Source #

Division by a scalar

zero :: v Source #

Neutral element

negateV :: v -> v Source #

Inverse element

Instances

Instances details
VectorSpace Angle Source # 
Instance details

Defined in Geometry.Core

VectorSpace Mat2 Source # 
Instance details

Defined in Geometry.Core

VectorSpace Vec2 Source # 
Instance details

Defined in Geometry.Core

VectorSpace PhaseSpace Source # 
Instance details

Defined in Physics

VectorSpace Double Source # 
Instance details

Defined in Algebra.VectorSpace

VectorSpace a => VectorSpace (NBody a) Source # 
Instance details

Defined in Physics

Methods

(+.) :: NBody a -> NBody a -> NBody a Source #

(-.) :: NBody a -> NBody a -> NBody a Source #

(*.) :: Double -> NBody a -> NBody a Source #

(/.) :: NBody a -> Double -> NBody a Source #

zero :: NBody a Source #

negateV :: NBody a -> NBody a Source #

VectorSpace b => VectorSpace (a -> b) Source # 
Instance details

Defined in Algebra.VectorSpace

Methods

(+.) :: (a -> b) -> (a -> b) -> a -> b Source #

(-.) :: (a -> b) -> (a -> b) -> a -> b Source #

(*.) :: Double -> (a -> b) -> a -> b Source #

(/.) :: (a -> b) -> Double -> a -> b Source #

zero :: a -> b Source #

negateV :: (a -> b) -> a -> b Source #

(VectorSpace v1, VectorSpace v2) => VectorSpace (v1, v2) Source # 
Instance details

Defined in Algebra.VectorSpace

Methods

(+.) :: (v1, v2) -> (v1, v2) -> (v1, v2) Source #

(-.) :: (v1, v2) -> (v1, v2) -> (v1, v2) Source #

(*.) :: Double -> (v1, v2) -> (v1, v2) Source #

(/.) :: (v1, v2) -> Double -> (v1, v2) Source #

zero :: (v1, v2) Source #

negateV :: (v1, v2) -> (v1, v2) Source #

(VectorSpace v1, VectorSpace v2, VectorSpace v3) => VectorSpace (v1, v2, v3) Source # 
Instance details

Defined in Algebra.VectorSpace

Methods

(+.) :: (v1, v2, v3) -> (v1, v2, v3) -> (v1, v2, v3) Source #

(-.) :: (v1, v2, v3) -> (v1, v2, v3) -> (v1, v2, v3) Source #

(*.) :: Double -> (v1, v2, v3) -> (v1, v2, v3) Source #

(/.) :: (v1, v2, v3) -> Double -> (v1, v2, v3) Source #

zero :: (v1, v2, v3) Source #

negateV :: (v1, v2, v3) -> (v1, v2, v3) Source #

(VectorSpace v1, VectorSpace v2, VectorSpace v3, VectorSpace v4) => VectorSpace (v1, v2, v3, v4) Source # 
Instance details

Defined in Algebra.VectorSpace

Methods

(+.) :: (v1, v2, v3, v4) -> (v1, v2, v3, v4) -> (v1, v2, v3, v4) Source #

(-.) :: (v1, v2, v3, v4) -> (v1, v2, v3, v4) -> (v1, v2, v3, v4) Source #

(*.) :: Double -> (v1, v2, v3, v4) -> (v1, v2, v3, v4) Source #

(/.) :: (v1, v2, v3, v4) -> Double -> (v1, v2, v3, v4) Source #

zero :: (v1, v2, v3, v4) Source #

negateV :: (v1, v2, v3, v4) -> (v1, v2, v3, v4) Source #

(VectorSpace v1, VectorSpace v2, VectorSpace v3, VectorSpace v4, VectorSpace v5) => VectorSpace (v1, v2, v3, v4, v5) Source # 
Instance details

Defined in Algebra.VectorSpace

Methods

(+.) :: (v1, v2, v3, v4, v5) -> (v1, v2, v3, v4, v5) -> (v1, v2, v3, v4, v5) Source #

(-.) :: (v1, v2, v3, v4, v5) -> (v1, v2, v3, v4, v5) -> (v1, v2, v3, v4, v5) Source #

(*.) :: Double -> (v1, v2, v3, v4, v5) -> (v1, v2, v3, v4, v5) Source #

(/.) :: (v1, v2, v3, v4, v5) -> Double -> (v1, v2, v3, v4, v5) Source #

zero :: (v1, v2, v3, v4, v5) Source #

negateV :: (v1, v2, v3, v4, v5) -> (v1, v2, v3, v4, v5) Source #

vsum :: VectorSpace a => [a] -> a Source #