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] add Data Fitting domain to oneMKL #413

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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,7 +26,7 @@ namespace oneMKL domain or content
``oneapi::mkl::dft`` Discrete and fast Fourier transformations. See :ref:`onemkl_dft`
``oneapi::mkl::rng`` Random number generator routines. See :ref:`onemkl_rng`
``oneapi::mkl::vm`` Vector mathematics routines, e.g. trigonometric, exponential functions acting on elements of a vector. See :ref:`onemkl_vm`
``oneapi::mkl::experimental::data_fitting`` Data fitting routines, e.g. interpolate. See :ref:`data_fitting`
``oneapi::mkl::experimental::data_fitting`` Data fitting routines, e.g. interpolation. See :ref:`data_fitting`
=========================================== =========================================================================

.. note::
Expand Down
10 changes: 3 additions & 7 deletions source/elements/oneMKL/source/domains/data_fitting/cubic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
Cubic Splines
=============

.. contents::
:local:
:depth: 2

Cubic splines are splines whose degree is equal to 3.

Cubic splines are described by the following polynomial
Expand All @@ -20,9 +16,9 @@ where
x \in \left[ x_i, x_{i+1} \right),

.. math::
i = 1,\cdots , n-1.
i = 1,\dots , n-1.

There are a lot of different types of cubic splines: Hermite, natural, Akima, Bessel.
There are many different kinds of cubic splines: Hermite, natural, Akima, Bessel.
However, the current version of DPC++ API supports only one type: Hermite.

Header File
Expand All @@ -42,7 +38,7 @@ Namespace
Hermite Spline
--------------

Coefficients of Hermite spline are calculated using the following formulas:
The coefficients of Hermite spline are calculated using the following formulas:

.. math::
c_{1,i} = f\left( x_i \right),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Data Fitting
============

|IONE-MKL| provides spline-based interpolation capabilities that can be used for
oneMKL provides spline-based interpolation capabilities that can be used for
spline construction (Linear, Cubic, Quadratic etc.),
to perform cell-search operations, and to approximate functions,
function derivatives, or integrals.
Expand Down
20 changes: 8 additions & 12 deletions source/elements/oneMKL/source/domains/data_fitting/interpolate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
Interpolate Function
====================

.. contents::
:local:
:depth: 1

Interpolate function performs computations of function and derivatives values at interpolation sites.

If the sites do not belong to interpolation interval ``[a, b]``, the library uses:
If the sites do not belong to interpolation interval ``[a, b)``, the library uses:

- interpolant :math:`I_0` coefficients computed for interval :math:`[x_0, x_1)` for the
computations at the sites to the left of ``a``.
- interpolant :math:`I_{n-2}` coefficients computed for interval
:math:`[x_{n-2}, x_{n-1})` for the computations at the sites to the right of ``b``.

Interpolation algorithm depends on interpolant's type (e.g., for cubic spline
interpoilation evaluation of third-order polynomial is performed to obtain function values).
Interpolation algorithm depends on interpolant's type (e.g., for a cubic spline,
the evaluation of a third-order polynomial is performed to obtain the resulting interpolant value).

Header File
-----------
Expand All @@ -31,7 +27,7 @@ Namespace

.. code:: cpp

oneapi::mkl::experimental::data_fitiing
oneapi::mkl::experimental::data_fitting

Syntax
------
Expand Down Expand Up @@ -61,7 +57,7 @@ Syntax

