linear-1.20.3: 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.V4

Description

4-D Vectors

Synopsis

- data V4 a = V4 !a !a !a !a
- vector :: Num a => V3 a -> V4 a
- point :: Num a => V3 a -> V4 a
- normalizePoint :: Fractional a => V4 a -> V3 a
- class R1 t where
  - _x :: Lens' (t a) a
- class R1 t => R2 t where
  - _y :: Lens' (t a) a
  - _xy :: Lens' (t a) (V2 a)
- _yx :: R2 t => Lens' (t a) (V2 a)
- class R2 t => R3 t where
  - _z :: Lens' (t a) a
  - _xyz :: Lens' (t a) (V3 a)
- _xz :: R3 t => Lens' (t a) (V2 a)
- _yz :: R3 t => Lens' (t a) (V2 a)
- _zx :: R3 t => Lens' (t a) (V2 a)
- _zy :: R3 t => Lens' (t a) (V2 a)
- _xzy :: R3 t => Lens' (t a) (V3 a)
- _yxz :: R3 t => Lens' (t a) (V3 a)
- _yzx :: R3 t => Lens' (t a) (V3 a)
- _zxy :: R3 t => Lens' (t a) (V3 a)
- _zyx :: R3 t => Lens' (t a) (V3 a)
- class R3 t => R4 t where
  - _w :: Lens' (t a) a
  - _xyzw :: Lens' (t a) (V4 a)
- _xw :: R4 t => Lens' (t a) (V2 a)
- _yw :: R4 t => Lens' (t a) (V2 a)
- _zw :: R4 t => Lens' (t a) (V2 a)
- _wx :: R4 t => Lens' (t a) (V2 a)
- _wy :: R4 t => Lens' (t a) (V2 a)
- _wz :: R4 t => Lens' (t a) (V2 a)
- _xyw :: R4 t => Lens' (t a) (V3 a)
- _xzw :: R4 t => Lens' (t a) (V3 a)
- _xwy :: R4 t => Lens' (t a) (V3 a)
- _xwz :: R4 t => Lens' (t a) (V3 a)
- _yxw :: R4 t => Lens' (t a) (V3 a)
- _yzw :: R4 t => Lens' (t a) (V3 a)
- _ywx :: R4 t => Lens' (t a) (V3 a)
- _ywz :: R4 t => Lens' (t a) (V3 a)
- _zxw :: R4 t => Lens' (t a) (V3 a)
- _zyw :: R4 t => Lens' (t a) (V3 a)
- _zwx :: R4 t => Lens' (t a) (V3 a)
- _zwy :: R4 t => Lens' (t a) (V3 a)
- _wxy :: R4 t => Lens' (t a) (V3 a)
- _wxz :: R4 t => Lens' (t a) (V3 a)
- _wyx :: R4 t => Lens' (t a) (V3 a)
- _wyz :: R4 t => Lens' (t a) (V3 a)
- _wzx :: R4 t => Lens' (t a) (V3 a)
- _wzy :: R4 t => Lens' (t a) (V3 a)
- _xywz :: R4 t => Lens' (t a) (V4 a)
- _xzyw :: R4 t => Lens' (t a) (V4 a)
- _xzwy :: R4 t => Lens' (t a) (V4 a)
- _xwyz :: R4 t => Lens' (t a) (V4 a)
- _xwzy :: R4 t => Lens' (t a) (V4 a)
- _yxzw :: R4 t => Lens' (t a) (V4 a)
- _yxwz :: R4 t => Lens' (t a) (V4 a)
- _yzxw :: R4 t => Lens' (t a) (V4 a)
- _yzwx :: R4 t => Lens' (t a) (V4 a)
- _ywxz :: R4 t => Lens' (t a) (V4 a)
- _ywzx :: R4 t => Lens' (t a) (V4 a)
- _zxyw :: R4 t => Lens' (t a) (V4 a)
- _zxwy :: R4 t => Lens' (t a) (V4 a)
- _zyxw :: R4 t => Lens' (t a) (V4 a)
- _zywx :: R4 t => Lens' (t a) (V4 a)
- _zwxy :: R4 t => Lens' (t a) (V4 a)
- _zwyx :: R4 t => Lens' (t a) (V4 a)
- _wxyz :: R4 t => Lens' (t a) (V4 a)
- _wxzy :: R4 t => Lens' (t a) (V4 a)
- _wyxz :: R4 t => Lens' (t a) (V4 a)
- _wyzx :: R4 t => Lens' (t a) (V4 a)
- _wzxy :: R4 t => Lens' (t a) (V4 a)
- _wzyx :: R4 t => Lens' (t a) (V4 a)
- ex :: R1 t => E t
- ey :: R2 t => E t
- ez :: R3 t => E t
- ew :: R4 t => E t

