- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi all,

I have a simple task at hand. I want to compute an element-by-element multiplication of two matrices A and B.

If use C = A*B it delivers the result I want, but it is very slow.

Do you know any faster way to make this computation?

For instance, if A and B were vectors, vdmul would be an efficient way to proceed. I'm looking for something similar, but using matrices.

Thanks!

Gaston

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Dear customer,

For the element-by-element multiplication, I am afraid there's no specify function for matrix, but only vector. If you would like to improve the performance, you could try with multi-threading calculation by using

#pragma omp parallel for for (int i = 0; i < row; i++) { vdMul(col, a, b, y); }

More physical core you have for your CPU, the higher performance you will get. Please also provide the testing performance with your hardware information to us, we will see if the performance acceptable. Thank you.

Best regards,

Fiona

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

**1-D**data sets, like double dMxA[ size ], dMxB[ size ], etc,, then

**vdMul**needs to be used.

**1-D**representation of a matrix is very efficient ( contiguous memory blocks ).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Sergey Kostrov wrote:

>>...I have a simple task at hand. I want to compute an element-by-element multiplication of two matrices A and B.

If your matrices are stored as vectors, that is as

1-Ddata sets, like double dMxA[ size ], dMxB[ size ], etc,, thenvdMulneeds to be used.

1-Drepresentation of a matrix is very efficient ( contiguous memory blocks ).

In this case you can even do hadamard with BLAS functions tbmv or sbmv. Both allow the input matrix to be stored in banded matrix form. With number of super-diagonals = 0 you only need to supply the diagonal, which in this case is one of the vectors

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page