public Matrix From(float[] source, bool rowMajor) { Matrix m = new Matrix(); if (rowMajor) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { m.Set(i, j, source[i * 3 + j]); } } } else { for (int j_0 = 0; j_0 < 3; j_0++) { for (int i_1 = 0; i_1 < 3; i_1++) { m.Set(i_1, j_0, source[j_0 * 3 + i_1]); } } } return(this); }
public static Matrix Avg(ICollection<Matrix> set) { Matrix average = new Matrix(); average.Set(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f); float hist = 0; foreach (Matrix matrix3d in set) { if (matrix3d.IsFloatValid()) { average.Add(matrix3d); hist++; } } average.Mul(1f / hist); return average; }
public static Matrix Avg(ICollection <Matrix> set) { Matrix average = new Matrix(); average.Set(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f); float hist = 0; foreach (Matrix matrix3d in set) { if (matrix3d.IsFloatValid()) { average.Add(matrix3d); hist++; } } average.Mul(1f / hist); return(average); }
public Matrix From(float[] source, bool rowMajor) { Matrix m = new Matrix(); if (rowMajor) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { m.Set(i, j, source[i * 3 + j]); } } } else { for (int j_0 = 0; j_0 < 3; j_0++) { for (int i_1 = 0; i_1 < 3; i_1++) { m.Set(i_1, j_0, source[j_0 * 3 + i_1]); } } } return this; }