Copyright | (C) 2017 Alexey Vagarenko |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Alexey Vagarenko (vagarenko@gmail.com) |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
- type Vector n e = Tensor '[n] e
- type VectorConstructor n e = TensorConstructor '[n] e
- type IsVector n e = IsTensor '[n] e
- vector :: forall n e. IsVector n e => VectorConstructor n e
- normalize :: Normalize n e => Vector n e -> NormalizedVector n e
- data NormalizedVector n e
- type Normalize (n :: Nat) e = (VectorLen n e, Scale '[n] e)
- unNormalizedVector :: NormalizedVector n e -> Vector n e
- vectorLenSquare :: VectorLenSquare n e => Vector n e -> e
- type VectorLenSquare (n :: Nat) e = (Num e, IsVector n e, MonoFunctorCtx '[n] e, MonoFoldableCtx '[n] e)
- vectorLen :: VectorLen n e => Vector n e -> e
- type VectorLen (n :: Nat) e = (Floating e, VectorLenSquare n e)
- dot :: Dot n e => Vector n e -> Vector n e -> e
- type Dot (n :: Nat) e = (Num e, IsVector n e, MonoFunctorCtx '[n] e, MonoFoldableCtx '[n] e, MonoZipCtx '[n] e)
- cross :: (Num e, IsVector 3 e) => Vector 3 e -> Vector 3 e -> Vector 3 e
- genVectorInstance :: Int -> Name -> Q [Dec]
Vector types
type VectorConstructor n e = TensorConstructor '[n] e Source #
Type of vector data constructor.
Construction
vector :: forall n e. IsVector n e => VectorConstructor n e Source #
Alias for a conrete vector data constructor.
Vector Operations
data NormalizedVector n e Source #
Normalized vector.
Eq (Vector n e) => Eq (NormalizedVector n e) Source # | |
Show (Vector n e) => Show (NormalizedVector n e) Source # | |
Generic (NormalizedVector n e) Source # | |
type Rep (NormalizedVector n e) Source # | |
type Normalize (n :: Nat) e = (VectorLen n e, Scale '[n] e) Source #
Constraints for normalize
function.
unNormalizedVector :: NormalizedVector n e -> Vector n e Source #
unwrap NormalizedVector
. Note: this does not give you original vector back.
unNormalizedVector . normalize /= id
vectorLenSquare :: VectorLenSquare n e => Vector n e -> e Source #
Get square of length of a vector.
type VectorLenSquare (n :: Nat) e = (Num e, IsVector n e, MonoFunctorCtx '[n] e, MonoFoldableCtx '[n] e) Source #
Constraints for vectorLenSquare
function.
type VectorLen (n :: Nat) e = (Floating e, VectorLenSquare n e) Source #
Constraints for vectorLen
function.
type Dot (n :: Nat) e = (Num e, IsVector n e, MonoFunctorCtx '[n] e, MonoFoldableCtx '[n] e, MonoZipCtx '[n] e) Source #
Constraints for dot
function.
cross :: (Num e, IsVector 3 e) => Vector 3 e -> Vector 3 e -> Vector 3 e Source #
Cross product is only defined for 3-dimensional vectors.