linear-1.19.1.1: Linear Algebra

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

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 
Trace IntMap 
Trace V0 
Trace V1 
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)