multivariate_normal_distribution Derived Type

type, public, extends(multivariate_distribution) :: multivariate_normal_distribution

Defines a multivariate normal (Gaussian) distribution.


Contents


Type-Bound Procedures

procedure, public :: get_cholesky_factored_matrix => mvnd_get_cholesky

  • private pure function mvnd_get_cholesky(this) result(rst)

    Gets the lower triangular form of the Cholesky factorization of the covariance matrix of the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(multivariate_normal_distribution), intent(in) :: this

    The multivariate_normal_distribution object.

    Return Value real(kind=real64), allocatable, dimension(:,:)

    The Cholesky factored matrix.

procedure, public :: get_covariance => mvnd_get_covariance

  • private pure function mvnd_get_covariance(this) result(rst)

    Gets the covariance matrix of the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(multivariate_normal_distribution), intent(in) :: this

    The multivariate_normal_distribution object.

    Return Value real(kind=real64), allocatable, dimension(:,:)

    The covariance matrix.

procedure, public :: get_means => mvnd_get_means

  • private pure function mvnd_get_means(this) result(rst)

    Gets the mean values of the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(multivariate_normal_distribution), intent(in) :: this

    The multivariate_normal_distribution object.

    Return Value real(kind=real64), allocatable, dimension(:)

    The mean values.

procedure, public :: initialize => mvnd_init

  • private subroutine mvnd_init(this, mu, sigma, err)

    Initializes the multivariate normal distribution by defining the mean values and covariance matrix.

    Arguments

    Type IntentOptional Attributes Name
    class(multivariate_normal_distribution), intent(inout) :: this

    The multivariate_normal_distribution object.

    real(kind=real64), intent(in), dimension(:) :: mu

    An N-element array containing the mean values.

    real(kind=real64), intent(in), dimension(:,:) :: sigma

    The N-by-N covariance matrix. The PDF exists only if this matrix is positive-definite; therefore, the positive-definite constraint is checked within this routine and enforced. An error is thrown if the supplied matrix is not positive-definite.

    class(errors), intent(inout), optional, target :: err

    The error handling object.

procedure, public :: pdf => mvnd_pdf

  • private pure function mvnd_pdf(this, x) result(rst)

    Evaluates the PDF for the multivariate normal distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(multivariate_normal_distribution), intent(in) :: this

    The multivariate_normal_distribution object.

    real(kind=real64), intent(in), dimension(:) :: x

    The values at which to evaluate the function.

    Return Value real(kind=real64)

    The value of the function.

procedure, public :: set_means => mvnd_update_mean

  • private subroutine mvnd_update_mean(this, x, err)

    Updates the mean value array.

    Arguments

    Type IntentOptional Attributes Name
    class(multivariate_normal_distribution), intent(inout) :: this

    The multivariate_normal_distribution object.

    real(kind=real64), intent(in), dimension(:) :: x

    The N-element array of new mean values.

    class(errors), intent(inout), optional, target :: err

    The error handling object. This is referenced only in the event that the size of x is not compatible with the existing state.