linear-1.3: Linear Algebra

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Linear.Trace

Description

Simple matrix operation for low-dimensional primitives.

Documentation

class Functor m => Trace m whereSource

Methods

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

Compute the trace of a matrix

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

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

Compute the diagonal of a matrix

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

Instances

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