Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Vector - Scalar operation

gottoomanyaccounts
1,135 Views
Hello,

I am wondering if MKL provides operations like y=a+r, where y and a are vectors, while r is a real scalar. It essentially adds the scalar r to every element of a.

Thanks a lot.
0 Kudos
4 Replies
Gennady_F_Intel
Moderator
1,135 Views
Yes, MKL doesnt provide such operations,
but I d recommend you draw attention on IPP ( Intel Integrating Primitives, see the link on IPP: http://www3.intel.com/cd/software/products/asmo-na/eng/perflib/ipp/302910.htm)

IPP support such operations.
See the short description below:
Arithmetic Functions
This section describes the Intel IPP signal processing functions that perform vector arithmetic operations on vectors. The arithmetic functions include basic element-wise arithmetic operations between vectors, as well as more complex calculations such as computing absolute values, square and square root, natural logarithm and exponential of vector elements.
Intel IPP software provides two versions of each function. One version performs the operation in-place, while the other stores the results of the operation in a different destination vector, that is, executes an out-of-place operation.
AddC

Adds a constant value to each element of a vector
Case 1. Not-in-place operations on floating point data.
Case 2. Not-in-place operations on integer data.
Case 3. In-place operations on floating point data.
Case 4. In-place operations on integer data.

Regards, Gennady
0 Kudos
gottoomanyaccounts
1,135 Views
Yes, MKL doesnt provide such operations,
but I d recommend you draw attention on IPP ( Intel Integrating Primitives, see the link on IPP: http://www3.intel.com/cd/software/products/asmo-na/eng/perflib/ipp/302910.htm)

IPP support such operations.
See the short description below:
Arithmetic Functions
This section describes the Intel IPP signal processing functions that perform vector arithmetic operations on vectors. The arithmetic functions include basic element-wise arithmetic operations between vectors, as well as more complex calculations such as computing absolute values, square and square root, natural logarithm and exponential of vector elements.
Intel IPP software provides two versions of each function. One version performs the operation in-place, while the other stores the results of the operation in a different destination vector, that is, executes an out-of-place operation.
AddC

Adds a constant value to each element of a vector
Case 1. Not-in-place operations on floating point data.
Case 2. Not-in-place operations on integer data.
Case 3. In-place operations on floating point data.
Case 4. In-place operations on integer data.

Regards, Gennady


Thanks for the reply. I will take a look at the IPP package. So it is a separate package independent of ifort or MKL? It looks like the server I am working on doesn't have the package. Right now I guess I will just write the plain subroutine to do the job, hope it still has a good performance. It's encouraging to know there is an optimized library to do it anyway (I was expecting MKL would directly provide this kind of common operations).

Thanks.


0 Kudos
Gennady_F_Intel
Moderator
1,135 Views
1. IPP is available as a standalone package and as a part of the latest Intel C/C++ Compiler (since version 11). For general information on support for Intel software products, visit the Intel web site http://developer.intel.com/software/products/ or on Intel IPP Website - http://www.intel.com/software/products/IPP contains releases information
2. I think in your case to write the plain subroutine and compile it by Intel Compiler is the fastest and probably the best way (in this specific case)to reach very high performance, because of Intel compiler supports a variety of options and features that allow optimization opportunities;
--Gennady

0 Kudos
Venkat_Konuganti
Beginner
1,135 Views

Can't you use v?LinearFrac

0 Kudos
Reply