easytensor-2.1.1.0: Pure, type-indexed haskell vector, matrix, and tensor library.

Numeric.DataFrame.Contraction

Description

This modules provides generalization of a matrix product: tensor-like contraction. For matrices and vectors this is a normal matrix*matrix or vector*matrix or matrix*vector product, for larger dimensions it calculates the scalar product of "adjacent" dimesnions of a tensor.

Synopsis

# Documentation

class ConcatList as bs asbs => Contraction (t :: Type) (as :: [Nat]) (bs :: [Nat]) (asbs :: [Nat]) | asbs as -> bs, asbs bs -> as, as bs -> asbs where Source #

Methods

contract :: (KnownDim m, PrimArray t (DataFrame t (as +: m)), PrimArray t (DataFrame t (m :+ bs)), PrimArray t (DataFrame t asbs)) => DataFrame t (as +: m) -> DataFrame t (m :+ bs) -> DataFrame t asbs Source #

Generalization of a matrix product: take scalar product over one dimension and, thus, concatenate other dimesnions

#### Instances

Instances details
 (ConcatList as bs asbs, Dimensions as, Dimensions bs, Num t) => Contraction t as bs asbs Source # Instance detailsDefined in Numeric.DataFrame.Contraction Methodscontract :: forall (m :: Nat). (KnownDim m, PrimArray t (DataFrame t (as +: m)), PrimArray t (DataFrame t (m :+ bs)), PrimArray t (DataFrame t asbs)) => DataFrame t (as +: m) -> DataFrame t (m :+ bs) -> DataFrame t asbs Source #

(%*) :: (Contraction t as bs asbs, KnownDim m, PrimArray t (DataFrame t (as +: m)), PrimArray t (DataFrame t (m :+ bs)), PrimArray t (DataFrame t asbs)) => DataFrame t (as +: m) -> DataFrame t (m :+ bs) -> DataFrame t asbs infixl 7 Source #

Tensor contraction. In particular: 1. matrix-matrix product 2. matrix-vector or vector-matrix product 3. dot product of two vectors.