Copyright | (c) Artem Chirkin |
---|---|

License | BSD3 |

Maintainer | chirkin@arch.ethz.ch |

Safe Haskell | None |

Language | Haskell2010 |

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

- class ConcatList as bs asbs => Contraction (t :: Type) (as :: [Nat]) (bs :: [Nat]) (asbs :: [Nat]) | asbs as -> bs, asbs bs -> as, as bs -> asbs where
- (%*) :: (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

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

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

(ConcatList as bs asbs, Dimensions as, Dimensions bs, Num t) => Contraction t as bs 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.