On this page

Slot

symbolica.community.spenso Class

Slot(name: str, dimension: int, aind: int | Expression | str, dual: bool = False)

A tensor index slot combining a representation with an abstract index.

Slots are the building blocks for tensor structures, pairing a representation (which defines transformation properties) with an abstract index identifier. Slots with matching representations and indices can be contracted.

Examples

from symbolica.community.spenso import Slot, Representation
import symbolica as sp

# Create representation and slots
rep = Representation.euc(3)
slot1 = rep('mu')           # Slot with string index
slot2 = rep(1)              # Slot with integer index
slot3 = rep(sp.S('nu'))     # Slot with symbolic index

# Create custom slot
custom_slot = Slot("MyRep", 4, 'alpha', dual=False)

# Use in tensor structures
from symbolica.community.spenso import TensorIndices
tensor_structure = TensorIndices(slot1, slot2)

Constructor

#

Create a new slot with a custom representation and index.

Examples

from symbolica.community.spenso import Slot
import symbolica as sp

# Self-dual slot
euclidean_slot = Slot("Euclidean", 4, 'mu', dual=False)

# Dualizable slot
vector_slot = Slot("Vector", 4, 'nu', dual=True)

# With symbolic index
sym_index = sp.S('alpha')
symbolic_slot = Slot("Custom", 3, sym_index, dual=False)

Parameters

NameTypeDefaultDescription
namestr

String name for the representation

dimensionint

Size of the representation space

aindint | Expression | str

The abstract index (int, str, or Symbol)

dualboolFalse

If True, creates dualizable representation; if False, self-dual

Member details

__repr__

Method
#
__repr__() -> str

No description is available for this member.

__str__

Method
#
__str__() -> str

No description is available for this member.

dual

Method
#
dual() -> Slot

No description is available for this member.

to_expression

Method
#
to_expression() -> Expression

Convert the slot to a symbolic expression.

Examples

rep = Representation.euc(3)
slot = rep('mu')
expr = slot.to_expression()  # Symbolic representation of the slot