# Documentation

data V4 a Source

A 4-dimensional vector.

Constructors

V4 !a !a !a !a |

Instances

Monad V4 Source |
Functor V4 Source |
MonadFix V4 Source |
Applicative V4 Source |
Foldable V4 Source |
Traversable V4 Source |
Generic1 V4 Source |
Distributive V4 Source |
Representable V4 Source |
MonadZip V4 Source |
Serial1 V4 Source |
Traversable1 V4 Source |
Apply V4 Source |
Bind V4 Source |
Foldable1 V4 Source |
Eq1 V4 Source |
Ord1 V4 Source |
Read1 V4 Source |
Show1 V4 Source |
Additive V4 Source |
Metric V4 Source |
R1 V4 Source |
R2 V4 Source |
R3 V4 Source |
R4 V4 Source |
Trace V4 Source |
Affine V4 Source |
Unbox a => Vector Vector (V4 a) Source |
Unbox a => MVector MVector (V4 a) Source |
Num r => Coalgebra r (E V4) Source |
Bounded a => Bounded (V4 a) Source |
Eq a => Eq (V4 a) Source |
Floating a => Floating (V4 a) Source |
Fractional a => Fractional (V4 a) Source |
Data a => Data (V4 a) Source |
Num a => Num (V4 a) Source |
Ord a => Ord (V4 a) Source |
Read a => Read (V4 a) Source |
Show a => Show (V4 a) Source |
Ix a => Ix (V4 a) Source |
Generic (V4 a) Source |
Storable a => Storable (V4 a) Source |
Binary a => Binary (V4 a) Source |
Serial a => Serial (V4 a) Source |
Serialize a => Serialize (V4 a) Source |
NFData a => NFData (V4 a) Source |
Hashable a => Hashable (V4 a) Source |
Unbox a => Unbox (V4 a) Source |
Ixed (V4 a) Source |
Epsilon a => Epsilon (V4 a) Source |
FunctorWithIndex (E V4) V4 Source |
FoldableWithIndex (E V4) V4 Source |
TraversableWithIndex (E V4) V4 Source |
Each (V4 a) (V4 b) a b Source |
type Rep1 V4 Source |
type Rep V4 = E V4 Source |
type Diff V4 = V4 Source |
data MVector s (V4 a) = MV_V4 !Int !(MVector s a) Source |
type Rep (V4 a) Source |
data Vector (V4 a) = V_V4 !Int !(Vector a) Source |
type Index (V4 a) = E V4 Source |
type IxValue (V4 a) = a Source |

vector :: Num a => V3 a -> V4 a Source

Convert a 3-dimensional affine vector into a 4-dimensional homogeneous vector.

point :: Num a => V3 a -> V4 a Source

Convert a 3-dimensional affine point into a 4-dimensional homogeneous vector.

normalizePoint :: Fractional a => V4 a -> V3 a Source

Convert 4-dimensional projective coordinates to a 3-dimensional point. This operation may be denoted, `euclidean [x:y:z:w] = (x/w, y/w, z/w)` where the projective, homogenous, coordinate `[x:y:z:w]` is one of many associated with a single point `(x/w, y/w, z/w)`.

class R1 t where Source

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

Minimal complete definition

Nothing

Methods

_x :: Lens' (t a) a Source

    >>> V1 2 ^._x
    2

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

Instances

R1 Identity Source |
R1 V1 Source |
R1 V2 Source |
R1 V3 Source |
R1 V4 Source |
R1 f => R1 (Point f) Source |

class R1 t => R2 t where Source

A space that distinguishes 2 orthogonal basis vectors `_x` and `_y`, but may have more.

Minimal complete definition

Nothing

Methods

_y :: Lens' (t a) a Source

    >>> V2 1 2 ^._y
    2

    >>> V2 1 2 & _y .~ 3
    V2 1 3

_xy :: Lens' (t a) (V2 a) Source

Instances

R2 V2 Source |
R2 V3 Source |
R2 V4 Source |
R2 f => R2 (Point f) Source |

_yx :: R2 t => Lens' (t a) (V2 a) Source

    >>> V2 1 2 ^. _yx
    V2 2 1

class R2 t => R3 t where Source

A space that distinguishes 3 orthogonal basis vectors: `_x`, `_y`, and `_z`. (It may have more)

Minimal complete definition

Nothing

Methods

_z :: Lens' (t a) a Source

    >>> V3 1 2 3 ^. _z
    3

_xyz :: Lens' (t a) (V3 a) Source

Instances

