permute¶
Return tensor with permuted axes.
permute
¶
Return a new tensor with permuted axes according to the provided order.
This functional version creates a fully independent tensor by cloning all data blocks. For an efficient version that shares underlying tensors, use tensor.permute(order, in_place=False).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
The input tensor to permute. |
required |
order
|
Sequence[int]
|
Sequence of integer axes specifying the new ordering. Must be a permutation of range(len(tensor.indices)). |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
A new tensor instance with reordered indices and cloned permuted blocks. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If order is not a valid permutation. |
Notes
For non-Abelian (SU2) tensors, permutation involves R-symbols that transform the outer multiplicity (OM) indices. The weights are updated by matrix multiplication with the R-symbol: new_weights = old_weights @ R.
Examples:
Description¶
Returns a fully independent tensor with axes reordered according to the specified permutation. All data blocks are deep-copied, so the result is completely isolated from the original. For a memory-efficient version that shares storage with the original, use Tensor.permute() (default in_place=False). To modify the tensor in place, use Tensor.permute(order, in_place=True).
See Also¶
- Tensor.permute: Method form (shared-storage default, or in-place)
- transpose: Reverse axis order
- Examples: Manipulation
Notes¶
The order parameter must be a valid permutation of range(len(tensor.indices)). Each block is transposed accordingly.