.. index:: single: multivariate_distributions_protocol
.. _multivariate_distributions_protocol/0:

.. rst-class:: right

**protocol**

``multivariate_distributions_protocol``
=======================================

Multivariate probability distribution predicates.

| **Availability:** 
|    ``logtalk_load(multivariate_distributions(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-08-12

| **Compilation flags:**
|    ``static``


| **Dependencies:**
|   (none)


| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: multivariate_normal/3
.. _multivariate_distributions_protocol/0::multivariate_normal/3:

``multivariate_normal/3``
^^^^^^^^^^^^^^^^^^^^^^^^^

Returns a multivariate normally distributed random vector using the default numerical tolerance of 1.0e-12. Singular positive-semidefinite covariance matrices are supported.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal(Mean,Covariance,Sample)``
| **Mode and number of proofs:**
|    ``multivariate_normal(+list(number),+list(list(number)),-list(float))`` - ``one_or_error``

| **Exceptions:**
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``


------------

.. index:: multivariate_normal/4
.. _multivariate_distributions_protocol/0::multivariate_normal/4:

``multivariate_normal/4``
^^^^^^^^^^^^^^^^^^^^^^^^^

Returns a multivariate normally distributed random vector using the given non-negative numerical tolerance. Singular positive-semidefinite covariance matrices are supported.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal(Mean,Covariance,Tolerance,Sample)``
| **Mode and number of proofs:**
|    ``multivariate_normal(+list(number),+list(list(number)),+number,-list(float))`` - ``one_or_error``

| **Exceptions:**
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Tolerance`` is negative:
|        ``domain_error(non_negative_number,Tolerance)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: multivariate_normal_samples/4
.. _multivariate_distributions_protocol/0::multivariate_normal_samples/4:

``multivariate_normal_samples/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of multivariate normally distributed random row vectors using the default numerical tolerance of 1.0e-12.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal_samples(Count,Mean,Covariance,Samples)``
| **Mode and number of proofs:**
|    ``multivariate_normal_samples(+integer,+list(number),+list(list(number)),-list(list(float)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``


------------

.. index:: multivariate_normal_samples/5
.. _multivariate_distributions_protocol/0::multivariate_normal_samples/5:

``multivariate_normal_samples/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of multivariate normally distributed random row vectors using the given non-negative numerical tolerance.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal_samples(Count,Mean,Covariance,Tolerance,Samples)``
| **Mode and number of proofs:**
|    ``multivariate_normal_samples(+integer,+list(number),+list(list(number)),+number,-list(list(float)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: multivariate_normal_density/4
.. _multivariate_distributions_protocol/0::multivariate_normal_density/4:

``multivariate_normal_density/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate normal density at a point using the default numerical tolerance of 1.0e-12. For a singular covariance matrix, computes the density on its affine support and returns zero outside it.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal_density(Point,Mean,Covariance,Density)``
| **Mode and number of proofs:**
|    ``multivariate_normal_density(+list(number),+list(number),+list(list(number)),-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the mean dimension:
|        ``domain_error(point_dimensions(A),Point)``


------------

.. index:: multivariate_normal_density/5
.. _multivariate_distributions_protocol/0::multivariate_normal_density/5:

``multivariate_normal_density/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate normal density at a point using the given non-negative numerical tolerance. For a singular covariance matrix, computes the density on its affine support and returns zero outside it.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal_density(Point,Mean,Covariance,Tolerance,Density)``
| **Mode and number of proofs:**
|    ``multivariate_normal_density(+list(number),+list(number),+list(list(number)),+number,-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the mean dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: multivariate_normal_log_density/4
.. _multivariate_distributions_protocol/0::multivariate_normal_log_density/4:

``multivariate_normal_log_density/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate normal log-density at a point using the default numerical tolerance of 1.0e-12. Returns the atom ``negative_infinity`` outside the affine support of a singular covariance matrix.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal_log_density(Point,Mean,Covariance,LogDensity)``
| **Mode and number of proofs:**
|    ``multivariate_normal_log_density(+list(number),+list(number),+list(list(number)),-atomic)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the mean dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``


------------

.. index:: multivariate_normal_log_density/5
.. _multivariate_distributions_protocol/0::multivariate_normal_log_density/5:

``multivariate_normal_log_density/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate normal log-density at a point using the given non-negative numerical tolerance. Returns the atom ``negative_infinity`` outside the affine support of a singular covariance matrix.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_normal_log_density(Point,Mean,Covariance,Tolerance,LogDensity)``
| **Mode and number of proofs:**
|    ``multivariate_normal_log_density(+list(number),+list(number),+list(list(number)),+number,-atomic)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the mean dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``Tolerance`` is negative:
|        ``domain_error(non_negative_number,Tolerance)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: squared_mahalanobis_distance/4
.. _multivariate_distributions_protocol/0::squared_mahalanobis_distance/4:

``squared_mahalanobis_distance/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the squared Mahalanobis distance using the default numerical tolerance of 1.0e-12.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``squared_mahalanobis_distance(Point,Mean,Covariance,SquaredDistance)``
| **Mode and number of proofs:**
|    ``squared_mahalanobis_distance(+list(number),+list(number),+list(list(number)),-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` is outside the affine support of ``Covariance``:
|        ``domain_error(covariance_support,Point)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``


------------

.. index:: squared_mahalanobis_distance/5
.. _multivariate_distributions_protocol/0::squared_mahalanobis_distance/5:

``squared_mahalanobis_distance/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the squared Mahalanobis distance using the given non-negative numerical tolerance.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``squared_mahalanobis_distance(Point,Mean,Covariance,Tolerance,SquaredDistance)``
| **Mode and number of proofs:**
|    ``squared_mahalanobis_distance(+list(number),+list(number),+list(list(number)),+number,-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` is outside the affine support of ``Covariance``:
|        ``domain_error(covariance_support,Point)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: mahalanobis_distance/4
.. _multivariate_distributions_protocol/0::mahalanobis_distance/4:

``mahalanobis_distance/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the Mahalanobis distance using the default numerical tolerance of 1.0e-12.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``mahalanobis_distance(Point,Mean,Covariance,Distance)``
| **Mode and number of proofs:**
|    ``mahalanobis_distance(+list(number),+list(number),+list(list(number)),-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` is outside the affine support of ``Covariance``:
|        ``domain_error(covariance_support,Point)``
|    ``Point`` dimensions do not match the mean dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``


------------

.. index:: mahalanobis_distance/5
.. _multivariate_distributions_protocol/0::mahalanobis_distance/5:

``mahalanobis_distance/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the Mahalanobis distance using the given non-negative numerical tolerance.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``mahalanobis_distance(Point,Mean,Covariance,Tolerance,Distance)``
| **Mode and number of proofs:**
|    ``mahalanobis_distance(+list(number),+list(number),+list(list(number)),+number,-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` is outside the affine support of ``Covariance``:
|        ``domain_error(covariance_support,Point)``
|    ``Point`` dimensions do not match the mean dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: multivariate_t/4
.. _multivariate_distributions_protocol/0::multivariate_t/4:

``multivariate_t/4``
^^^^^^^^^^^^^^^^^^^^

Returns a multivariate Student's t distributed random vector using the default numerical tolerance of 1.0e-12.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t(DegreesOfFreedom,Location,Scale,Sample)``
| **Mode and number of proofs:**
|    ``multivariate_t(+positive_number,+list(number),+list(list(number)),-list(float))`` - ``one_or_error``

| **Exceptions:**
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor an integer:
|        ``type_error(integer,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is not a positive integer:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``


------------

.. index:: multivariate_t/5
.. _multivariate_distributions_protocol/0::multivariate_t/5:

``multivariate_t/5``
^^^^^^^^^^^^^^^^^^^^

Returns a multivariate Student's t distributed random vector using the given non-negative numerical tolerance.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t(DegreesOfFreedom,Location,Scale,Tolerance,Sample)``
| **Mode and number of proofs:**
|    ``multivariate_t(+positive_number,+list(number),+list(list(number)),+number,-list(float))`` - ``one_or_error``

| **Exceptions:**
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor a number:
|        ``type_error(number,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is a number but not a positive number:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Tolerance`` is negative:
|        ``domain_error(non_negative_number,Tolerance)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: multivariate_t_samples/5
.. _multivariate_distributions_protocol/0::multivariate_t_samples/5:

``multivariate_t_samples/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of multivariate Student's t distributed random row vectors using the default numerical tolerance of 1.0e-12.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t_samples(Count,DegreesOfFreedom,Location,Scale,Samples)``
| **Mode and number of proofs:**
|    ``multivariate_t_samples(+integer,+positive_number,+list(number),+list(list(number)),-list(list(float)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor a number:
|        ``type_error(number,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is a number but not a positive number:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``


------------

.. index:: multivariate_t_samples/6
.. _multivariate_distributions_protocol/0::multivariate_t_samples/6:

``multivariate_t_samples/6``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of multivariate Student's t distributed random row vectors using the given non-negative numerical tolerance.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t_samples(Count,DegreesOfFreedom,Location,Scale,Tolerance,Samples)``
| **Mode and number of proofs:**
|    ``multivariate_t_samples(+integer,+positive_number,+list(number),+list(list(number)),+number,-list(list(float)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is a negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor a number:
|        ``type_error(number,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is a number but not a positive number:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Tolerance`` is negative:
|        ``domain_error(non_negative_number,Tolerance)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: multivariate_t_density/5
.. _multivariate_distributions_protocol/0::multivariate_t_density/5:

``multivariate_t_density/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate Student's t density using the default numerical tolerance of 1.0e-12. Returns zero outside the affine support of a singular scale matrix.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t_density(Point,DegreesOfFreedom,Location,Scale,Density)``
| **Mode and number of proofs:**
|    ``multivariate_t_density(+list(number),+positive_number,+list(number),+list(list(number)),-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the location dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor a number:
|        ``type_error(number,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is a number but not a positive number:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``


------------

.. index:: multivariate_t_density/6
.. _multivariate_distributions_protocol/0::multivariate_t_density/6:

``multivariate_t_density/6``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate Student's t density using the given non-negative numerical tolerance. Returns zero outside the affine support of a singular scale matrix.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t_density(Point,DegreesOfFreedom,Location,Scale,Tolerance,Density)``
| **Mode and number of proofs:**
|    ``multivariate_t_density(+list(number),+positive_number,+list(number),+list(list(number)),+number,-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the location dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor a number:
|        ``type_error(number,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is a number but not a positive number:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: multivariate_t_log_density/5
.. _multivariate_distributions_protocol/0::multivariate_t_log_density/5:

``multivariate_t_log_density/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate Student's t log-density using the default numerical tolerance of 1.0e-12. Returns ``negative_infinity`` outside singular affine support.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t_log_density(Point,DegreesOfFreedom,Location,Scale,LogDensity)``
| **Mode and number of proofs:**
|    ``multivariate_t_log_density(+list(number),+positive_number,+list(number),+list(list(number)),-atomic)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the location dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor a number:
|        ``type_error(number,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is a number but not a positive number:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``


------------

.. index:: multivariate_t_log_density/6
.. _multivariate_distributions_protocol/0::multivariate_t_log_density/6:

``multivariate_t_log_density/6``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multivariate Student's t log-density using the given non-negative numerical tolerance. Returns ``negative_infinity`` outside singular affine support.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multivariate_t_log_density(Point,DegreesOfFreedom,Location,Scale,Tolerance,LogDensity)``
| **Mode and number of proofs:**
|    ``multivariate_t_log_density(+list(number),+positive_number,+list(number),+list(list(number)),+number,-atomic)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Point`` dimensions do not match the location dimension:
|        ``domain_error(point_dimensions(A),Point)``
|    ``DegreesOfFreedom`` is a variable:
|        ``instantiation_error``
|    ``DegreesOfFreedom`` is neither a variable nor a number:
|        ``type_error(number,DegreesOfFreedom)``
|    ``DegreesOfFreedom`` is a number but not a positive number:
|        ``domain_error(positive_number,DegreesOfFreedom)``
|    ``Location`` is empty:
|        ``domain_error(minimum_number_of_values(1),Location)``
|    ``Scale`` dimensions do not match the location dimension:
|        ``domain_error(covariance_dimensions(A),Scale)``
|    ``Scale`` is not symmetric:
|        ``domain_error(symmetric_matrix,Scale)``
|    ``Scale`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Scale)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: logistic_normal/3
.. _multivariate_distributions_protocol/0::logistic_normal/3:

``logistic_normal/3``
^^^^^^^^^^^^^^^^^^^^^

Returns an additive-log-ratio logistic-normal random vector using the default numerical tolerance of 1.0e-12. A latent vector of length d maps to a simplex vector of length d+1 using the final component as reference.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``logistic_normal(Mean,Covariance,Sample)``
| **Mode and number of proofs:**
|    ``logistic_normal(+list(number),+list(list(number)),-list(float))`` - ``one_or_error``

| **Exceptions:**
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``


------------

.. index:: logistic_normal/4
.. _multivariate_distributions_protocol/0::logistic_normal/4:

``logistic_normal/4``
^^^^^^^^^^^^^^^^^^^^^

Returns an additive-log-ratio logistic-normal random vector using the given non-negative numerical tolerance.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``logistic_normal(Mean,Covariance,Tolerance,Sample)``
| **Mode and number of proofs:**
|    ``logistic_normal(+list(number),+list(list(number)),+number,-list(float))`` - ``one_or_error``

| **Exceptions:**
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: logistic_normal_samples/4
.. _multivariate_distributions_protocol/0::logistic_normal_samples/4:

``logistic_normal_samples/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of additive-log-ratio logistic-normal random row vectors using the default numerical tolerance of 1.0e-12.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``logistic_normal_samples(Count,Mean,Covariance,Samples)``
| **Mode and number of proofs:**
|    ``logistic_normal_samples(+integer,+list(number),+list(list(number)),-list(list(float)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``


------------

.. index:: logistic_normal_samples/5
.. _multivariate_distributions_protocol/0::logistic_normal_samples/5:

``logistic_normal_samples/5``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of additive-log-ratio logistic-normal random row vectors using the given non-negative numerical tolerance.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``logistic_normal_samples(Count,Mean,Covariance,Tolerance,Samples)``
| **Mode and number of proofs:**
|    ``logistic_normal_samples(+integer,+list(number),+list(list(number)),+number,-list(list(float)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``Mean`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Mean`` is neither a partial list nor a list:
|        ``type_error(list,Mean)``
|    An element ``Element`` of the ``Mean`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Mean`` is empty:
|        ``domain_error(minimum_number_of_values(1),Mean)``
|    ``Covariance`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Covariance`` is neither a partial list nor a list:
|        ``type_error(list(list(number)),Covariance)``
|    An element ``Element`` of the ``Covariance`` list is neither a variable nor a list of numbers:
|        ``type_error(list(number),Element)``
|    ``Covariance`` dimensions do not match the mean dimension:
|        ``domain_error(covariance_dimensions(A),Covariance)``
|    ``Covariance`` is not symmetric:
|        ``domain_error(symmetric_matrix,Covariance)``
|    ``Covariance`` is not positive semidefinite:
|        ``domain_error(positive_semidefinite_matrix,Covariance)``
|    ``Tolerance`` is a variable:
|        ``instantiation_error``
|    ``Tolerance`` is neither a variable nor a number:
|        ``type_error(number,Tolerance)``
|    ``Tolerance`` is a nuber but not a non-negative number:
|        ``domain_error(non_negative_number,Tolerance)``


------------

.. index:: dirichlet/2
.. _multivariate_distributions_protocol/0::dirichlet/2:

``dirichlet/2``
^^^^^^^^^^^^^^^

Returns a Dirichlet distributed random vector on the simplex.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``dirichlet(Alphas,Sample)``
| **Mode and number of proofs:**
|    ``dirichlet(+list(positive_number),-list(float))`` - ``one_or_error``

| **Exceptions:**
|    ``Alphas`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Alphas`` is neither a partial list nor a list:
|        ``type_error(list,Alphas)``
|    An element ``Element`` of the ``Alphas`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    An element ``Element`` of the ``Alphas`` list is not positive:
|        ``domain_error(positive_number,Element)``
|    ``Alphas`` has fewer than two elements:
|        ``domain_error(minimum_number_of_values(2),Alphas)``


------------

.. index:: dirichlet_samples/3
.. _multivariate_distributions_protocol/0::dirichlet_samples/3:

``dirichlet_samples/3``
^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of Dirichlet distributed random vectors.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``dirichlet_samples(Count,Alphas,Samples)``
| **Mode and number of proofs:**
|    ``dirichlet_samples(+integer,+list(positive_number),-list(list(float)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``Alphas`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Alphas`` is neither a partial list nor a list:
|        ``type_error(list,Alphas)``
|    An element ``Element`` of the ``Alphas`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    An element ``Element`` of the ``Alphas`` list is not positive:
|        ``domain_error(positive_number,Element)``
|    ``Alphas`` has fewer than two elements:
|        ``domain_error(minimum_number_of_values(2),Alphas)``


------------

.. index:: dirichlet_density/3
.. _multivariate_distributions_protocol/0::dirichlet_density/3:

``dirichlet_density/3``
^^^^^^^^^^^^^^^^^^^^^^^

Computes the Dirichlet density at a point on the simplex. At a boundary, returns the atom ``positive_infinity`` when all non-unit alphas corresponding to zero components are smaller than one, zero when they are all greater than one, or ``undefined`` when both cases occur.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``dirichlet_density(Point,Alphas,Density)``
| **Mode and number of proofs:**
|    ``dirichlet_density(+list(number),+list(positive_number),-atomic)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Alphas`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Alphas`` is neither a partial list nor a list:
|        ``type_error(list,Alphas)``
|    An element ``Element`` of the ``Alphas`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    An element ``Element`` of the ``Alphas`` list is not positive:
|        ``domain_error(positive_number,Element)``
|    ``Point`` and ``Alphas`` have different lengths:
|        ``domain_error(dimension_mismatch,Point)``
|    ``Alphas`` has fewer than two elements:
|        ``domain_error(minimum_number_of_values(2),Alphas)``


------------

.. index:: dirichlet_log_density/3
.. _multivariate_distributions_protocol/0::dirichlet_log_density/3:

``dirichlet_log_density/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the Dirichlet log-density at a point on the simplex. At a boundary, returns the atom ``positive_infinity`` when all non-unit alphas corresponding to zero components are smaller than one, ``negative_infinity`` when they are all greater than one, or ``undefined`` when both cases occur.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``dirichlet_log_density(Point,Alphas,LogDensity)``
| **Mode and number of proofs:**
|    ``dirichlet_log_density(+list(number),+list(positive_number),-atomic)`` - ``one_or_error``

| **Exceptions:**
|    ``Point`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Point`` is neither a partial list nor a list:
|        ``type_error(list,Point)``
|    An element ``Element`` of the ``Point`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    ``Alphas`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Alphas`` is neither a partial list nor a list:
|        ``type_error(list,Alphas)``
|    An element ``Element`` of the ``Alphas`` list is neither a variable nor a number:
|        ``type_error(number,Element)``
|    An element ``Element`` of the ``Alphas`` list is not positive:
|        ``domain_error(positive_number,Element)``
|    ``Point`` and ``Alphas`` have different lengths:
|        ``domain_error(dimension_mismatch,Point)``
|    ``Alphas`` has fewer than two elements:
|        ``domain_error(minimum_number_of_values(2),Alphas)``


------------

.. index:: multinomial/3
.. _multivariate_distributions_protocol/0::multinomial/3:

``multinomial/3``
^^^^^^^^^^^^^^^^^

Returns a multinomial distributed random count vector.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multinomial(Trials,Probabilities,Counts)``
| **Mode and number of proofs:**
|    ``multinomial(+non_negative_integer,+list(probability),-list(non_negative_integer))`` - ``one_or_error``

| **Exceptions:**
|    ``Trials`` is a variable:
|        ``instantiation_error``
|    ``Trials`` is neither a variable nor an integer:
|        ``type_error(integer,Trials)``
|    ``Trials`` is a negative integer:
|        ``domain_error(non_negative_integer,Trials)``
|    ``Probabilities`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Probabilities`` is neither a partial list nor a list:
|        ``type_error(list,Probabilities)``
|    An element ``Element`` of the ``Probabilities`` list is neither a variable nor a float:
|        ``type_error(float,Element)``
|    An element ``Element`` of the ``Probabilities`` list is a float but not a probability:
|        ``domain_error(probability,Element)``
|    ``Probabilities`` is empty:
|        ``domain_error(minimum_number_of_values(1),Probabilities)``
|    ``Probabilities`` do not sum to one:
|        ``domain_error(probability_distribution,Probabilities)``


------------

.. index:: multinomial_samples/4
.. _multivariate_distributions_protocol/0::multinomial_samples/4:

``multinomial_samples/4``
^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the requested number of multinomial distributed random count vectors.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multinomial_samples(Count,Trials,Probabilities,Samples)``
| **Mode and number of proofs:**
|    ``multinomial_samples(+integer,+non_negative_integer,+list(probability),-list(list(non_negative_integer)))`` - ``one_or_error``

| **Exceptions:**
|    ``Count`` is a variable:
|        ``instantiation_error``
|    ``Count`` is neither a variable nor an integer:
|        ``type_error(integer,Count)``
|    ``Count`` is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Count)``
|    ``Trials`` is a variable:
|        ``instantiation_error``
|    ``Trials`` is neither a variable nor an integer:
|        ``type_error(integer,Trials)``
|    ``Trials`` is a negative integer:
|        ``domain_error(non_negative_integer,Trials)``
|    ``Probabilities`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Probabilities`` is neither a partial list nor a list:
|        ``type_error(list,Probabilities)``
|    An element ``Element`` of the ``Probabilities`` list is neither a variable nor a float:
|        ``type_error(float,Element)``
|    An element ``Element`` of the ``Probabilities`` list is a float but not a probability:
|        ``domain_error(probability,Element)``
|    ``Probabilities`` is empty:
|        ``domain_error(minimum_number_of_values(1),Probabilities)``
|    ``Probabilities`` do not sum to one:
|        ``domain_error(probability_distribution,Probabilities)``


------------

.. index:: multinomial_density/4
.. _multivariate_distributions_protocol/0::multinomial_density/4:

``multinomial_density/4``
^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multinomial probability mass at the given count vector.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multinomial_density(Counts,Trials,Probabilities,Density)``
| **Mode and number of proofs:**
|    ``multinomial_density(+list(non_negative_integer),+non_negative_integer,+list(probability),-float)`` - ``one_or_error``

| **Exceptions:**
|    ``Counts`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Counts`` is neither a partial list nor a list:
|        ``type_error(list,Counts)``
|    An element ``Element`` of the ``Counts`` list is neither a variable nor an integer:
|        ``type_error(integer,Element)``
|    An element ``Element`` of the ``Counts`` list is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Element)``
|    ``Trials`` is a variable:
|        ``instantiation_error``
|    ``Trials`` is neither a variable nor an integer:
|        ``type_error(integer,Trials)``
|    ``Trials`` is a negative integer:
|        ``domain_error(non_negative_integer,Trials)``
|    ``Probabilities`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Probabilities`` is neither a partial list nor a list:
|        ``type_error(list,Probabilities)``
|    An element ``Element`` of the ``Probabilities`` list is neither a variable nor a float:
|        ``type_error(float,Element)``
|    An element ``Element`` of the ``Probabilities`` list is a float but not a probability:
|        ``domain_error(probability,Element)``
|    ``Probabilities`` is empty:
|        ``domain_error(minimum_number_of_values(1),Probabilities)``
|    ``Probabilities`` do not sum to one:
|        ``domain_error(probability_distribution,Probabilities)``
|    ``Counts`` and ``Probabilities`` have different lengths:
|        ``domain_error(dimension_mismatch,Counts)``


------------

.. index:: multinomial_log_density/4
.. _multivariate_distributions_protocol/0::multinomial_log_density/4:

``multinomial_log_density/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the multinomial log-probability mass at the given count vector. Returns the atom ``negative_infinity`` for an impossible count vector.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multinomial_log_density(Counts,Trials,Probabilities,LogDensity)``
| **Mode and number of proofs:**
|    ``multinomial_log_density(+list(non_negative_integer),+non_negative_integer,+list(probability),-atomic)`` - ``one_or_error``

| **Exceptions:**
|    ``Counts`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Counts`` is neither a partial list nor a list:
|        ``type_error(list,Counts)``
|    An element ``Element`` of the ``Counts`` list is neither a variable nor an integer:
|        ``type_error(integer,Element)``
|    An element ``Element`` of the ``Counts`` list is an integer but not a non-negative integer:
|        ``domain_error(non_negative_integer,Element)``
|    ``Trials`` is a variable:
|        ``instantiation_error``
|    ``Trials`` is neither a variable nor an integer:
|        ``type_error(integer,Trials)``
|    ``Trials`` is a negative integer:
|        ``domain_error(non_negative_integer,Trials)``
|    ``Probabilities`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Probabilities`` is neither a partial list nor a list:
|        ``type_error(list,Probabilities)``
|    An element ``Element`` of the ``Probabilities`` list is neither a variable nor a float:
|        ``type_error(float,Element)``
|    An element ``Element`` of the ``Probabilities`` list is a float but not a probability:
|        ``domain_error(probability,Element)``
|    ``Probabilities`` is empty:
|        ``domain_error(minimum_number_of_values(1),Probabilities)``
|    ``Probabilities`` do not sum to one:
|        ``domain_error(probability_distribution,Probabilities)``
|    ``Counts`` and ``Probabilities`` have different lengths:
|        ``domain_error(dimension_mismatch,Counts)``


------------

.. index:: multinomial_quantile/4
.. _multivariate_distributions_protocol/0::multinomial_quantile/4:

``multinomial_quantile/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^

Computes a multinomial quantile (count vector) for a probability strictly between zero and one. Count vectors are ordered by decreasing probability mass and then by increasing lexicographic order for log-probabilities equal within a relative tolerance of 1.0e-12. The returned vector is the first whose cumulative probability mass is at least the requested probability. The exact computation is limited to 100000 count vectors.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``multinomial_quantile(Probability,Trials,Probabilities,Quantile)``
| **Mode and number of proofs:**
|    ``multinomial_quantile(+open_probability,+non_negative_integer,+list(probability),-list(non_negative_integer))`` - ``one_or_error``

| **Exceptions:**
|    ``Probability`` is a variable:
|        ``instantiation_error``
|    ``Probability`` is neither a variable nor a float:
|        ``type_error(float,Probability)``
|    ``Probability`` is a float but not strictly between zero and one:
|        ``domain_error(open_probability,Probability)``
|    ``Trials`` is a variable:
|        ``instantiation_error``
|    ``Trials`` is neither a variable nor an integer:
|        ``type_error(integer,Trials)``
|    ``Trials`` is a negative integer:
|        ``domain_error(non_negative_integer,Trials)``
|    ``Probabilities`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Probabilities`` is neither a partial list nor a list:
|        ``type_error(list,Probabilities)``
|    An element ``Element`` of the ``Probabilities`` list is neither a variable nor a float:
|        ``type_error(float,Element)``
|    An element ``Element`` of the ``Probabilities`` list is a float but not a probability:
|        ``domain_error(probability,Element)``
|    ``Probabilities`` is empty:
|        ``domain_error(minimum_number_of_values(1),Probabilities)``
|    ``Probabilities`` do not sum to one:
|        ``domain_error(probability_distribution,Probabilities)``
|    The number of count vectors exceeds the supported limit:
|        ``resource_error(multinomial_quantile_compositions)``


------------

Protected predicates
--------------------

(none)

Private predicates
------------------

(none)

Operators
---------

(none)

.. seealso::

   :ref:`multivariate_distributions(Random) <multivariate_distributions/1>`, :ref:`linear_algebra <linear_algebra/0>`, :ref:`sampling_protocol <sampling_protocol/0>`

