@@ -1709,7 +1709,18 @@ def mat_block(vecA, N, sz, IDX_upper, IDX_lower, idx_offdiag):
17091709 @staticmethod
17101710 def transform_block (A , k , Pk ):
17111711 """
1712- Permute and vectorize the two invariant blocks of a degree-k matrix.
1712+ Permute and pack the two components of degree-k matrices.
1713+
1714+ Each input matrix is transformed as Pk @ A @ Pk.T. The leading k-by-k
1715+ and trailing (k + 1)-by-(k + 1) diagonal blocks are then vectorized
1716+ column-wise. Entries in the two off-diagonal blocks are not retained.
1717+
1718+ :param A: Batch of degree-k matrices with shape (n_blocks, 2 * k + 1, 2 * k + 1).
1719+ :param k: Wigner representation degree.
1720+ :param Pk: Permutation matrix with shape (2 * k + 1, 2 * k + 1).
1721+
1722+ :return: Packed leading and trailing block arrays with shapes
1723+ (n_blocks, k**2) and (n_blocks, (k + 1)**2), respectively.
17131724 """
17141725 AT = Pk @ A @ Pk .T
17151726 A0 = AT [:, :k , :k ].swapaxes (- 1 , - 2 ).reshape (A .shape [0 ], - 1 )
@@ -1719,7 +1730,20 @@ def transform_block(A, k, Pk):
17191730 @staticmethod
17201731 def transform_back_block (A0 , A1 , k , Pk ):
17211732 """
1722- Reconstruct a degree-k matrix from its two invariant block vectors.
1733+ Reconstruct degree-k matrices from two packed components.
1734+
1735+ Each row of A0 and A1 is interpreted as a column-wise vectorization
1736+ of a k-by-k or (k + 1)-by-(k + 1) block. The two blocks are placed
1737+ on the diagonal of a (2 * k + 1)-by-(2 * k + 1) matrix, with zeros in the
1738+ off-diagonal blocks. The permutation represented by Pk is then reversed.
1739+
1740+ :param A0: Packed leading blocks with shape (n_blocks, k**2).
1741+ :param A1: Packed trailing blocks with shape (n_blocks, (k + 1)**2).
1742+ :param k: Wigner representation degree.
1743+ :param Pk: Permutation matrix with shape (2 * k + 1, 2 * k + 1).
1744+
1745+ :return: Reconstructed degree-k matrices with shape
1746+ (n_blocks, 2 * k + 1, 2 * k + 1).
17231747 """
17241748 dk = 2 * k + 1
17251749 A = xp .zeros ((A0 .shape [0 ], dk , dk ), dtype = A0 .dtype )
0 commit comments