e3j.core.Bigotimes¶
- class e3j.core.Bigotimes(source: list[O3Space | str], target: O3Space | str, coef: Array | None = None, l_max: int | None = None, sort: bool = True, config: Config | None = None)¶
Multilinear tensor products.
Compute and stack generalized CG coefficients, or use given ones.
Methods
__call__(*xs)Evaluate N-linear product on N inputs.
clebsch_gordan(target, *sources[, l_max])Compute generalized CG coefficients by successive compositions.
infer_target(source[, target, l_max, sort])Infer output representation without computing CG coefficients.
pullback(prod[, position])Flatten a composition of tensor products.
sort()Sort irreducible output blocks.
Attributes
indicesNumber of non-zero coefficients.
Density of the coefficient tensor, i.e.
nnzover its size.shapevalues- __call__(*xs: Array) Array¶
Evaluate N-linear product on N inputs.
By default, this method uses a dense-dense matrix multiplication for the aggregation. The aggregation method can be changed for a sparse on by setting the environment variable E3J_AGGREGATION_METHOD to “scatter”.
- classmethod clebsch_gordan(target: O3Space | str, *sources: Iterable[str], l_max: int | None = None) Bigotimes¶
Compute generalized CG coefficients by successive compositions.
Returns an (N+1)-dimensional array whose dimensions appear in the same order as the arguments.
N.B. This factory is called by
__init__whencoef = None.
- coef¶
- classmethod infer_target(source: tuple[str, ...], target: str | None = None, l_max: int | None = None, sort: bool = True) O3Space¶
Infer output representation without computing CG coefficients.
This method is useful e.g. for the
e3j.linen.Bigotimesflax wrapper.
- property nnz: int¶
Number of non-zero coefficients.
- property nnz_ratio: float¶
Density of the coefficient tensor, i.e.
nnzover its size.
- pullback(prod: Bigotimes, position: int = 0) Bigotimes¶
Flatten a composition of tensor products.
By associativity of the binary tensor product, any succession of multilinear tensor products can be flattened down to a single operation.:
x0 ... xk ` | / `|/ y0 ... yn <=> x0 ... xk y1 ... yn ` | / ` | | / ` | / `___`_/___/ `|/ | z zComposing tensor products requires to repeat and multiply coefficients of the two l.h.s. trees, as any coefficient downstream is pulled-back by all the upstream coefficients matching its
y0coordinate.- Parameters:
prod (
Bigotimes) – an upstream tensor product.position (
int) – the position whereprod’s output is fed in as argument.
- Returns:
composed – the m-ary tensor product obtained by applying
prodatposition, where:m = self.arity + prod.arity - 1
- Return type:
Bigotimes