Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[oneMKL][RNG] Extend parameter type for random distributions #557

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ The probability density function is given by:
class gaussian_mv
-----------------

Let ``SequenceContainerOrView`` be a type that can be one of C++ Sequence containers or C++ Views (``span``, ``mdspan``).
It's implementation defined which type ``SequenceContainerOrView`` represents.

.. rubric:: Syntax

.. code-block:: cpp
Expand All @@ -36,10 +39,10 @@ class gaussian_mv
public:
using method_type = Method;
using result_type = RealType;
explicit gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix);
explicit gaussian_mv(std::uint32_t dimen, SequenceContainerOrView<RealType> mean, SequenceContainerOrView<RealType> matrix);
std::int32_t dimen() const;
std::vector<RealType> mean() const;
std::vector<RealType> matrix() const;
SequenceContainerOrView<RealType> mean() const;
SequenceContainerOrView<RealType> matrix() const;
};
}

Expand Down Expand Up @@ -85,13 +88,13 @@ class gaussian_mv

* - Routine
- Description
* - `explicit gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix)`_
* - `explicit gaussian_mv(std::uint32_t dimen, SequenceContainerOrView<RealType> mean, SequenceContainerOrView<RealType> matrix)`_
- Constructor with parameters
* - `std::int32_t dimen() const`_
- Method to obtain number of dimensions in output random vectors
* - `std::vector<double> mean() const`_
* - `SequenceContainerOrView<double> mean() const`_
- Method to obtain mean vector `a` of dimension d.
* - `std::vector<double> matrix() const`_
* - `SequenceContainerOrView<double> matrix() const`_
- Method to obtain variance-covariance matrix `C`

.. container:: section
Expand Down Expand Up @@ -128,17 +131,17 @@ class gaussian_mv

.. container:: section

.. _`explicit gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix)`:
.. _`explicit gaussian_mv(std::uint32_t dimen, SequenceContainerOrView<RealType> mean, SequenceContainerOrView<RealType> matrix)`:

.. code-block:: cpp

explicit gaussian_mv::gaussian_mv(std::uint32_t dimen, std::vector<RealType> mean, std::vector<RealType> matrix)
explicit gaussian_mv::gaussian_mv(std::uint32_t dimen, SequenceContainerOrView<RealType> mean, SequenceContainerOrView<RealType> matrix)

.. container:: section

.. rubric:: Description

Constructor with parameters. `dimen` is the number of dimensions, `mean` is a mean vector, `matrix` is a variance-covariance matrix.
Constructor with parameters. ``dimen`` is the number of dimensions, ``mean`` is a mean vector, ``matrix`` is a variance-covariance matrix.

.. container:: section

Expand Down Expand Up @@ -167,11 +170,11 @@ class gaussian_mv

.. container:: section

.. _`std::vector<double> mean() const`:
.. _`SequenceContainerOrView<double> mean() const`:

.. code-block:: cpp

std::vector<double> gaussian_mv::mean() const
SequenceContainerOrView<double> gaussian_mv::mean() const

.. container:: section

Expand All @@ -181,16 +184,16 @@ class gaussian_mv

.. container:: section

.. _`std::vector<double> matrix() const`:
.. _`SequenceContainerOrView<double> matrix() const`:

.. code-block:: cpp

std::vector<double> gaussian_mv::matrix() const
SequenceContainerOrView<double> gaussian_mv::matrix() const

.. container:: section

.. rubric:: Return Value

Returns the variance-covariance matrix.

**Parent topic:** :ref:`onemkl_rng_distributions`
**Parent topic:** :ref:`onemkl_rng_distributions`
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ The probability distribution is given by:
class multinomial
-----------------

Let ``SequenceContainerOrView`` be a type that can be one of C++ Sequence containers or C++ Views (``span``, ``mdspan``).
It's implementation defined which type ``SequenceContainerOrView`` represents.

.. rubric:: Syntax

.. code-block:: cpp
Expand All @@ -36,9 +39,9 @@ class multinomial
public:
using method_type = Method;
using result_type = IntType;
explicit multinomial(double ntrial, std::vector<double> p);
explicit multinomial(double ntrial, SequenceContainerOrView<double> p);
std::int32_t ntrial() const;
std::vector<double> p() const;
SequenceContainerOrView<double> p() const;
};
}

Expand Down Expand Up @@ -72,12 +75,12 @@ class multinomial

