class BLAS {

    public static void gemm(double alpha, DenseMatrix matA, boolean transA, DenseMatrix matB, boolean transB,
                            double beta, DenseMatrix matC) {
        int ma = transA ? matA.n : matA.m;
        int na = transA ? matA.m : matA.n;
        int mb = transB ? matB.n : matB.m;
        int nb = transB ? matB.m : matB.n;
        Preconditions.checkArgument(na == mb && ma == matC.m && nb == matC.n, "matrix size mismatched.");

        final int m = matC.numRows();
        final int n = matC.numCols();
        final int k = transA ? matA.numRows() : matA.numCols();
        final int lda = matA.numRows();
        final int ldb = matB.numRows();
        final int ldc = matC.numRows();
        final String ta = transA ? "T" : "N";
        final String tb = transB ? "T" : "N";
        NATIVE_BLAS.dgemm(ta, tb, m, n, k, alpha, matA.getData(), lda, matB.getData(), ldb, beta, matC.getData(), ldc);
    }

}