linear-1.9.0.1: 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