template <typename Interpolant>
sycl::event interpolate(
sycl::queue& q,
sycl::queue& queue,
const Interpolant& interpolant,
typename Interpolant::fp_type* sites,
std::int64_t n_sites,
Expand All @@ -72,7 +68,7 @@ Syntax

template <typename Interpolant>
sycl::event interpolate(
sycl::queue& q,
sycl::queue& queue,
const Interpolant& interpolant,
typename Interpolant::fp_type* sites,
std::int64_t n_sites,
Expand All @@ -94,13 +90,13 @@ Returns the SYCL event of the submitted task.
(function values is considered as a zero derivative) which are indicated in
``der_indicator`` (each bit corresponds to certain derivative starting from lower bit)
using the SYCL queue associated with ``interpolant``.
#. Performs computations of function values only using ``q`` as an input argument
#. Performs computations of function values only using ``queue`` as an input argument
that should be created from the same context and device as the SYCL queue
associated with ``interpolant``.
#. Performs computations of certain derivatives
(function values is considered as a zero derivative) which are indicated in
``der_indicator`` (each bit corresponds to certain derivative starting from lower bit)
using ``q`` as an input argument that should be created from
using ``queue`` as an input argument that should be created from
the same context and device as the SYCL queue associated with ``interpolant``.

Follow the :ref:`examples` section to see examples of the interpolation function usage.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
Linear Spline
=============

.. contents::
:local:
:depth: 1

Linear spline is a spline whose degree is equal to 1.

It's described by the following polynomial
Expand All @@ -26,7 +22,7 @@ where
c_{2,i} = \left[ x_i, x_{i+1} \right]f,

.. math::
i = 1, \cdots, n-1.
i = 1, \dots, n-1.

Header File
-----------
Expand Down
33 changes: 14 additions & 19 deletions source/elements/oneMKL/source/domains/data_fitting/splines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
Splines
=======

.. contents::
:local:
:depth: 1

Header File
-----------

Expand Down Expand Up @@ -36,12 +32,12 @@ Common API for All Spline Types
using spline_type = SplineType;

spline(
const sycl::queue& q,
const sycl::queue& queue,
std::int64_t ny = 1);

spline(
const sycl::device& dev,
const sycl::context& ctx,
const sycl::device& device,
const sycl::context& context,
std::int64_t ny = 1);

~spline();
Expand Down Expand Up @@ -82,10 +78,10 @@ that operates with the ``T`` data type. ``ST`` is a type of spline.

* - Constructor
- Description
* - ``spline(const sycl::queue& q, std::int64_t ny = 1);``
- Create an object with the ``q`` SYCL queue and ``ny`` number of functions.
* - ``spline(const sycl::device& dev, const sycl::context& ctx, std::int64_t ny = 1);``
- Create an object using the ``dev`` SYCL device, the ``ctx`` context
* - ``spline(const sycl::queue& queue, std::int64_t ny = 1);``
- Create an object with the ``queue`` SYCL queue and ``ny`` number of functions.
* - ``spline(const sycl::device& device, const sycl::context& context, std::int64_t ny = 1);``
- Create an object using the ``device`` SYCL device, the ``context`` context
and ``ny`` number of functions.

.. list-table::
Expand All @@ -97,26 +93,25 @@ that operates with the ``T`` data type. ``ST`` is a type of spline.
- Set partition values that are specified by the ``input_data`` memory pointer and ``nx`` partition values.
Users can provide ``PartitionHint`` to specify the layout of data.
Default layout is ``non_uniform``.
If ``uniform`` is specified, ``nx`` must equals to ``2`` and
``input_data`` must contain only 2 values the left and the right borders of partition.
If ``uniform`` is specified, ``nx`` must be equal to ``2`` and
``input_data`` must contain only 2 values corresponding to the left and the right borders
of the sub-interval defined by the partition.
Otherwise, behavior is undefined.
If ``input_data`` layout doesn't satisfy ``PartitionHint``, behavior is undefined.
Returns a reference to the spline object for which partitions are set.

Example, for ``uniform``. Let :math:`\left\{ i \right\}_{i=1,\cdots,n}` is a partition.
Example, for ``uniform``. Let :math:`\left\{ i \right\}_{i=1,\dots,n}` be a partition.
So, ``input_data`` must contain only 2 values: 1, ``n``.
* - ``spline& set_function_values(FpType* input_data, function_hint FunctionHint = storage_hint::row_major);``
- Set function values that are specified by the ``input_data`` memory pointer.
Number of function values must equals to ``ny * nx`` elements.
Users can provide ``FunctionHint`` to specify the layout of data.
Default layout is ``row_major``.
Number of function values must be ``ny * nx`` elements.
Users can provide a ``FunctionHint`` to specify the layout of data with a default value of ``row_major``.
If ``input_data`` layout doesn't satisfy ``FunctionHint``, behavior is undefined.
Returns a reference to the spline object for which function values are set.
* - ``spline& set_coefficients(FpType* data, coefficient_hint CoeffHint = storage_hint::row_major);``
- Set coefficients that are specified by the ``data`` memory pointer.
Number of coefficients in the memory must equals to the return value of ``get_required_coeffs_size()``.
Users can provide ``CoeffHint`` to specify the layout of data.
Default layout is ``row_major``.
Users can provide a ``CoeffHint`` to specify the layout of data with a default value of ``row_major``.
If ``data`` layout doesn't satisfy ``CoeffHint``, behavior is undefined.
Returns a reference to the spline object for which coefficients are set.
* - ``bool is_initialized() const;``
Expand Down
Loading