bundles / scipy 1.17.1 / scipy / linalg / _sketches / cwt_matrix
function
scipy.linalg._sketches:cwt_matrix
source: /scipy/linalg/_sketches.py :14
Signature
def cwt_matrix ( n_rows , n_columns , rng = None ) Summary
Generate a matrix S which represents a Clarkson-Woodruff transform.
Extended Summary
Given the desired size of matrix, the method returns a matrix S of size (n_rows, n_columns) where each column has all the entries set to 0 except for one position which has been randomly set to +1 or -1 with equal probability.
Parameters
n_rows: intNumber of rows of S
n_columns: intNumber of columns of S
rng: `numpy.random.Generator`, optionalPseudorandom number generator state. When
rngis None, a new numpy.random.Generator is created using entropy from the operating system. Types other than numpy.random.Generator are passed to numpy.random.default_rng to instantiate aGenerator.
Returns
S: (n_rows, n_columns) csc_matrixThe returned matrix has
n_columnsnonzero entries.
Notes
Given a matrix A, with probability at least 9/10, .. math: \|A\| = (1 pm epsilon)|\| Where the error epsilon is related to the size of S.
Aliases
-
scipy.linalg._sketches.cwt_matrix