spyrit.core.torch.mult_1d

spyrit.core.torch.mult_1d(H: tensor, x: tensor, dim: int = -1) tensor[source]

Multiply a matrix to batches of (1D) vectors.

This computes matrix-vector products to a batch of vectors \(x\).

Args:

H (torch.tensor): Matrix with shape \((a,b)\). The matrix \(H\) multiplies to one of the dimensions of the batch of vectors.

x (torch.tensor): Batch of vectors. The dim-th dimension of the tensor must have length \(b\).

dim (int, optional): The dimension along which multiplication applies. Default is -1.

Returns:

torch.tensor: Transformed tensor. Has the same shape as the input tensor except for the dim-th dimension which has \(a\) elements.