|
| 1 | +.. SPDX-FileCopyrightText: 2019-2020 Intel Corporation |
| 2 | +.. |
| 3 | +.. SPDX-License-Identifier: CC-BY-4.0 |
| 4 | +
|
| 5 | +.. _onemkl_blas_axpby: |
| 6 | + |
| 7 | +axpby |
| 8 | +===== |
| 9 | + |
| 10 | +Computes a vector-scalar product added to a scaled-vector. |
| 11 | + |
| 12 | +.. _onemkl_blas_axpby_description: |
| 13 | + |
| 14 | +.. rubric:: Description |
| 15 | + |
| 16 | +The ``axpby`` routines compute two scalar-vector product and add them: |
| 17 | + |
| 18 | +.. math:: |
| 19 | +
|
| 20 | + y \leftarrow beta * y + alpha * x |
| 21 | +
|
| 22 | +where ``x`` and ``y`` are vectors of ``n`` elements and ``alpha`` and ``beta`` are scalars. |
| 23 | + |
| 24 | +``axpby`` supports the following precisions. |
| 25 | + |
| 26 | + .. list-table:: |
| 27 | + :header-rows: 1 |
| 28 | + |
| 29 | + * - T |
| 30 | + * - ``float`` |
| 31 | + * - ``double`` |
| 32 | + * - ``std::complex<float>`` |
| 33 | + * - ``std::complex<double>`` |
| 34 | + |
| 35 | +.. _onemkl_blas_axpby_buffer: |
| 36 | + |
| 37 | +axpby (Buffer Version) |
| 38 | +---------------------- |
| 39 | + |
| 40 | +.. rubric:: Syntax |
| 41 | + |
| 42 | +.. code-block:: cpp |
| 43 | +
|
| 44 | + namespace oneapi::mkl::blas::column_major { |
| 45 | + void axpby(sycl::queue &queue, |
| 46 | + std::int64_t n, |
| 47 | + T alpha, |
| 48 | + sycl::buffer<T,1> &x, std::int64_t incx, |
| 49 | + T beta, |
| 50 | + sycl::buffer<T,1> &y, std::int64_t incy) |
| 51 | + } |
| 52 | +.. code-block:: cpp |
| 53 | +
|
| 54 | + namespace oneapi::mkl::blas::row_major { |
| 55 | + void axpby(sycl::queue &queue, |
| 56 | + std::int64_t n, |
| 57 | + T alpha, |
| 58 | + sycl::buffer<T,1> &x, std::int64_t incx, |
| 59 | + T beta, |
| 60 | + sycl::buffer<T,1> &y, std::int64_t incy) |
| 61 | + } |
| 62 | +
|
| 63 | +.. container:: section |
| 64 | + |
| 65 | + .. rubric:: Input Parameters |
| 66 | + |
| 67 | + queue |
| 68 | + The queue where the routine should be executed. |
| 69 | + |
| 70 | + n |
| 71 | + Number of elements in vector ``x`` and ``y``. |
| 72 | + |
| 73 | + alpha |
| 74 | + Specifies the scalar ``alpha``. |
| 75 | + |
| 76 | + x |
| 77 | + Buffer holding input vector ``x``. The buffer must be of size at least |
| 78 | + (1 + (``n`` – 1)*abs(``incx``)). See :ref:`matrix-storage` for |
| 79 | + more details. |
| 80 | + |
| 81 | + incx |
| 82 | + Stride between two consecutive elements of the ``x`` vector. |
| 83 | + |
| 84 | + beta |
| 85 | + Specifies the scalar ``beta``. |
| 86 | + |
| 87 | + y |
| 88 | + Buffer holding input vector ``y``. The buffer must be of size at least |
| 89 | + (1 + (``n`` – 1)*abs(``incy``)). See :ref:`matrix-storage` for |
| 90 | + more details. |
| 91 | + |
| 92 | + incy |
| 93 | + Stride between two consecutive elements of the ``y`` vector. |
| 94 | + |
| 95 | +.. container:: section |
| 96 | + |
| 97 | + .. rubric:: Output Parameters |
| 98 | + |
| 99 | + y |
| 100 | + Buffer holding the updated vector ``y``. |
| 101 | + |
| 102 | +.. container:: section |
| 103 | + |
| 104 | + .. rubric:: Throws |
| 105 | + |
| 106 | + This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here. |
| 107 | + |
| 108 | + :ref:`oneapi::mkl::invalid_argument<onemkl_exception_invalid_argument>` |
| 109 | + |
| 110 | + :ref:`oneapi::mkl::unsupported_device<onemkl_exception_unsupported_device>` |
| 111 | + |
| 112 | + :ref:`oneapi::mkl::host_bad_alloc<onemkl_exception_host_bad_alloc>` |
| 113 | + |
| 114 | + :ref:`oneapi::mkl::device_bad_alloc<onemkl_exception_device_bad_alloc>` |
| 115 | + |
| 116 | + :ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>` |
| 117 | + |
| 118 | +.. _onemkl_blas_axpby_usm: |
| 119 | + |
| 120 | +axpby (USM Version) |
| 121 | +------------------- |
| 122 | + |
| 123 | +.. rubric:: Syntax |
| 124 | + |
| 125 | +.. code-block:: cpp |
| 126 | +
|
| 127 | + namespace oneapi::mkl::blas::column_major { |
| 128 | + sycl::event axpby(sycl::queue &queue, |
| 129 | + std::int64_t n, |
| 130 | + T alpha, |
| 131 | + const T *x, std::int64_t incx, |
| 132 | + const T beta, |
| 133 | + T *y, std::int64_t incy, |
| 134 | + const std::vector<sycl::event> &dependencies = {}) |
| 135 | + } |
| 136 | +.. code-block:: cpp |
| 137 | +
|
| 138 | + namespace oneapi::mkl::blas::row_major { |
| 139 | + sycl::event axpby(sycl::queue &queue, |
| 140 | + std::int64_t n, |
| 141 | + T alpha, |
| 142 | + const T *x, std::int64_t incx, |
| 143 | + const T beta, |
| 144 | + T *y, std::int64_t incy, |
| 145 | + const std::vector<sycl::event> &dependencies = {}) |
| 146 | + } |
| 147 | +
|
| 148 | +.. container:: section |
| 149 | + |
| 150 | + .. rubric:: Input Parameters |
| 151 | + |
| 152 | + queue |
| 153 | + The queue where the routine should be executed. |
| 154 | + |
| 155 | + n |
| 156 | + Number of elements in vector ``x`` and ``y``. |
| 157 | + |
| 158 | + alpha |
| 159 | + Specifies the scalar alpha. |
| 160 | + |
| 161 | + beta |
| 162 | + Specifies the scalar beta. |
| 163 | + |
| 164 | + x |
| 165 | + Pointer to the input vector ``x``. The allocated memory must be |
| 166 | + of size at least (1 + (``n`` – 1)*abs(``incx``)). See |
| 167 | + :ref:`matrix-storage` for more details. |
| 168 | + |
| 169 | + incx |
| 170 | + Stride between consecutive elements of the ``x`` vector. |
| 171 | + |
| 172 | + y |
| 173 | + Pointer to the input vector ``y``. The allocated memory must be |
| 174 | + of size at least (1 + (``n`` – 1)*abs(``incy``)). See |
| 175 | + :ref:`matrix-storage` for more details. |
| 176 | + |
| 177 | + incy |
| 178 | + Stride between consecutive elements of the ``y`` vector. |
| 179 | + |
| 180 | + dependencies |
| 181 | + List of events to wait for before starting computation, if any. |
| 182 | + If omitted, defaults to no dependencies. |
| 183 | + |
| 184 | +.. container:: section |
| 185 | + |
| 186 | + .. rubric:: Output Parameters |
| 187 | + |
| 188 | + y |
| 189 | + Array holding the updated vector ``y``. |
| 190 | + |
| 191 | +.. container:: section |
| 192 | + |
| 193 | + .. rubric:: Return Values |
| 194 | + |
| 195 | + Output event to wait on to ensure computation is complete. |
| 196 | + |
| 197 | +.. container:: section |
| 198 | + |
| 199 | + .. rubric:: Throws |
| 200 | + |
| 201 | + This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here. |
| 202 | + |
| 203 | + :ref:`oneapi::mkl::invalid_argument<onemkl_exception_invalid_argument>` |
| 204 | + |
| 205 | + :ref:`oneapi::mkl::unsupported_device<onemkl_exception_unsupported_device>` |
| 206 | + |
| 207 | + :ref:`oneapi::mkl::host_bad_alloc<onemkl_exception_host_bad_alloc>` |
| 208 | + |
| 209 | + :ref:`oneapi::mkl::device_bad_alloc<onemkl_exception_device_bad_alloc>` |
| 210 | + |
| 211 | + :ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>` |
| 212 | + |
| 213 | + **Parent topic:** :ref:`blas-like-extensions` |
| 214 | +
|
0 commit comments