HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelinear-1.22Haskell2010

Linear.Trace

Simple matrix operation for low-dimensional primitives.

  • 1 class
  • 1 value
  • Packagelinear-1.22
  • Exports2
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTrace.hs
classclass Functor m => Trace (m :: Type -> Type) where
#

Methods

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

    Compute the trace of a matrix

    Example1 expression
    trace (V2 (V2 a b) (V2 c d))a + d
  • diagonal :: m (m a) -> m a

    Compute the diagonal of a matrix

    Example1 expression
    diagonal (V2 (V2 a b) (V2 c d))V2 a d
Instances14Trace, …