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?