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
vecare used as the base vector and are modified by the selected random perturbation. The returnedvecandiseedarrays are Fortran-contiguous NumPy arrays containing the updated vector and seed state.- Parameters:
len (int) – Number of entries in
vecto 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.
1draws normal perturbations,2draws log-normal perturbations,3draws uniform values on[0, 1],4draws uniform values on[-1, 1], and5draws 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_seedvecStore a PDAF seed vector.
pyPDAF.PDAF.get_seedvecRetrieve the current PDAF seed vector.