find_basis

find_basis(mat, nonzero_cutoff=1e-08, method='svd'): 

LLM Docstring

Find an orthonormal basis for the column space (range) of a matrix.

Supports several methods: 'qr' returns the Q factor, 'svd' returns the left singular vectors with singular values above nonzero_cutoff, and 'right-svd' / 'right-unitary' build right-projected bases. Batched inputs are handled per matrix; when the retained rank varies across the batch a list of per-matrix bases is returned rather than a single stacked array.

  • mat: np.ndarray

    the matrix (or stack of matrices)

  • nonzero_cutoff: float

    singular-value cutoff for retained directions

  • method: str

    'svd', 'qr', 'right-svd', or 'right-unitary'

  • :returns: np.ndarray | list[np.ndarray]

    the basis (or a list of bases for ragged batches)


Feedback

Examples

Templates

Documentation