symmray.interface¶
Functional interface for symmray array objects.
Functions¶
|
Conjugate a symmray array. |
|
Form |
|
Return the maximum value of a symmray array. |
|
Return the minimum value of a symmray array. |
|
Return the sum of a symmray array. |
|
Check if all elements of a symmray array are true. |
|
Check if any elements of a symmray array are true. |
|
Check if a symmray array contains only finite values. |
|
Return machine limits for a common floating-point dtype. |
|
Return the absolute value of a symmray array. |
|
Return the square root of a symmray array. |
|
Return the natural logarithm of a symmray array. |
|
Return the base-2 logarithm of a symmray array. |
|
Return the base-10 logarithm of a symmray array. |
|
Return the real part of a symmray array. |
|
Return the imaginary part of a symmray array. |
|
Clip the values of a symmray array. |
|
Remove single-dimensional entries from shape of a symmray array. |
|
Expand the shape of a symmray array. |
|
Reshape a symmray array, via fusing or unfusing. |
|
Contract two symmray arrays along the specified axes. |
Try to convert the two term einsum eq into tensordot axes and a |
|
Check whether the two term einsum eq is a diagonal multiplication |
|
|
Contract arrays with an einsum equation that names its output. |
|
Transpose a symmray array. |
|
Return the trace of a symmray array. |
|
Take elements from a symmray array along an axis. |
|
Multiply a symmray array by a vector as if contracting a diagonal |
|
Left multiply a symmray matrix x by a vector v. |
|
Right multiply a symmray matrix x by a vector v. |
|
Left divide a symmray matrix x by a vector v. |
|
Right divide a symmray matrix x by a vector v. |
|
Align the axes of two symmray arrays (drop mis-matched charges) |
|
Fuse multiple axes of a symmray array. |
Module Contents¶
- symmray.interface.gram(x, axes=-1)[source]¶
Form
dag(x) @ x, leavingaxesopen in both copies.See
gram()for the fermionic sign convention.
- symmray.interface.squeeze(x, axis=None)[source]¶
Remove single-dimensional entries from shape of a symmray array.
- symmray.interface.reshape(a, newshape, **kwargs)[source]¶
Reshape a symmray array, via fusing or unfusing.
- symmray.interface.tensordot(a, b, axes=2, **kwargs)[source]¶
Contract two symmray arrays along the specified axes.
- Parameters:
a (AbelianArray or FermionicArray) – First array to contract.
b (AbelianArray or FermionicArray) – Second array to contract, with same type as a.
axes (int or tuple of int, optional) – If an integer, the number of axes to contract. If a tuple, the axes to contract. Default is 2.
- symmray.interface._parse_tensordot_eq(eq)[source]¶
Try to convert the two term einsum eq into tensordot axes and a final output permutation.
Returns None if not possible, i.e. if the eq features batched, summed, or repeated indices, else a tuple (axes_a, axes_b, perm), where perm is a final permutation of the tensordot output axes, or None if not needed.
- symmray.interface._parse_multiply_diagonal_eq(eq)[source]¶
Check whether the two term einsum eq is a diagonal multiplication pattern, e.g. “i,ijkl->ijkl”, suitable for multiply_diagonal.
Returns None if it is not, else a tuple (which, axis, perm), where which is “left”, “right”, or “both” depending on which term(s) are vector-like, axis is the axis of the array term that the vector multiplies into, and perm is a final permutation of the array term axes, or None if not needed.
- symmray.interface.einsum(*args, **kwargs)[source]¶
Contract arrays with an einsum equation that names its output.
With one array, permute axes (
"abc->cab") or trace pairs ("abcb->ca","abab->"). Each output label must occur once. Each trace label must occur twice on indices with matching sizes and opposite dualness. A complete trace returns a scalar. Setpreserve_array=Trueto return an array with no axes. Fermionic arrays include the signs from permuting and tracing axes.Flat partial traces need a complete set of sector blocks and every charge on each input axis. Diagonal extraction, single-axis sums, and ellipses are unsupported.
With two arrays, pairwise contractions and outer products use
tensordot. The result is reordered if the equation asks for it. A symmray vector can multiply along a shared axis, e.g."i,ijkl->ijkl". Cotengra handles more than two arrays.
- symmray.interface.take(a, indices, axis, **kwargs)[source]¶
Take elements from a symmray array along an axis.
- symmray.interface.multiply_diagonal(x, v, axis)[source]¶
Multiply a symmray array by a vector as if contracting a diagonal matrix into one axis.