Symmetrize¶
Projects an array onto a tensor symmetry, as a SymmetrizedArray that stores
only one canonical entry per orbit.
$ wo 'Symmetrize[{{1, 2}, {2, 3}}]'
SymmetrizedArray[StructuredArray`StructuredData[{2, 2}, {{{1, 1} -> 1, {1, 2} -> 2, {2, 2} -> 3}, Symmetric[{1, 2}]}]]
Normal expands it back to the dense array:
Under Antisymmetric a repeated index forces the entry to zero, so only the
strictly increasing positions are stored:
$ wo 'Symmetrize[{{a, b}, {c, d}}, Antisymmetric[{1, 2}]]'
SymmetrizedArray[StructuredArray`StructuredData[{2, 2}, {{{1, 2} -> (b - c)/2}, Antisymmetric[{1, 2}]}]]
Hermitian conjugates the entry an odd permutation reaches:
Without a symmetry the whole tensor is symmetrized, over any rank:
$ wo 'Symmetrize[Array[a, {2, 2, 2}]]'
SymmetrizedArray[StructuredArray`StructuredData[{2, 2, 2}, {{{1, 1, 1} -> a[1, 1, 1], {1, 1, 2} -> (a[1, 1, 2] + a[1, 2, 1] + a[2, 1, 1])/3, {1, 2, 2} -> (a[1, 2, 2] + a[2, 1, 2] + a[2, 2, 1])/3, {2, 2, 2} -> a[2, 2, 2]}, Symmetric[{1, 2, 3}]}]]
Dimensions and ArrayRules report on the array it stands for:
$ wo 'ArrayRules[Symmetrize[{{1, 2}, {3, 4}}, Antisymmetric[{1, 2}]]]'
{{1, 2} -> -1/2, {2, 1} -> 1/2, {_, _} -> 0}
Permuting two slots only makes sense when they have the same length: