I need to know if there is some function in BLAS/LAPACK or some other Scientific Library that returns a non absolute sum of a vector/matrix.
I've found the 'asum', but it returns only the absolute sum.
Thank you.
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It only takes a minute to sign up.
Sign up to join this communityThere's nothing in BLAS or LAPACK that does this directly. You could use the dot product function in the BLAS to take the dot product of your vector and a vector of all 1's. However, it's probably more efficient to just write your own loop to compute the sum- this operation doesn't allow for any cache reuse so most compilers should be able to optimize the code to very nearly the highest possible performance. In any case, it's unlikely that your code is spending much of its time computing such sums.