tensap.linear_algebra package¶
Submodules¶
tensap.linear_algebra.magic_indices module¶
Module magic_indices.
-
tensap.linear_algebra.magic_indices.
magic_indices
(F, n=None, option='left_right')¶ Return the set of n magic indices (i_1, j_1), …, (i_n, j_n) constructed by a greedy algorithm.
- If option is ‘left_right’ (default value):
[ik,jk] = arg max_{i,j} | F_ij - I_{k-1}(F)_ij | where I_{k-1}(F) is the rank-(k-1) matrix which interpolates F on the cross corresponding to rows (i_1, …, i_{k-1}) and columns (j_1,…, j_{k-1}).
- If option is ‘left’:
jk is equal to k and \(ik = arg max_{i} max_{1 <= j <= M} | F_ij - I_[k-1](F)_ij |\).
- If option is ‘right’:
ik is equal to k and \(jk = arg max_{j} max_{1 <= i <= N} | F_ij - I[k-1](F)_ij |\)
- Parameters
- Flist or numpy.ndarray
Input matrix.
- nint, optional
Number of magic indices. The default is None, indicating to choose n = np.min(F.shape).
- optionstr, optional
The selected option. The default is ‘left_right’.
- Returns
- I, Jnumpy.ndarray
The magic indices.
- Raises
- ValueError
If the selected option is incorrect.