R3 V3 Source |
R3 V4 Source |
R3 f => R3 (Point f) Source |

_xz :: R3 t => Lens' (t a) (V2 a) Source

_yz :: R3 t => Lens' (t a) (V2 a) Source

_zx :: R3 t => Lens' (t a) (V2 a) Source

_zy :: R3 t => Lens' (t a) (V2 a) Source

_xzy :: R3 t => Lens' (t a) (V3 a) Source

_yxz :: R3 t => Lens' (t a) (V3 a) Source

_yzx :: R3 t => Lens' (t a) (V3 a) Source

_zxy :: R3 t => Lens' (t a) (V3 a) Source

_zyx :: R3 t => Lens' (t a) (V3 a) Source

class R3 t => R4 t where Source

A space that distinguishes orthogonal basis vectors `_x`, `_y`, `_z`, `_w`. (It may have more.)

Minimal complete definition

Nothing

Methods

_w :: Lens' (t a) a Source

    >>> V4 1 2 3 4 ^._w
    4

_xyzw :: Lens' (t a) (V4 a) Source

Instances

R4 V4 Source |
R4 f => R4 (Point f) Source |

_xw :: R4 t => Lens' (t a) (V2 a) Source

_yw :: R4 t => Lens' (t a) (V2 a) Source

_zw :: R4 t => Lens' (t a) (V2 a) Source

_wx :: R4 t => Lens' (t a) (V2 a) Source

_wy :: R4 t => Lens' (t a) (V2 a) Source

_wz :: R4 t => Lens' (t a) (V2 a) Source

_xyw :: R4 t => Lens' (t a) (V3 a) Source

_xzw :: R4 t => Lens' (t a) (V3 a) Source

_xwy :: R4 t => Lens' (t a) (V3 a) Source

_xwz :: R4 t => Lens' (t a) (V3 a) Source

_yxw :: R4 t => Lens' (t a) (V3 a) Source

_yzw :: R4 t => Lens' (t a) (V3 a) Source

_ywx :: R4 t => Lens' (t a) (V3 a) Source

_ywz :: R4 t => Lens' (t a) (V3 a) Source

_zxw :: R4 t => Lens' (t a) (V3 a) Source

_zyw :: R4 t => Lens' (t a) (V3 a) Source

_zwx :: R4 t => Lens' (t a) (V3 a) Source

_zwy :: R4 t => Lens' (t a) (V3 a) Source

_wxy :: R4 t => Lens' (t a) (V3 a) Source

_wxz :: R4 t => Lens' (t a) (V3 a) Source

_wyx :: R4 t => Lens' (t a) (V3 a) Source

_wyz :: R4 t => Lens' (t a) (V3 a) Source

_wzx :: R4 t => Lens' (t a) (V3 a) Source

_wzy :: R4 t => Lens' (t a) (V3 a) Source

_xywz :: R4 t => Lens' (t a) (V4 a) Source

_xzyw :: R4 t => Lens' (t a) (V4 a) Source

_xzwy :: R4 t => Lens' (t a) (V4 a) Source

_xwyz :: R4 t => Lens' (t a) (V4 a) Source

_xwzy :: R4 t => Lens' (t a) (V4 a) Source

_yxzw :: R4 t => Lens' (t a) (V4 a) Source

_yxwz :: R4 t => Lens' (t a) (V4 a) Source

_yzxw :: R4 t => Lens' (t a) (V4 a) Source

_yzwx :: R4 t => Lens' (t a) (V4 a) Source

_ywxz :: R4 t => Lens' (t a) (V4 a) Source

_ywzx :: R4 t => Lens' (t a) (V4 a) Source

_zxyw :: R4 t => Lens' (t a) (V4 a) Source

_zxwy :: R4 t => Lens' (t a) (V4 a) Source

_zyxw :: R4 t => Lens' (t a) (V4 a) Source

_zywx :: R4 t => Lens' (t a) (V4 a) Source

_zwxy :: R4 t => Lens' (t a) (V4 a) Source

_zwyx :: R4 t => Lens' (t a) (V4 a) Source

_wxyz :: R4 t => Lens' (t a) (V4 a) Source

_wxzy :: R4 t => Lens' (t a) (V4 a) Source

_wyxz :: R4 t => Lens' (t a) (V4 a) Source

_wyzx :: R4 t => Lens' (t a) (V4 a) Source

_wzxy :: R4 t => Lens' (t a) (V4 a) Source

_wzyx :: R4 t => Lens' (t a) (V4 a) Source

ex :: R1 t => E t Source

ey :: R2 t => E t Source

ez :: R3 t => E t Source

ew :: R4 t => E t Source