linear-1.20.8: Linear Algebra

Copyright (C) 2012-2015 Edward Kmett BSD-style (see the file LICENSE) Edward Kmett experimental non-portable Safe Haskell98

Linear.Trace

Description

Simple matrix operation for low-dimensional primitives.

# Documentation

class Functor m => Trace m where #

Minimal complete definition

Nothing

Methods

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

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 #

Compute the trace of a matrix

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


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

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 #

Compute the diagonal of a matrix

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

Instances
 # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => Complex (Complex a) -> a #diagonal :: Complex (Complex a) -> Complex a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => IntMap (IntMap a) -> a #diagonal :: IntMap (IntMap a) -> IntMap a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => V1 (V1 a) -> a #diagonal :: V1 (V1 a) -> V1 a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => V2 (V2 a) -> a #diagonal :: V2 (V2 a) -> V2 a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => V3 (V3 a) -> a #diagonal :: V3 (V3 a) -> V3 a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => V4 (V4 a) -> a #diagonal :: V4 (V4 a) -> V4 a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => V0 (V0 a) -> a #diagonal :: V0 (V0 a) -> V0 a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => Quaternion (Quaternion a) -> a # # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => Plucker (Plucker a) -> a #diagonal :: Plucker (Plucker a) -> Plucker a # Ord k => Trace (Map k) # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => Map k (Map k a) -> a #diagonal :: Map k (Map k a) -> Map k a # (Eq k, Hashable k) => Trace (HashMap k) # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => HashMap k (HashMap k a) -> a #diagonal :: HashMap k (HashMap k a) -> HashMap k a # Dim n => Trace (V n) # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => V n (V n a) -> a #diagonal :: V n (V n a) -> V n a # (Trace f, Trace g) => Trace (Product f g) # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => Product f g (Product f g a) -> a #diagonal :: Product f g (Product f g a) -> Product f g a # (Distributive g, Trace g, Trace f) => Trace (Compose g f) # Instance detailsDefined in Linear.Trace Methodstrace :: Num a => Compose g f (Compose g f a) -> a #diagonal :: Compose g f (Compose g f a) -> Compose g f a #