Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

Is there a more efficient way for element-by-element multiplication for matrix?

$
0
0

Hi, everyone.

I was writing some FORTRAN codes for computing the DOT of two matrix which idea is as same as dot of vectors. Firstly, it calculates the element-wise product of the two matrix. Secondly, it calculates the sum of all the elements of the matrix returned in the first-step calculation. So I thought about two ways that would help. 

In the first way, I will transfer the two matrix to respective vectors. And then, I can use the "dot subroutine of vectors" in BLAS(MKL) directly. Considering some specific problems, I prefer matrix calculation to vector calculation. In the second and prefered way, I directly calculate the element-by-element product of the two matrix, and then sum up all the elements of resulting product matrix using the "sum subroutine".

However, I doubt if the two alternative solutions is most efficient, since the matrix are extremly large.

Any suggestions?


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>