PortPattern
symbolica.community.tensor Class
PortPattern()A Symbolica pattern for a tensor index or its representation.
Use an exact representation or a wildcard constrained by representation tags. Omitting the index produces representation-only syntax for compact vectors and traces. These are Expression objects for matching, not actual tensor axes with an inferred dimension.
Examples
from symbolica import S
from symbolica.community.tensor import TensorPattern, PortPattern, Representation, TensorName
D_, i_, j_, mu_, nu_, a_, b_, c_ = S("D_", "i_", "j_", "mu_", "nu_", "a_", "b_", "c_")
port = PortPattern.self_dual("SelfDual_", D_, i_)Member details
chain_in
Static method#chain_in() -> PortPatternRefer to a factor's input endpoint inside a chain or trace pattern.
Returns
PortPattern
Contextual endpoint marker, interpreted relative to the surrounding factor sequence rather than as an explicit index label.
Notes
Exchange chain_in() and chain_out() in a factor pattern to match its transposed orientation.
Examples
from symbolica import S
from symbolica.community.tensor import TensorPattern, PortPattern, Representation, TensorName
D_, i_, j_, mu_, nu_, a_, b_, c_ = S("D_", "i_", "j_", "mu_", "nu_", "a_", "b_", "c_")
gamma = TensorPattern.dirac_gamma(D_, PortPattern.chain_in(), PortPattern.chain_out(), mu_)chain_out
Static method#chain_out() -> PortPatternRefer to a factor's output endpoint inside a chain or trace pattern.
Returns
PortPattern
Contextual endpoint marker, interpreted relative to the surrounding factor sequence rather than as an explicit index label.
Notes
Exchange chain_in() and chain_out() in a factor pattern to match its transposed orientation.
Examples
from symbolica import S
from symbolica.community.tensor import TensorPattern, PortPattern, Representation, TensorName
D_, i_, j_, mu_, nu_, a_, b_, c_ = S("D_", "i_", "j_", "mu_", "nu_", "a_", "b_", "c_")
gamma = TensorPattern.dirac_gamma(D_, PortPattern.chain_in(), PortPattern.chain_out(), mu_)exact
Static method#exact(rep: Representation, index: Optional[_ScalarInput] = None) -> PortPattern Match one specific representation and optionally an index.
Returns
PortPattern
Symbolica expression for a typed port or a stripped representation.
Examples
from symbolica import S
from symbolica.community.tensor import TensorPattern, PortPattern, Representation, TensorName
D_, i_, j_, mu_, nu_, a_, b_, c_ = S("D_", "i_", "j_", "mu_", "nu_", "a_", "b_", "c_")
port = PortPattern.exact(Representation.euc(3), i_)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
rep | Representation | — | Representation, including its dimension and duality. Its dimension may be a wildcard symbol. |
index | Optional[ | None | Exact index or wildcard. Omit it to match representation-only syntax. |
any
Static method#any(name: str, dimension: _ScalarInput, index: Optional[_ScalarInput] = None) -> PortPattern Match any registered representation head.
Returns
PortPattern
Tagged Symbolica pattern, without constructing a concrete index space.
Examples
from symbolica import S
from symbolica.community.tensor import TensorPattern, PortPattern, Representation, TensorName
D_, i_, j_, mu_, nu_, a_, b_, c_ = S("D_", "i_", "j_", "mu_", "nu_", "a_", "b_", "c_")
port = PortPattern.any("R_", D_, i_)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | Wildcard name ending in exactly one underscore. Reuse this name to constrain multiple occurrences to the same representation. |
dimension | _ScalarInput | — | Dimension value or wildcard. |
index | Optional[ | None | Index value or wildcard. Omit for representation-only syntax. |
self_dual
Static method#self_dual(name: str, dimension: _ScalarInput, index: Optional[_ScalarInput] = None) -> PortPattern Match a self-dual representation head.
Returns
PortPattern
Tagged Symbolica pattern, without constructing a concrete index space.
Examples
from symbolica import S
from symbolica.community.tensor import TensorPattern, PortPattern, Representation, TensorName
D_, i_, j_, mu_, nu_, a_, b_, c_ = S("D_", "i_", "j_", "mu_", "nu_", "a_", "b_", "c_")
port = PortPattern.self_dual("SelfDual_", D_, i_)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | Wildcard name ending in exactly one underscore. Reuse this name to constrain multiple occurrences to the same representation. |
dimension | _ScalarInput | — | Dimension value or wildcard. |
index | Optional[ | None | Index value or wildcard. Omit for representation-only syntax. |
dualizable
Static method#dualizable(name: str, dimension: _ScalarInput, index: Optional[_ScalarInput] = None, *, dual: bool = False) -> PortPattern Match a dualizable representation head.
Returns
PortPattern
Tagged Symbolica pattern, without constructing a concrete index space.
Examples
from symbolica import S
from symbolica.community.tensor import TensorPattern, PortPattern, Representation, TensorName
D_, i_, j_, mu_, nu_, a_, b_, c_ = S("D_", "i_", "j_", "mu_", "nu_", "a_", "b_", "c_")
port = PortPattern.dualizable("Dual_", D_, i_)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | Wildcard name ending in exactly one underscore. Reuse this name to constrain multiple occurrences to the same representation. |
dimension | _ScalarInput | — | Dimension value or wildcard. |
index | Optional[ | None | Index value or wildcard. Omit for representation-only syntax. |
dual | bool | False | Match the dual partner rather than the base orientation. |
View generated signature source: docs/api/python/spynso3.pyi:1261