spd_learn.functional.bimap_increase_dim#
- spd_learn.functional.bimap_increase_dim(X: Tensor, projection_matrix: Tensor, padding_matrix: Tensor) Tensor[source]#
Increase the dimension of SPD matrices via embedding.
Computes the dimension expansion:
\[Y = P + W X W^\top\]where \(X\) is the input SPD matrix, \(W\) is a semi-orthogonal projection matrix, and \(P\) is an identity padding matrix that ensures the output is SPD.
- Parameters:
X (Tensor) – Input SPD matrices with shape (…, n_in, n_in).
projection_matrix (Tensor) – Semi-orthogonal projection matrix with shape (n_out, n_in).
padding_matrix (Tensor) – Identity padding matrix with shape (n_out, n_out). Should be a diagonal matrix with ones for indices >= n_in.
- Returns:
Expanded SPD matrices with shape (…, n_out, n_out).
- Return type:
Tensor
Notes
The padding matrix ensures that the output remains SPD by adding identity elements in the expanded dimensions.
See also
bimap_transform()For dimension reduction.
BiMapIncreaseDimModule wrapper for this function.
Examples
>>> import torch >>> from spd_learn.functional import bimap_increase_dim >>> X = torch.eye(4) # 4x4 identity >>> proj = torch.eye(8, 4) # Projection from 4 to 8 >>> pad = torch.diag(torch.tensor([0,0,0,0,1,1,1,1], dtype=torch.float)) >>> Y = bimap_increase_dim(X, proj, pad) >>> Y.shape torch.Size([8, 8])