* - Routine
- Description
* - `explicit multinomial(double ntrial, std::vector<double> p)`_
* - `explicit multinomial(double ntrial, SequenceContainerOrView<double> p)`_
- Constructor with parameters
* - `std::int32_t ntrial() const`_
- Method to obtain number of independent trials
* - `std::vector<double> p() const`_
- Method to obtain probability vector of possible outcomes
* - `SequenceContainerOrView<double> p() const`_
- Method to obtain a probability parameter of possible outcomes

.. container:: section

Expand Down Expand Up @@ -113,17 +116,17 @@ class multinomial

.. container:: section

.. _`explicit multinomial(double ntrial, std::vector<double> p)`:
.. _`explicit multinomial(double ntrial, SequenceContainerOrView<double> p)`:

.. code-block:: cpp

explicit multinomial::multinomial(double ntrial, std::vector<double> p)
explicit multinomial::multinomial(double ntrial, SequenceContainerOrView<double> p)

.. container:: section

.. rubric:: Description

Constructor with parameters. `ntrial` is a number of independent trials, `p` is a probability vector.
Constructor with parameters. ``ntrial`` is a number of independent trials, ``p`` is a probability parameter.

.. container:: section

Expand Down Expand Up @@ -152,11 +155,11 @@ class multinomial

.. container:: section

.. _`std::vector<double> p() const`:
.. _`SequenceContainerOrView<double> p() const`:

.. code-block:: cpp

std::vector<double> multinomial::p() const
SequenceContainerOrView<double> multinomial::p() const

.. container:: section

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Class is used for generation of Poisson distributed integer types random numbers

.. rubric:: Description

The class object is used in the :ref:`oneapi::mkl::rng::generate()<onemkl_rng_generate>` function to provide n random numbers Poisson distributed, with distribution parameter :math:`\lambda_i`, where :math:`\lambda_i \in R; \lambda_i > 0; i = 1, ... , n`.
The class object is used in the :ref:`oneapi::mkl::rng::generate()<onemkl_rng_generate>` function to provide
n random numbers Poisson distributed, with distribution parameter :math:`\lambda_i`, where :math:`\lambda_i \in R; \lambda_i > 0; i = 1, ... , n`.

The probability distribution is given by:

Expand All @@ -32,6 +33,9 @@ The cumulative distribution function is as follows:
class poisson_v
---------------

Let ``SequenceContainerOrView`` be a type that can be one of C++ Sequence containers or C++ Views (``span``, ``mdspan``).
It's implementation defined which type ``SequenceContainerOrView`` represents.

.. rubric:: Syntax

.. code-block:: cpp
Expand All @@ -42,8 +46,8 @@ class poisson_v
public:
using method_type = Method;
using result_type = IntType;
explicit poisson_v(std::vector<double> lambda);
std::vector<double> lambda() const;
explicit poisson_v(SequenceContainerOrView<double> lambda);
SequenceContainerOrView<double> lambda() const;
};
}

Expand Down Expand Up @@ -76,9 +80,9 @@ class poisson_v

* - Routine
- Description
* - `explicit poisson_v(std::vector<double> lambda)`_
* - `explicit poisson_v(SequenceContainerOrView<double> lambda)`_
- Constructor with parameters
* - `std::vector<double> lambda() const`_
* - `SequenceContainerOrView<double> lambda() const`_
- Method to obtain distribution parameter

.. container:: section
Expand Down Expand Up @@ -115,17 +119,17 @@ class poisson_v

.. container:: section

.. _`explicit poisson_v(std::vector<double> lambda)`:
.. _`explicit poisson_v(SequenceContainerOrView<double> lambda)`:

.. code-block:: cpp

explicit poisson_v::poisson_v(std::vector<double> lambda)
explicit poisson_v::poisson_v(SequenceContainerOrView<double> lambda)

.. container:: section

.. rubric:: Description

Constructor with parameters. `lambda` is a distribution parameter.
Constructor with parameters. ``lambda`` is a distribution parameter.

.. container:: section

Expand All @@ -140,16 +144,16 @@ class poisson_v

.. container:: section

.. _`std::vector<double> lambda() const`:
.. _`SequenceContainerOrView<double> lambda() const`:

.. code-block:: cpp

double poisson_v::lambda() const
SequenceContainerOrView<double> poisson_v::lambda() const

.. container:: section

.. rubric:: Return Value

Returns the distribution parameter `lambda`.
Returns the distribution parameter ``lambda``.

**Parent topic:** :ref:`onemkl_rng_distributions`
**Parent topic:** :ref:`onemkl_rng_distributions`