tensor
permute_indices
Permutation of the indices of a tensor_type
Calling Sequence
Parameters
Description
Examples
permute_indices(T, permutation)
T
-
tensor_type on which to perform permutation
permutation
permutation according to which the re-indexing of the indices is to be done
Important: The tensor package has been deprecated. Use the superseding command DifferentialGeometry[Tensor][RearrangeIndices].
This procedure allows you to change the way a given tensor_type is indexed. Given any permutation of the indices of a tensor_type and a tensor, the routine will re-index the tensor according to the given permutation.
T must be of rank 2 or more.
permutation is a list of indices (integers ranging from 1 to rank(T)) with no duplications and size equal to the rank of T. It is used to specify the re-indexing of the tensor in the following way: The `nth' index of the original tensor is moved to the position of `n' in the permutation. For example, a permutation list of 3,1,2 specifies that the third index of the original tensor will be the first index of the re-indexed tensor, the first index of the original tensor will be the second index of the re-indexed tensor, and the second index of the original tensor will be the third index of the re-indexed tensor (that is, i,j,k --> k,i,j).
This function is occasionally useful because of the rigidity in default indexing of the other utility routines, like prod, contract, and cov_diff, of the tensor package. Since you can have a preferred indexing different from the default, and switching back and forth between the two conventions could be confusing during a substantial computation, it is advised that you perform a re-ordering of indices of any computed tensor_type to comply with your indexing convention, whenever the default indexing is different from the one with which you are comfortable.
Note that any symmetrical properties of the indices of the input are not preserved in the re-indexed indices of the result.
This function is part of the tensor package, and so can be used in the form permute_indices(..) only after performing the command with(tensor) or with(tensor, permute_indices). The function can always be accessed in the long form tensor[permute_indices](..).
with⁡tensor:
Find the transpose of a rank 2 tensor.
A_compts≔array⁡1..3,1..3:
forito3doforjto3doA_comptsi,j≔cat⁡a,i,jenddoenddo:A≔create⁡1,−1,op⁡A_compts
A≔table⁡index_char=1,−1,compts=a11a12a13a21a22a23a31a32a33
A_transpose≔permute_indices⁡A,2,1
A_transpose≔table⁡index_char=−1,1,compts=a11a21a31a12a22a32a13a23a33
Perform a cyclic permutation on a rank 3 tensor.
B_compts≔array⁡1..3,1..3,1..3:
forito3doforjto3doforkto3doB_comptsi,j,k≔cat⁡b,i,j,kenddoenddoenddo:B≔create⁡1,−1,1,op⁡B_compts
B≔table⁡index_char=1,−1,1,compts=array⁡1..3,1..3,1..3,1,1,1=b111,1,1,2=b112,1,1,3=b113,1,2,1=b121,1,2,2=b122,1,2,3=b123,1,3,1=b131,1,3,2=b132,1,3,3=b133,2,1,1=b211,2,1,2=b212,2,1,3=b213,2,2,1=b221,2,2,2=b222,2,2,3=b223,2,3,1=b231,2,3,2=b232,2,3,3=b233,3,1,1=b311,3,1,2=b312,3,1,3=b313,3,2,1=b321,3,2,2=b322,3,2,3=b323,3,3,1=b331,3,3,2=b332,3,3,3=b333
C≔permute_indices⁡B,3,1,2
C≔table⁡index_char=1,1,−1,compts=array⁡1..3,1..3,1..3,1,1,1=b111,1,1,2=b121,1,1,3=b131,1,2,1=b211,1,2,2=b221,1,2,3=b231,1,3,1=b311,1,3,2=b321,1,3,3=b331,2,1,1=b112,2,1,2=b122,2,1,3=b132,2,2,1=b212,2,2,2=b222,2,2,3=b232,2,3,1=b312,2,3,2=b322,2,3,3=b332,3,1,1=b113,3,1,2=b123,3,1,3=b133,3,2,1=b213,3,2,2=b223,3,2,3=b233,3,3,1=b313,3,3,2=b323,3,3,3=b333
See Also
DifferentialGeometry[Tensor][RearrangeIndices]
tensor(deprecated)
tensor(deprecated)/cov_diff
tensor(deprecated)[contract]
tensor(deprecated)[prod]
Download Help Document