Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

## Element-wise Matrix Multiplication

Beginner
1,130 Views

I'm new to IPP and am trying to find the function (if it exists) that supports element-wise matrix multiplication. I've found some matrix operations, but none of them seem to support element-wise operations. Can someone please point me in the right direction?

Thanks!

6 Replies
Valued Contributor II
1,130 Views
Do you mean [ 2 2 2 ] [ 4 4 4 ] [ 8 8 8 ] [ 2 2 2 ] x [ 4 4 4 ] => [ 8 8 8 ] [ 2 2 2 ] [ 4 4 4 ] [ 8 8 8 ] or you're trying to find out if IPP supports a classic transposed based matrix multiplication?
Valued Contributor II
1,130 Views
Here is a comment to IDZ developers: Why does the editor remove spaces in posts? It is simply impossible in some cases to format examples.
Beginner
1,130 Views

Good question Sergey, I should have been more explicit.

Using Matlab notation:
[a1,a2 ; a3,a4] .* [b1,b2 ; b3,b4] = [a1*b1,a2*b2 ; a3*b3,a4*b4]

Thanks!

Valued Contributor II
1,130 Views
Please take a look at a set of DSP functions from ipps.h header file: ... IPPAPI( IppStatus, ippsMul_32fc_A11, (const Ipp32fc a[],const Ipp32fc b[],Ipp32fc r[],Ipp32s n)) IPPAPI( IppStatus, ippsMul_32fc_A21, (const Ipp32fc a[],const Ipp32fc b[],Ipp32fc r[],Ipp32s n)) IPPAPI( IppStatus, ippsMul_32fc_A24, (const Ipp32fc a[],const Ipp32fc b[],Ipp32fc r[],Ipp32s n)) IPPAPI( IppStatus, ippsMul_64fc_A26, (const Ipp64fc a[],const Ipp64fc b[],Ipp64fc r[],Ipp32s n)) IPPAPI( IppStatus, ippsMul_64fc_A50, (const Ipp64fc a[],const Ipp64fc b[],Ipp64fc r[],Ipp32s n)) IPPAPI( IppStatus, ippsMul_64fc_A53, (const Ipp64fc a[],const Ipp64fc b[],Ipp64fc r[],Ipp32s n)) ...
Valued Contributor II
1,130 Views
In overall, a set of IPP functions ippsMul_xxfc_Axx could be used. This is because both matrices with the same sizes are represented in memory as "vectors" if they are located in contiguous memory blocks. Note 1: In case of array-of-arrays representations of matrices these IPP functions can't be used. However, multiplication could be done as row by row. Note 2: Take a look at IPP Vector Math library. Note 3: You could also look at MKL library and let me know if you're interested in that and I'll point you in a right direction.
Moderator
1,130 Views

two comments on this topic:

1) all -- ipp mxm operations are well optimized for very small matrixes ( <= 6x6)

2) in the case if need to compute larger problems, I would recommend you to look at MKL's implementaion of m x m operations.