linear-1.21.3: Linear Algebra

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

Linear.Trace

Description

Simple matrix operation for low-dimensional primitives.

Synopsis

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

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 # 
Instance details

Defined in Linear.Trace

Methods

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

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

Trace IntMap Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

Trace V1 Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

Trace V2 Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

Trace V3 Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

Trace V4 Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

Trace V0 Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

Trace Quaternion Source # 
Instance details

Defined in Linear.Trace

Trace Plucker Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

Ord k => Trace (Map k) Source # 
Instance details

Defined in Linear.Trace

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 # 
Instance details

Defined in Linear.Trace

Methods

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

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

Dim n => Trace (V n) Source # 
Instance details

Defined in Linear.Trace

Methods

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

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

(Trace f, Trace g) => Trace (Product f g) Source # 
Instance details

Defined in Linear.Trace

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 # 
Instance details

Defined in Linear.Trace

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 #

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.