Table of Contents

SimpleTensor


Basics

SimpleTensor represents a simple tensors like f_mn of symbols like x etc. Like any other expression, it inherits all properties of Tensor. SimpleTensor adopts the following convention on its indices: the indices of SimpleTensor (SimpleIndices) are sorted by their types, but the relative ordering of indices within a particular type is same as defined by the user:

def t = 'f_cba^\\alpha_AB'.t
println t.indices
   > _{cbaAB}^{\alpha}
The relative ordering is not changed even if tensor has symmetry property; in latter case Redberry uses algorithms provided by Mappings of indices to compare expressions instead of trying to put expression in canonical form.

The distinctive feature of simple tensors is the presence of symmetries. In order to bind symmetries to simple tensor, one can use addSymmetry method or directly call addSymmetry from simple tensor SimpleIndices:

addSymmetry 'f_pqr', [1, 0].p
//or equivalently
'f_klm'.t.indices.symmetries.addSymmetry( [1, 0].p )
Once specified, symmetries will be automatically set up for all same simple tensors (f_abc or f_qrs etc.) whichever way they are created.

Details

In order to get name of simple tensor one can get .stringName property:

def t = 'f_abc^\\alpha_AB'.t
println t.stringName
   > f
On the other hand, this name does not reflect the mathematical nature of simple tensors, and for example two completely different tensors f_a and f_ab have same stringName.

The unique identifier of SimpleTensor which encodes its mathematical nature is an integer property .name: two simple tensors have same .name if and only if they have same .stringName and same structure of indices:

assert 'f_ab'.t.name == 'f_bc'.t.name
assert 'f_ab'.t.name != 't_bc'.t.name
assert 'f_ab'.t.name != 'f_b'.t.name
assert 'f_ab'.t.name != 'f_AB'.t.name
For further details see API.

See also