axpby

Computes a vector-scalar product added to a scaled-vector.

Description

The axpby routines compute two scalar-vector product and add them:

y := beta * y + alpha * x

where x and y are vectors of n elements and alpha and beta are scalars.

API

Syntax

namespace oneapi::mkl::blas {
  sycl::event axpby(sycl::queue &exec_queue,
                std::int64_t n, T alpha,
                const T *x, std::int64_t incx,
                T beta,
                T *y, std::int64_t incy,
                const vector_class<event> &dependencies = {});

  void axpby(sycl::queue &exec_queue,
         std::int64_t n, T alpha,
         sycl::buffer<T,1> &x, std::int64_t incx,
         T beta,
         sycl::buffer<T,1> &y, std::int64_t incy);
  }

axpby supports the following precisions and devices.

T

Devices Supported

float

Host, CPU, and GPU

double

Host, CPU, and GPU

std::complex<float>

Host, CPU, and GPU

std::complex<double>

Host, CPU, and GPU

Input Parameters

exec_queue

The queue where the routine should be executed.

n

Number of elements in vectors x and y.

alpha

Specifies the scalar alpha.

x

Buffer or USM pointer accessible by the queue’s device holding the input vector x. The buffer or allocated memory must be of size at least 1 + (n-1)*abs(incx)). See Matrix Storage for more details.

incx

Stride between two consecutive elements of the x vectors.

beta

Specifies the scalar beta.

y

Buffer or USM pointer accessible by the queue’s device holding all the input vectors y. The buffer or allocated memory must be of size at least 1 + (n-1)*abs(incx)). See Matrix Storage for more details.

incy

Stride between two consecutive elements of the y vectors.

dependencies (USM API only)

List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.

Output Parameters

y

Array or buffer holding the updated vectory y.