Does Matlab Take Full Advantage of the BLAS Routines?

It’s my understanding that Matlab uses BLAS routines under the hood for many matrix algebra operations. Is that correct?
If so, how does Matlab handle an expression like
C = alpha*A’*B’ + beta*C
where A, B, and C are double, real matrices of compatible dimensions and alpha and beta are real scalars?
This assignment can be handled with a single call to LAPACK: dgemm. Is that what Matlab does? Or is the right hand side evaluated with a sequence of calls to @doc:mtimes and @doc:plus?
Based on this discussion I don’t expect either transpose to be formed explicitly. Now I’m wondering about just how far the parser can take such optimizations to minimimize temporary storage and the number of operations, and the impact of such optimization on the documented order of operations.It’s my understanding that Matlab uses BLAS routines under the hood for many matrix algebra operations. Is that correct?
If so, how does Matlab handle an expression like
C = alpha*A’*B’ + beta*C
where A, B, and C are double, real matrices of compatible dimensions and alpha and beta are real scalars?
This assignment can be handled with a single call to LAPACK: dgemm. Is that what Matlab does? Or is the right hand side evaluated with a sequence of calls to @doc:mtimes and @doc:plus?
Based on this discussion I don’t expect either transpose to be formed explicitly. Now I’m wondering about just how far the parser can take such optimizations to minimimize temporary storage and the number of operations, and the impact of such optimization on the documented order of operations. It’s my understanding that Matlab uses BLAS routines under the hood for many matrix algebra operations. Is that correct?
If so, how does Matlab handle an expression like
C = alpha*A’*B’ + beta*C
where A, B, and C are double, real matrices of compatible dimensions and alpha and beta are real scalars?
This assignment can be handled with a single call to LAPACK: dgemm. Is that what Matlab does? Or is the right hand side evaluated with a sequence of calls to @doc:mtimes and @doc:plus?
Based on this discussion I don’t expect either transpose to be formed explicitly. Now I’m wondering about just how far the parser can take such optimizations to minimimize temporary storage and the number of operations, and the impact of such optimization on the documented order of operations. blas, optimization MATLAB Answers — New Questions

​

Leave a Reply

Your email address will not be published. Required fields are marked *