public Mat(int rowCount, int colCount) { var collection = new VecCollection(colCount); for (int i = 0; i < rowCount; i++) { collection.Add(new Vec(colCount)); } Size = new MatSize(collection); Collection = collection; }
public static Mat operator -(Mat m1, Mat m2) { if (m1.Size != m2.Size) throw new OverflowException("Can't increment 2 different sized matrices."); var resCollection = new VecCollection(m1.Size.ColumnCount); for (int i = 0; i < m1.Size.RowCount; i++) { var vec = new Vec(m1.Size.ColumnCount); for (int j = 0; j < m1.Size.ColumnCount; j++) { vec[j] = m1[i][j] +- m2[i][j]; } resCollection.Add(vec); } return new Mat(resCollection); }