Slot
Slot
Slot()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)Methods
| Name | Description |
|---|---|
__new__ |
Create a new slot with a custom representation and index. |
__repr__ |
|
__str__ |
|
dual |
|
to_expression |
Convert the slot to a symbolic expression. |
__new__
Slot.__new__(
name: builtins.str,
dimension: builtins.int,
aind: builtins.int | Expression | str,
dual: builtins.bool = ...,
) -> SlotCreate a new slot with a custom representation and index.
Parameters
- name: String name for the representation- dimension: Size of the representation space - aind: The abstract index (int, str, or Symbol) - dual: If True, creates dualizable representation; if False, self-dual
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)__repr__
Slot.__repr__() -> builtins.str__str__
Slot.__str__() -> builtins.strdual
Slot.dual() -> Slotto_expression
Slot.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 slot