pub fn unfold_split(
t: &TensorDynLen,
left_inds: &[DynIndex],
) -> Result<(Tensor, usize, usize, usize, Vec<DynIndex>, Vec<DynIndex>)>Expand description
Unfold a tensor into a matrix by splitting indices into left and right groups.
This function validates the split, permutes the tensor so that left indices come first, and returns a rank-2 native tenferro tensor along with metadata.
§Arguments
t- Input tensorleft_inds- Indices to place on the left (row) side of the matrix
§Returns
A tuple (matrix_tensor, left_len, m, n, left_indices, right_indices) where:
matrix_tensoris a rank-2tenferro::Tensorwith shape[m, n]left_lenis the number of left indicesmis the product of left index dimensionsnis the product of right index dimensionsleft_indicesis the vector of left indices (cloned)right_indicesis the vector of right indices (cloned)
§Errors
Returns an error if:
- The tensor rank is < 2
left_indsis empty or contains all indicesleft_indscontains indices not in the tensor or duplicates- Native reshape fails