# safe-tensor

 Stackage Nightly 2020-09-27: 0.2.1.0 Latest on Hackage: 0.2.1.0

See all snapshots `safe-tensor` appears in

Maintained by

#### Module documentation for 0.2.1.0

This version can be pinned in stack with:`safe-tensor-0.2.1.0@sha256:a0fb2dcc7871bace04b43d9a3461db2d79588932d56f9ca60b333818e9813a97,1751`

# safe-tensor

Dependently typed tensor algebra in Haskell. Useful for applications in field theory, e.g., carrying out calculations for https://doi.org/10.1103/PhysRevD.101.084025

## Rationale

Tensor calculus is reflected in the type system. We regard a tensor as a multilinear map from a product of vector spaces and duals thereof to the common field. The type of each tensor is its generalized rank, describing the vector spaces it acts on and assigning a label to each vector space. There are a few rules for tensor operations:

• Only tensors of the same type may be added. The result is a tensor of this type.
• Tensors may be multiplied if the resulting generalized rank does not contain repeated labels for the same (dual) vector space.
• The contraction of a tensors removes pairs of vector space and dual vector space with the same label from the generalized rank.

It is thus impossible to perform inconsistent tensor operations.

There is also an existentially typed variant of the tensor type useful for runtime computations. These computations take place in the Error monad, throwing errors if operand types are not consistent.

The approach is described in detail in the Hackage documentation.

# Changelog

## [0.2.1.0] - 2020-07-20

• removeZeros is optional: Tensor addition and tensor contraction will not remove zero values afterwards in order to improve performance. Zero values have to be removed by explicitly applying removeZeros to a tensor.
• all data types are now instances of NFData
• added functionality to read solution from an rref matrix in a reversed manner

## [0.2.0.0] - 2020-07-08

• major documentation improvements
• backwards compatibility with GHC 8.6.5

## [0.1.0.0] - 2020-07-07

Initial release.

Depends on 7 packages(full list with versions):