class BLAS {

	public static void gemm(double alpha, DenseMatrix matA, boolean transA, DenseMatrix matB, boolean transB,
							double beta, DenseMatrix matC) {
		if (transA) {
			Preconditions.checkArgument(matA.numCols() == matC.numRows(),
				"The columns of A does not match the rows of C");
		} else {
			Preconditions.checkArgument(matA.numRows() == matC.numRows(),
				"The rows of A does not match the rows of C");
		}
		if (transB) {
			Preconditions.checkArgument(matB.numRows() == matC.numCols(),
				"The rows of B does not match the columns of C");
		} else {
			Preconditions.checkArgument(matB.numCols() == matC.numCols(),
				"The columns of B does not match the columns of C");
		}

		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);
	}

}