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 | Safe
Language | Haskell98

Linear.Trace

Description

Simple matrix operation for low-dimensional primitives.

# Documentation

class Functor m => Trace m where Source

Minimal complete definition

Nothing

Methods

trace :: Num a => m (m a) -> a Source

Compute the trace of a matrix

    >>> trace (V2 (V2 a b) (V2 c d))
    a + d

diagonal :: m (m a) -> m a Source

Compute the diagonal of a matrix

    >>> diagonal (V2 (V2 a b) (V2 c d))
    V2 a d

Instances

Trace Complex Source |
Trace IntMap Source |
Trace V0 Source |
Trace V1 Source |
Trace V2 Source |
Trace V3 Source |
Trace V4 Source |
Trace Plucker Source |
Trace Quaternion Source |
Ord k => Trace (Map k) Source |
(Eq k, Hashable k) => Trace (HashMap k) Source |
(Distributive g, Trace g, Trace f) => Trace (Compose g f) Source |
(Trace f, Trace g) => Trace (Product f g) Source |
Dim * n => Trace (V * n) Source |