hTensor-0.8.0: Multidimensional arrays and simple tensor computations.

Stability experimental Alberto Ruiz

Numeric.LinearAlgebra.Tensor

Description

Tensor computations. Indices can only be contracted if they are of different `Variant` type.

Synopsis

# The Tensor type

data Variant Source

Constructors

 Contra Co

Instances

 Eq Variant Show Variant Compat Variant Show (Idx Variant) Coord t => Show (Tensor t)

Arguments

 :: Coord t => [Int] dimensions -> [t] coordinates -> Tensor t

Creates a tensor from a list of dimensions and a list of coordinates. A positive dimension means that the index is assumed to be contravariant (vector-like), and a negative dimension means that the index is assumed to be covariant (like a linear function, or covector). Contractions can only be performed between indices of different type.

# Tensor creation utilities

superindex :: Coord t => Name -> [Tensor t] -> Tensor tSource

Create an `Tensor` from a list of parts with a contravariant index (`superindex = newIndex Contra`).

subindex :: Coord t => Name -> [Tensor t] -> Tensor tSource

Create an `Tensor` from a list of parts with a covariant index (`subindex = newIndex Co`).

vector :: [Double] -> Tensor DoubleSource

Create a contravariant 1st order tensor from a list of coordinates.

covector :: [Double] -> Tensor DoubleSource

Create a covariant 1st order tensor from a list of coordinates.

transf :: [[Double]] -> Tensor DoubleSource

Create a 1-contravariant, 1-covariant 2nd order from list of lists of coordinates.

# Index manipulation

switch :: Tensor t -> Tensor tSource

Change the `Variant` nature of all dimensions to the opposite ones.

cov :: NArray i t -> Tensor tSource

Make all dimensions covariant.

contrav :: NArray i t -> Tensor tSource

Make all dimensions contravariant.

forget :: NArray i t -> Array tSource

Remove the `Variant` nature of coordinates.