Here's a code snippet that shows how to create a wrapper for cblas_sgemm
in Swift:
main.swift342 chars10 lines
This function takes two matrices A
and B
as flat arrays of floats, along with their dimensions m
, n
, and k
, and returns their product as a flat array of floats C
. The cblas_sgemm
call is the core of the function: it performs the matrix multiplication by passing in the matrices, their dimensions, scaling values, and pointers to the output matrix. The CblasRowMajor
and CblasNoTrans
arguments indicate that the matrices are in row-major order and should not be transposed.
gistlibby LogSnag