Portability | non-portable (GHC extensions) |
---|---|

Stability | provisional |

Maintainer | nilsson@cs.yale.edu |

Vector space type relation and basic instances.

- class Floating a => VectorSpace v a | v -> a where
- zeroVector :: v
- (*^) :: a -> v -> v
- (^/) :: v -> a -> v
- negateVector :: v -> v
- (^+^) :: v -> v -> v
- (^-^) :: v -> v -> v
- dot :: v -> v -> a
- norm :: v -> a
- normalize :: v -> v

# Documentation

class Floating a => VectorSpace v a | v -> a whereSource

Type class for a vector space

zeroVector :: vSource

Vector with no magnitude

Scale the magnitude

De-scale the magnitude

negateVector :: v -> vSource

Negation

Combine two vectors additively

Subtract a vector from another

Take the dot-product of two vectors

Vector norm

Produce a unit vector in the direction of a vector

VectorSpace Double Double | |

VectorSpace Float Float | |

RealFloat a => VectorSpace (Vector2 a) a | Rotate a vector by some angle theta |

RealFloat a => VectorSpace (Vector3 a) a | |

Floating a => VectorSpace (a, a) a | |

Floating a => VectorSpace (a, a, a) a | |

Floating a => VectorSpace (a, a, a, a) a | |

Floating a => VectorSpace (a, a, a, a, a) a |