/// <summary> /// /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="operation"></param> /// <returns></returns> public static float[][] ElementWiseOperation(float[][] a, float[][] b, ElementWiseOperation operation) { if (!MatrixCompare.SameSize(a, b)) { throw new ArgumentException("Matrices are not of same size."); } float[][] y = CreateMatrix(Rows(a), Columns(b)); for (int i = 0; i < Rows(y); i++) { y[i] = VectorMath.ElementWiseOperation(a[i], b[i], operation); } return(y); }
/// <summary> /// Element-wise subtraction. /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> public static float[][] Subtract(float[][] a, float[][] b) { if (!MatrixCompare.SameSize(a, b)) { throw new ArgumentException("Matrices are not of same size."); } float[][] y = CreateMatrix(Rows(a), Columns(a)); for (int i = 0; i < Rows(y); i++) { y[i] = VectorMath.Subtract(Row(a, i), Row(b, i)); } return(y); }