2
$\begingroup$

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.

$\endgroup$
3
$\begingroup$

There'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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.