TensorName
symbolica.community.spenso Class
TensorName(name: str, *, rank: Optional[int] = None, is_symmetric: Optional[bool] = None, is_antisymmetric: Optional[bool] = None, is_cyclesymmetric: Optional[bool] = None, is_linear: Optional[bool] = None, is_flat: Optional[bool] = None, is_scalar: Optional[bool] = None, is_real: Optional[bool] = None, is_integer: Optional[bool] = None, is_positive: Optional[bool] = None, tags: Optional[Sequence[str]] = None, aliases: Optional[Sequence[str]] = None, normalization: Optional[Transformer | Callable[[Expression], Expression]] = None, print: Optional[Any] = None, derivative: Optional[Any] = None, series: Optional[Any] = None, eval: Optional[Any] = None, data: Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal] | str | dict | list | bytes] = None)A symbolic name for tensor expressions.
TensorName represents named tensor functions that can be called with scalar arguments, slots, and representations to create tensor expressions. Names can have various mathematical properties like symmetry, antisymmetry, and custom normalization or printing behavior.
The predefined accessors such as TensorName.gamma() and TensorName.t() return raw fixed heads for introspection and pattern construction; those reserved names cannot be called directly. Use the matching TensorExpression factory for concrete tensors or TensorPattern shortcut for rewrite patterns.
Examples
from symbolica.community.spenso import TensorName, Slot, Representation
T = TensorName("T")
symmetric_T = TensorName("S", is_symmetric=True)
antisymmetric_T = TensorName("A", is_antisymmetric=True)
rep = Representation.cof(3)
mu = rep('mu')
nu = rep('nu')
tensor_expression = T(mu, nu)Constructor
#Create a new tensor name with optional mathematical properties.
Returns
TensorName
A new TensorName with the specified properties
Examples
from symbolica.community.spenso import TensorName
T = TensorName("T")
g = TensorName("g", is_symmetric=True)
F = TensorName("F", is_antisymmetric=True)
D = TensorName("D", is_linear=True)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | The string name for the tensor function |
rank | Optional[int] | None | The declared rank. Only rank one has a dedicated construction invariant. |
is_symmetric | Optional[bool] | None | If True, tensor is symmetric under index permutation |
is_antisymmetric | Optional[bool] | None | If True, tensor is antisymmetric under index permutation |
is_cyclesymmetric | Optional[bool] | None | If True, tensor is symmetric under cyclic permutations |
is_linear | Optional[bool] | None | If True, tensor is linear in its arguments |
is_flat | Optional[bool] | None | — |
is_scalar | Optional[bool] | None | — |
is_real | Optional[bool] | None | — |
is_integer | Optional[bool] | None | — |
is_positive | Optional[bool] | None | — |
tags | Optional[Sequence[str]] | None | Extra Symbolica tags. The Spenso tensor tag is always included. |
aliases | Optional[Sequence[str]] | None | — |
normalization | Optional[Transformer | Callable[[Expression], Expression]] | None | Symbolica symbol callbacks and metadata. |
print | Optional[Any] | None | Symbolica symbol callbacks and metadata. |
derivative | Optional[Any] | None | Symbolica symbol callbacks and metadata. |
series | Optional[Any] | None | Symbolica symbol callbacks and metadata. |
eval | Optional[Any] | None | Symbolica symbol callbacks and metadata. |
data | Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal] | str | dict | list | bytes] | None | Symbolica symbol callbacks and metadata. |
Member details
vector
Static methodvector(name: str, *, is_symmetric: Optional[bool] = None, is_antisymmetric: Optional[bool] = None, is_cyclesymmetric: Optional[bool] = None, is_linear: Optional[bool] = None, is_flat: Optional[bool] = None, is_scalar: Optional[bool] = None, is_real: Optional[bool] = None, is_integer: Optional[bool] = None, is_positive: Optional[bool] = None, tags: Optional[Sequence[str]] = None, aliases: Optional[Sequence[str]] = None, normalization: Optional[Transformer | Callable[[Expression], Expression]] = None, print: Optional[Any] = None, derivative: Optional[Any] = None, series: Optional[Any] = None, eval: Optional[Any] = None, data: Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal] | str | dict | list | bytes] = None) -> TensorNameCreate a rank-one tensor name.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | — |
is_symmetric | Optional[bool] | None | — |
is_antisymmetric | Optional[bool] | None | — |
is_cyclesymmetric | Optional[bool] | None | — |
is_linear | Optional[bool] | None | — |
is_flat | Optional[bool] | None | — |
is_scalar | Optional[bool] | None | — |
is_real | Optional[bool] | None | — |
is_integer | Optional[bool] | None | — |
is_positive | Optional[bool] | None | — |
tags | Optional[Sequence[str]] | None | — |
aliases | Optional[Sequence[str]] | None | — |
normalization | Optional[Transformer | Callable[[Expression], Expression]] | None | — |
print | Optional[Any] | None | — |
derivative | Optional[Any] | None | — |
series | Optional[Any] | None | — |
eval | Optional[Any] | None | — |
data | Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal] | str | dict | list | bytes] | None | — |
__repr__
Method__str__
Methodto_expression
Methodto_expression() -> ExpressionConvert the tensor name to a symbolic expression.
Returns
Expression
A symbolic Expression representing this tensor name
Examples
T = TensorName("T")
expr = T.to_expression()has_tag
Methodhas_tag(tag: str) -> boolCheck whether this tensor name carries tag.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
tag | str | — | — |
get_tags
Methodg
Static methodflat
Static methodflat() -> TensorNamePredefined musical isomorphism tensor name. This enables dualizing self dual indices.
gamma
Static methodgamma() -> TensorNamePredefined gamma matrix name for introspection and pattern construction.
The matching typed factories use storage order: bispinor-in, bispinor-out, then Minkowski.
gamma5
Static methodprojm
Static methodprojp
Static methodsigma
Static methodf
Static methodt
Static method__call__
Method__call__(*args: Slot | Representation | Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]) -> TensorExpressionCall the tensor name with arguments to create a tensor expression.
Accepts scalar key expressions followed by any mix of slots and representations.
Returns
A structured expression with explicit and/or unresolved ports
Examples
from symbolica.community.spenso import TensorName, Slot, Representation
import symbolica as sp
T = TensorName("T")
rep = Representation.euc(3)
mu = rep("mu")
tensor = T(mu, rep)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
args | Slot | Representation | Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal] | — | — |
View generated signature source: docs/api/python/spynso3.pyi:1530