/// <inheritdoc/> public override bool Add(int n, int m) { if (!matrix.Get1(n, m)) { return(false); } // fix the mapping matrix.MarkRow(n, -(n + 1)); matrix.Set1(n, m); // attempt to refine the mapping if (Refine(n)) { size = size + 1; m1[n] = m; m2[m] = n; return(true); } else { // mapping became invalid - unfix mapping matrix.ResetRows(n, -(n + 1)); return(false); } }
public void MarkRow() { CompatibilityMatrix m = new CompatibilityMatrix(5, 5); m.Set1(0, 1); m.Set1(0, 2); m.Set1(0, 4); Assert.IsTrue(Compares.AreEqual(new int[] { 0, 1, 1, 0, 1 }, m.Fix()[0])); m.MarkRow(0, -1); Assert.IsTrue(Compares.AreEqual(new int[] { 0, -1, -1, 0, -1 }, m.Fix()[0])); }