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
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | String name for the representation |
dimension | int | — | Size of the representation space |
aind | int | Expression | str | — | The abstract index (int, str, or Symbol) |
dual | bool | False | If True, creates dualizable representation; if False, self-dual |
Member details
__repr__
Method__str__
Methoddual
Methodto_expression
Method#
to_expression() -> ExpressionConvert the slot to a symbolic expression.
Examples
rep = Representation.euc(3)
slot = rep('mu')
expr = slot.to_expression() # Symbolic representation of the slotView generated signature source: docs/api/python/spynso3.pyi:525