Is there a way to compute the weighted vector inner product xAy with vectors x and y and Matrix A using BLAS/LAPACK while avoiding additional allocations or overwriting the inputs?
I'm happy with answers that assume A is symmetric or x=y.
The product $x^TAy$ can be calculated as:
$\sum_{i}\sum_j x_i A_{i,j} y_j$.
Easily implemented as a double for loop. You can additionally avoid a few flops by doing either:
$\sum_{i}x_i \sum_j A_{i,j} y_j$ or
$\sum_{j}y_j\sum_i x_i A_{i,j} $.
You asked to use BLAS, but note that this is a level 2 BLAS routine, which is not actually that much faster than two for/do loops. Some exceptions:
I am not aware of this functionality currently existing in BLAS.