/// <summary> /// * operator, Multiply a 1D Matrix by a 1D Matrix /// </summary> /// <param name="a">The first 1D matrix</param> /// <param name="b">The second 1D matrix</param> /// <returns>result Matrix</returns> public static Matrix operator *(Matrix1D a, Matrix1D b) { if (a.values.Length == b.values.Length) { Matrix1D result = new Matrix1D(a.values.Length); for (int i = 0; i < a.values.Length; i++) { result.values[i] = a.values[i] * b.values[i]; } return(result); } else { Matrix2D result = new Matrix2D(a.values.Length, b.values.Length); for (int x = 0; x < a.values.Length; x++) { for (int y = 0; y < b.values.Length; y++) { result.values[x, y] = a.values[x] * b.values[y]; } } return(result); } }
/// <summary> /// * operator, Multiply a 1D Matrix by a float /// </summary> /// <param name="a">The 1D matrix</param> /// <param name="b">the float</param> /// <returns>result 1D Matrix</returns> public static Matrix1D operator *(Matrix1D a, float b) { Matrix1D result = new Matrix1D(a.values.Length); for (int i = 0; i < a.values.Length; i++) { result.values[i] = a.values[i] * b; } return(result); }