pyPDAF.PDAF.generate_rndvec

pyPDAF.PDAF.generate_rndvec(len: int, vec: np.ndarray, stddev: float, dist: int, iseed: np.ndarray) Tuple[np.ndarray, np.ndarray]

Generate random perturbations with PDAF’s random-vector helper.

The values in vec are used as the base vector and are modified by the selected random perturbation. The returned vec and iseed arrays are Fortran-contiguous NumPy arrays containing the updated vector and seed state.

Parameters:
  • len (int) – Number of entries in vec to update.

  • vec (ndarray[np.float64, ndim=1]) – Input/output vector. The array shape is (len,).

  • stddev (float) – Scale of the random perturbation.

  • dist (int) – Distribution selector. 1 draws normal perturbations, 2 draws log-normal perturbations, 3 draws uniform values on [0, 1], 4 draws uniform values on [-1, 1], and 5 draws Laplace perturbations.

  • iseed (ndarray[np.intc, ndim=1]) – Four-integer seed vector. The fourth entry must be odd, following the LAPACK random-number seed convention used by PDAF.

Returns:

  • vec (ndarray[np.float64, ndim=1]) – Updated random vector.

  • iseed (ndarray[np.intc, ndim=1]) – Updated seed vector that can be reused for reproducible continuation.

See also

pyPDAF.PDAF.set_seedvec

Store a PDAF seed vector.

pyPDAF.PDAF.get_seedvec

Retrieve the current PDAF seed vector.