My fortran code contains lines like the followinginteger, parameter :: dbp = kind(1.0d0)integer, parameter :: n = 1 000 000real(dbp) :: x(n), y(n), z(n)y(:) = x(:) * z(:)I would like to take advantage (if possible) of some optimised maths libraries to carry out this operation. I have found a lapack routine dgbmv which multiplies a matrix by a vector. This would suit my needs if I create a diagonal matrix such that$$\left( \begin{array}{c} y_1 \\ y_2 \\ \vdots \\ y_n \end{array} \right) = \left( \begin{array}{ccc}x_1 &  &  &  &   \\ & x_2 &  &  &    \\ &  & \ddots &  &   \\ &  &  & x_n &     \\\end{array} \right)\left( \begin{array}{c} z_1 \\ z_2 \\ \vdots \\ z_n\end{array} \right)$$But I don't know if this is the best way to go about calculating x(:)*z(:). Is there a more appropriate way?
What's the fastest implementation of elementwise vector multiplication in Fortran?
linear algebra;lapack