linear-1.20.7: Linear Algebra

Copyright(C) 2012-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell98

Linear.Trace

Description

Simple matrix operation for low-dimensional primitives.

Documentation

class Functor m => Trace m where Source #

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

trace :: (Foldable m, 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

diagonal :: Monad m => 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 # 

Methods

trace :: Num a => Complex (Complex a) -> a Source #

diagonal :: Complex (Complex a) -> Complex a Source #

Trace IntMap Source # 

Methods

trace :: Num a => IntMap (IntMap a) -> a Source #

diagonal :: IntMap (IntMap a) -> IntMap a Source #

Trace V0 Source # 

Methods

trace :: Num a => V0 (V0 a) -> a Source #

diagonal :: V0 (V0 a) -> V0 a Source #

Trace V1 Source # 

Methods

trace :: Num a => V1 (V1 a) -> a Source #

diagonal :: V1 (V1 a) -> V1 a Source #

Trace V2 Source # 

Methods

trace :: Num a => V2 (V2 a) -> a Source #

diagonal :: V2 (V2 a) -> V2 a Source #

Trace V3 Source # 

Methods

trace :: Num a => V3 (V3 a) -> a Source #

diagonal :: V3 (V3 a) -> V3 a Source #

Trace V4 Source # 

Methods

trace :: Num a => V4 (V4 a) -> a Source #

diagonal :: V4 (V4 a) -> V4 a Source #

Trace Plucker Source # 

Methods

trace :: Num a => Plucker (Plucker a) -> a Source #

diagonal :: Plucker (Plucker a) -> Plucker a Source #

Trace Quaternion Source # 
Ord k => Trace (Map k) Source # 

Methods

trace :: Num a => Map k (Map k a) -> a Source #

diagonal :: Map k (Map k a) -> Map k a Source #

(Eq k, Hashable k) => Trace (HashMap k) Source # 

Methods

trace :: Num a => HashMap k (HashMap k a) -> a Source #

diagonal :: HashMap k (HashMap k a) -> HashMap k a Source #

Dim k n => Trace (V k n) Source # 

Methods

trace :: Num a => V k n (V k n a) -> a Source #

diagonal :: V k n (V k n a) -> V k n a Source #

(Trace f, Trace g) => Trace (Product * f g) Source # 

Methods

trace :: Num a => Product * f g (Product * f g a) -> a Source #

diagonal :: Product * f g (Product * f g a) -> Product * f g a Source #

(Distributive g, Trace g, Trace f) => Trace (Compose * * g f) Source # 

Methods

trace :: Num a => Compose * * g f (Compose * * g f a) -> a Source #

diagonal :: Compose * * g f (Compose * * g f a) -> Compose * * g f a Source #