hTensor-0.9.1: Multidimensional arrays and simple tensor computations.

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

 Source # Methods(==) :: Variant -> Variant -> Bool #(/=) :: Variant -> Variant -> Bool # Source # MethodsshowList :: [Variant] -> ShowS # Source # Methods Source # MethodsshowList :: [Idx Variant] -> ShowS # Coord t => Show (Tensor t) Source # MethodsshowsPrec :: Int -> Tensor t -> ShowS #show :: Tensor t -> String #showList :: [Tensor t] -> ShowS #

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

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

subindex :: Coord t => Name -> [Tensor t] -> Tensor t Source #

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

vector :: [Double] -> Tensor Double Source #

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

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

transf :: [[Double]] -> Tensor Double Source #

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

# Index manipulation

switch :: Tensor t -> Tensor t Source #

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

cov :: NArray i t -> Tensor t Source #

Make all dimensions covariant.

contrav :: NArray i t -> Tensor t Source #

Make all dimensions contravariant.

forget :: NArray i t -> Array t Source #

Remove the Variant nature of coordinates.