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 | Haskell2010 |
Simple matrix operation for low-dimensional primitives.
Documentation
class Functor m => Trace m where Source #
Nothing
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 Plucker Source # | |
Trace Quaternion Source # | |
Defined in Linear.Trace trace :: Num a => Quaternion (Quaternion a) -> a Source # diagonal :: Quaternion (Quaternion a) -> Quaternion a Source # | |
Trace V0 Source # | |
Trace V1 Source # | |
Trace V2 Source # | |
Trace V3 Source # | |
Trace V4 Source # | |
Ord k => Trace (Map k) Source # | |
(Eq k, Hashable k) => Trace (HashMap k) Source # | |
Dim n => Trace (V n) Source # | |
(Trace f, Trace g) => Trace (Product f g) Source # | |
(Distributive g, Trace g, Trace f) => Trace (Compose g f) Source # | |
frobenius :: (Num a, Foldable f, Additive f, Additive g, Distributive g, Trace g) => f (g a) -> a Source #
Compute the Frobenius norm of a matrix.