{ } Raw JSON

bundles / scipy latest / 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 : int

Number of rows of S

n_columns : int

Number of columns of S

rng : `numpy.random.Generator`, optional

Pseudorandom number generator state. When rng is 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 a Generator.

Returns

S : (n_rows, n_columns) csc_matrix

The returned matrix has n_columns nonzero 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