Steven Lu
Steven Lu

Reputation: 43457

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

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)?

Upvotes: 5

Views: 1550

Answers (2)

Ian Bush
Ian Bush

Reputation: 7432

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?

Upvotes: 4

talonmies
talonmies

Reputation: 72349

None of the BLAS implementations I have even used had a dgemm which could work in-place.

Upvotes: 4

Related Questions