ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
Go to the source code of this file.
Functions | |
function | getRand (in ndim, in scale) |
Generate and return a random positive-definite (correlation or covariance) matrix using the Gram method. More... | |
function getRand | ( | in | ndim, |
in | scale | ||
) |
Generate and return a random positive-definite (correlation or covariance) matrix using the Gram method.
The Gram method of generating random positive-definite square matrices is based on the observation that every real positive definite matrix \(M\) has a Cholesky factorization
\begin{equation} M = LL* \end{equation}
where \(L\) is a uniquely defined lower triangular matrix with positive diagonal entries.
Therefore, \(M\) can be constructed from a given random \(L\).
The Gram method is fast, however, the resulting matrix \(M\) does not possess any particular structure.
because it uses the Cholesky factorization of the distribution covariance matrix.
[in] | ndim | : The input positive scalar MATLAB whole number(integer ), representing the rank of the matrix (the number of dimensions) of shape (ndim, ndim) .(optional. It must be present if and only if the input scale argument is missing or is a scalar.) |
[in] | scale | : The input scalar or contiguous vector of size ndim of type real , representing the scale of the matrix (e.g., the standard deviation of a covariance matrix) along each dimension.(optional. default = 1 . It can be present if and only if it is a scalar or is a vector of size ndim .) |
rand
: The output matrix of shape (1:ndim, 1:ndim)
of type MATLAB double
, containing a random positive-definite matrix.rand
is a correlation matrix.
Possible calling interfaces ⛓
all([0 < scale])
must hold for the corresponding input arguments.
Example usage ⛓
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.