You can create a wrapper for cblas_sgemm function that transposes the input matrices by using the cblas_sgemm function itself along with the cblasTranspose argument. Here is an example implementation of the wrapper function:
main.swift1096 chars28 linesIn this implementation, we first create two temporary arrays transposedA and transposedB to store the transpose of matrices A and B, respectively. Then, we use vDSP_mtrans function from the Accelerate framework to perform the transpose operation on these arrays.
Finally, we call cblas_sgemm with the transposed matrices transposedA and transposedB and the other arguments passed to the function. The transA and transB arguments of cblas_sgemm are set according to the transA and transB arguments passed to our wrapper function.
You can use the wrapper function as follows:
main.swift388 chars16 linesgistlibby LogSnag