matrix_ops.perturb_vectors¶
Perturb vectors is used to add a small random number to each element of a vector.
A random value is added sampled from a normal distribution scaled by eps.
Functions¶
|
Perturb the vectors by adding a small random number to each element. |
Module Contents¶
- matrix_ops.perturb_vectors.perturb_vectors(vectors, eps=0.1)¶
Perturb the vectors by adding a small random number to each element.
- Parameters:
vectors (list[numpy.ndarray]) – List of vectors to perturb.
eps (float) – Amount by which to perturb vectors.
- Returns:
Resulting list of perturbed vectors by a factor of epsilon.
- Return type:
list[numpy.ndarray]
Example:¶
>>> from toqito.matrix_ops import perturb_vectors >>> import numpy as np >>> vectors = [np.array([1.0, 2.0]), np.array([3.0, 4.0])] >>> perturb_vectors(vectors, eps=0.1) array([[0.47687587, 0.87897065], [0.58715549, 0.80947417]])