/// <summary> /// Compute C = alpha * op(A) * op(B) + beta * C. /// </summary> /// <param name="c"></param> /// <param name="trans1"></param> /// <param name="transB"></param> /// <param name="alpha"></param> /// <param name="a"></param> /// <param name="b"></param> /// <param name="beta"></param> public static void ComputeDGem(this Matrix <double> c, TransOp transA, TransOp transB, double alpha, Matrix <double> a, Matrix <double> b, double beta) { a = Transform(a, transA); b = Transform(b, transB); var newResult = a.Multiply(alpha).Multiply(b).Add(c.Multiply(beta)); newResult.CopyTo(c); }
private static Matrix <double> Transform(Matrix <double> matrix, TransOp op) { switch (op) { case TransOp.CblasNoTrans: return(matrix); case TransOp.CblasTrans: return(matrix.Transpose()); case TransOp.CblasConjTrans: return(matrix.ConjugateTranspose()); } return(null); }