BroadcastFunction
symbolica.community.tensor Class
BroadcastFunction(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[symbolica.core.Transformer | Callable[[symbolica.core.Expression], symbolica.core.Expression]] = None, print: Optional[Any] = None, derivative: Optional[Any] = None, series: Optional[Any] = None, eval: Optional[Any] = None, data: Optional[_ScalarInput | str | dict | list | bytes] = None) A unary function applied independently to each tensor component.
Calling it on a TensorExpression preserves the tensor interface. Calling it on Tensor or TensorNetwork creates a lazy network. Scalar inputs produce ordinary Symbolica Expressions. Register numerical behavior separately in a TensorFunctionLibrary.
Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import Tensor
tensor = Tensor.dense(A, [1.0, 2.0, 3.0, 4.0])
from symbolica.community.tensor import BroadcastFunction
conjugated = BroadcastFunction.conj()(tensor)
conjugated.shapeConstructor
#Register a Symbolica function for elementwise tensor application.
Returns
BroadcastFunction
Callable wrapper with tensor-aware result types.
Examples
from symbolica.community.tensor import BroadcastFunction, TensorExpression
function = BroadcastFunction("elementwise")
applied = function(TensorExpression(2))
applied.is_scalarParameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | Registered unary function name. It receives the broadcast tag and cannot also be a tensor head. |
is_symmetric | Optional[ | None | Symmetry of the function arguments under all permutations, signed permutations, or cyclic rotations. These affect scalar arguments as well as index arguments. Repeated arguments in an antisymmetric call make that call zero. |
is_antisymmetric | Optional[ | None | Symmetry of the function arguments under all permutations, signed permutations, or cyclic rotations. These affect scalar arguments as well as index arguments. Repeated arguments in an antisymmetric call make that call zero. |
is_cyclesymmetric | Optional[ | None | Symmetry of the function arguments under all permutations, signed permutations, or cyclic rotations. These affect scalar arguments as well as index arguments. Repeated arguments in an antisymmetric call make that call zero. |
is_linear | Optional[ | None | Distribute the function over sums in its arguments. |
is_flat | Optional[ | None | Flatten nested calls with the same head. |
is_scalar | Optional[ | None | Declare calls scalar for Symbolica's algebra. The broadcast acts on scalar component values. |
is_real | Optional[ | None | Assumptions used by Symbolica for the registered symbol. |
is_integer | Optional[ | None | Assumptions used by Symbolica for the registered symbol. |
is_positive | Optional[ | None | Assumptions used by Symbolica for the registered symbol. |
tags | Optional[ | None | Additional Symbolica tags; Spenso's required tags are included automatically. |
aliases | Optional[ | None | Additional names for the same Symbolica symbol. |
normalization | Optional[ | None | Normalize a newly constructed call. A callable receives an Expression and returns its normalized Expression; tensor interfaces must remain valid. |
print | Optional[ | None | Symbolica custom-print callback for the complete function call. Returning None selects standard printing. |
derivative | Optional[ | None | Symbolica callbacks for differentiation, series expansion, and numerical evaluation. Their arguments and results follow |
series | Optional[ | None | Symbolica callbacks for differentiation, series expansion, and numerical evaluation. Their arguments and results follow |
eval | Optional[ | None | Symbolica callbacks for differentiation, series expansion, and numerical evaluation. Their arguments and results follow |
data | Optional[ | None | Symbolica user data attached to the symbol, such as a dict, list, or bytes. |
Member details
conj
Static method#conj() -> BroadcastFunctionReturn the built-in elementwise complex-conjugation function.
Returns
BroadcastFunction
Registered conjugation, with a built-in numerical implementation.
Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import Tensor
tensor = Tensor.dense(A, [1.0, 2.0, 3.0, 4.0])
from symbolica.community.tensor import BroadcastFunction
BroadcastFunction.conj()(tensor).to_tensor()[0, 1]__repr__
Method#__repr__() -> strReturn a readable object description for inspection.
Examples
from symbolica.community import tensor as sp
conjugate = sp.BroadcastFunction.conj()
text = repr(conjugate)__str__
Method#__str__() -> strReturn a readable text representation.
Examples
from symbolica.community import tensor as sp
conjugate = sp.BroadcastFunction.conj()
text = str(conjugate)to_expression
Method#to_expression() -> ExpressionReturn this function name as a Symbolica symbol.
Returns
Expression
The bare function head, without arguments or tensor structure.
Examples
from symbolica.community.tensor import BroadcastFunction
name = BroadcastFunction("tagged_BroadcastFunction", tags=["example::example"])
head = name.to_expression()has_tag
Method#has_tag(tag: str) -> boolCheck whether the registered function carries a tag.
Returns
bool
Whether the tag is present.
Examples
from symbolica.community.tensor import BroadcastFunction
name = BroadcastFunction("tagged_BroadcastFunction", tags=["example::example"])
name.has_tag("example::example")Parameters
| Name | Type | Default | Description |
|---|---|---|---|
tag | str | — | Exact tag name. An unqualified name also matches its "python::" form. |
get_tags
Method#get_tags() -> list[str] List the tags attached to the registered function.
Returns
list of str
Fully qualified tags, including the tags required by Spenso.
Examples
from symbolica.community.tensor import BroadcastFunction
name = BroadcastFunction("tagged_BroadcastFunction", tags=["example::example"])
"example::example" in name.get_tags()__call__
Method#Overloads
Overload 1 #
__call__(arg: Tensor | TensorNetwork) -> TensorNetworkApply this unary function to a scalar or to every tensor component.
Returns
Expression, TensorExpression, or TensorNetwork
Scalar inputs return Expression; symbolic tensors retain TensorExpression; component-bearing inputs return TensorNetwork.
Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import Tensor
tensor = Tensor.dense(A, [1.0, 2.0, 3.0, 4.0])
from symbolica.community.tensor import BroadcastFunction
result = BroadcastFunction.conj()(tensor).to_tensor()
result.shapeParameters
| Name | Type | Default | Description |
|---|---|---|---|
arg | Tensor | TensorNetwork | — | Value to transform independently at each component. |
Overload 2 #
__call__(arg: TensorExpression) -> TensorExpressionApply this unary function to a scalar or to every tensor component.
Returns
Expression, TensorExpression, or TensorNetwork
Scalar inputs return Expression; symbolic tensors retain TensorExpression; component-bearing inputs return TensorNetwork.
Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import Tensor
tensor = Tensor.dense(A, [1.0, 2.0, 3.0, 4.0])
from symbolica.community.tensor import BroadcastFunction
result = BroadcastFunction.conj()(tensor).to_tensor()
result.shapeParameters
| Name | Type | Default | Description |
|---|---|---|---|
arg | TensorExpression | — | Value to transform independently at each component. |
Overload 3 #
__call__(arg: _ScalarInput) -> ExpressionApply this unary function to a scalar or to every tensor component.
Returns
Expression, TensorExpression, or TensorNetwork
Scalar inputs return Expression; symbolic tensors retain TensorExpression; component-bearing inputs return TensorNetwork.
Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import Tensor
tensor = Tensor.dense(A, [1.0, 2.0, 3.0, 4.0])
from symbolica.community.tensor import BroadcastFunction
result = BroadcastFunction.conj()(tensor).to_tensor()
result.shapeParameters
| Name | Type | Default | Description |
|---|---|---|---|
arg | _ScalarInput | — | Value to transform independently at each component. |
View generated signature source: docs/api/python/spynso3.pyi:45