Skip to content

Commit 7519a0c

Browse files
[BLAS] add optional index_base parameter to iamax, iamin (#485)
* [BLAS] add optional index_base parameter to iamax, iamin
1 parent 95f5221 commit 7519a0c

2 files changed

Lines changed: 46 additions & 25 deletions

File tree

source/elements/oneMKL/source/domains/blas/iamax.rst

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ has the maximum absolute value of all elements in vector ``x`` (real
1818
variants), or such that (\|Re(``x[i]``)\| + \|Im(``x[i]``)\|) is maximal
1919
(complex variants).
2020

21-
If either ``n`` or ``incx`` are not positive, the routine returns
22-
``0``.
21+
The index is zero-based if ``base`` is set to ``oneapi::mkl::index_base::zero`` (default)
22+
or one-based if it is set to ``oneapi::mkl::index_base::one``.
23+
24+
If either ``n`` or ``incx`` is not positive, the routine returns
25+
``0``, regardless of the base of the index selected.
2326

2427
If more than one vector element is found with the same largest
2528
absolute value, the index of the first one encountered is returned.
@@ -38,13 +41,6 @@ index of the first ``NaN``.
3841
* - ``std::complex<float>``
3942
* - ``std:complex<double>``
4043

41-
.. container:: Note
42-
43-
.. rubric:: Note
44-
:class: NoteTipHead
45-
46-
The index is zero-based.
47-
4844
.. _onemkl_blas_iamax_buffer:
4945

5046
iamax (Buffer Version)
@@ -59,7 +55,8 @@ iamax (Buffer Version)
5955
std::int64_t n,
6056
sycl::buffer<T,1> &x,
6157
std::int64_t incx,
62-
sycl::buffer<std::int64_t,1> &result)
58+
sycl::buffer<std::int64_t,1> &result,
59+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero)
6360
}
6461
.. code-block:: cpp
6562
@@ -68,7 +65,8 @@ iamax (Buffer Version)
6865
std::int64_t n,
6966
sycl::buffer<T,1> &x,
7067
std::int64_t incx,
71-
sycl::buffer<std::int64_t,1> &result)
68+
sycl::buffer<std::int64_t,1> &result,
69+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero)
7270
}
7371
7472
.. container:: section
@@ -89,12 +87,16 @@ iamax (Buffer Version)
8987
incx
9088
The stride of vector ``x``.
9189

90+
base
91+
Indicates how the output value is indexed. If omitted, defaults to zero-based
92+
indexing.
93+
9294
.. container:: section
9395

9496
.. rubric:: Output Parameters
9597

9698
result
97-
The buffer where the zero-based index ``i`` of the maximal element
99+
The buffer where the index ``i`` of the maximal element
98100
is stored.
99101

100102
.. container:: section
@@ -133,6 +135,7 @@ iamax (USM Version)
133135
const T *x,
134136
std::int64_t incx,
135137
std::int64_t *result,
138+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero,
136139
const std::vector<sycl::event> &dependencies = {})
137140
}
138141
.. code-block:: cpp
@@ -143,6 +146,7 @@ iamax (USM Version)
143146
const T *x,
144147
std::int64_t incx,
145148
std::int64_t *result,
149+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero,
146150
const std::vector<sycl::event> &dependencies = {})
147151
}
148152
@@ -165,6 +169,10 @@ iamax (USM Version)
165169
incx
166170
The stride of vector ``x``.
167171

172+
base
173+
Indicates how the output value is indexed. If omitted, defaults to zero-based
174+
indexing.
175+
168176
dependencies
169177
List of events to wait for before starting computation, if any.
170178
If omitted, defaults to no dependencies.
@@ -174,7 +182,7 @@ iamax (USM Version)
174182
.. rubric:: Output Parameters
175183

176184
result
177-
The pointer to where the zero-based index ``i`` of the maximal
185+
The pointer to where the index ``i`` of the maximal
178186
element is stored.
179187

180188
.. container:: section

source/elements/oneMKL/source/domains/blas/iamin.rst

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ the minimum absolute value of all elements in vector ``x`` (real
1818
variants), or such that (\|Re(``x[i]``)\| + \|Im(``x[i]``)\|) is minimal
1919
(complex variants).
2020

21-
If either ``n`` or ``incx`` are not positive, the routine returns
22-
``0``.
21+
The index is zero-based if ``base`` is set to ``oneapi::mkl::index_base::zero`` (default)
22+
or one-based if it is set to ``oneapi::mkl::index_base::one``.
23+
24+
If either ``n`` or ``incx`` is not positive, the routine returns
25+
``0``, regardless of the base of the index selected.
2326

2427
If more than one vector element is found with the same smallest
2528
absolute value, the index of the first one encountered is returned.
@@ -38,12 +41,6 @@ index of the first ``NaN``.
3841
* - ``std::complex<float>``
3942
* - ``std::complex<double>``
4043

41-
.. container:: Note
42-
43-
.. rubric:: Note
44-
:class: NoteTipHead
45-
46-
The index is zero-based.
4744

4845
.. _onemkl_blas_iamin_buffer:
4946

@@ -59,7 +56,8 @@ iamin (Buffer Version)
5956
std::int64_t n,
6057
sycl::buffer<T,1> &x,
6158
std::int64_t incx,
62-
sycl::buffer<std::int64_t,1> &result)
59+
sycl::buffer<std::int64_t,1> &result,
60+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero)
6361
}
6462
.. code-block:: cpp
6563
@@ -68,7 +66,8 @@ iamin (Buffer Version)
6866
std::int64_t n,
6967
sycl::buffer<T,1> &x,
7068
std::int64_t incx,
71-
sycl::buffer<std::int64_t,1> &result)
69+
sycl::buffer<std::int64_t,1> &result,
70+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero)
7271
}
7372
7473
.. container:: section
@@ -89,12 +88,16 @@ iamin (Buffer Version)
8988
incx
9089
Stride of vector x.
9190

91+
base
92+
Indicates how the output value is indexed. If omitted, defaults to zero-based
93+
indexing.
94+
9295
.. container:: section
9396

9497
.. rubric:: Output Parameters
9598

9699
result
97-
Buffer where the zero-based index ``i`` of the minimum element
100+
Buffer where the index ``i`` of the minimum element
98101
will be stored.
99102

100103
.. container:: section
@@ -133,6 +136,7 @@ iamin (USM Version)
133136
const T *x,
134137
std::int64_t incx,
135138
std::int64_t *result,
139+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero,
136140
const std::vector<sycl::event> &dependencies = {})
137141
}
138142
.. code-block:: cpp
@@ -143,6 +147,7 @@ iamin (USM Version)
143147
const T *x,
144148
std::int64_t incx,
145149
std::int64_t *result,
150+
oneapi::mkl::index_base base = oneapi::mkl::index_base::zero,
146151
const std::vector<sycl::event> &dependencies = {})
147152
}
148153
@@ -165,12 +170,20 @@ iamin (USM Version)
165170
incx
166171
Stride of vector x.
167172

173+
base
174+
Indicates how the output value is indexed. If omitted, defaults to zero-based
175+
indexing.
176+
177+
dependencies
178+
List of events to wait for before starting computation, if any.
179+
If omitted, defaults to no dependencies.
180+
168181
.. container:: section
169182

170183
.. rubric:: Output Parameters
171184

172185
result
173-
Pointer to where the zero-based index ``i`` of the minimum
186+
Pointer to where the index ``i`` of the minimum
174187
element will be stored.
175188

176189
.. container:: section

0 commit comments

Comments
 (0)