BLAS DGEMM: Can I pass C as A or B?

blas, fortran, lapack

Solution

No, you can never do this and it has nothing to do with the BLAS implementation. See

Is it safe to pass GEMV the same output- as input vector to achieve a destructive matrix application?

Problem

I want to perform a string of matrix multiplies, and would prefer not allocate a fresh matrix if I can avoid it. For example, I want to compute C = C * B (so I pass in C as `A` and `C`) Can I do this (due to `dgemm` having marked both `A` and `B` as `in` variables)?

Original source