/// <summary> /// Объединение матриц /// </summary> /// <param name="matrix"></param> /// <returns></returns> private BoolMatrix Union(BoolMatrix matrix) { var result = new BoolMatrix(this); foreach (var bv in matrix) { result.Add(bv); } if (result.Count > 1) { result.Absorption(); } return(result.Bonding()); }
/// <summary> /// Гамма-преобразование над матрицей /// </summary> /// <returns></returns> public BoolMatrix GammaConvertion() { var n = this[0].Count; var A = new BoolMatrix(this); var A0 = new BoolMatrix(); var A1 = new BoolMatrix(); for (var i = 0; i < n; i++) { A0 = new BoolMatrix(A.Where(item => item[i].Value == "0" || item[i].Value == "-")); A1 = new BoolMatrix(A.Where(item => item[i].Value == "1" || item[i].Value == "-")); var Ai = new BoolMatrix(); for (int j = 0; j < A0.Count; j++) { A0[j][i] = new MatrixValue("0"); } for (int j = 0; j < A1.Count; j++) { A1[j][i] = new MatrixValue("1"); } for (int j = 0; j < A0.Count; j++) { var temp = new BoolVector(A0[j]); temp[i] = new MatrixValue("1"); Ai.Add(temp); } A0 = A0.Bonding(); A1 = A1.Bonding(); Ai = Ai.Bonding(); var t0 = A1.Substraction(Ai); var t1 = Ai.Substraction(A1); var t2 = A0.Union(t0); var t3 = t2.Union(t1); t3 = t3.Bonding(); A = new BoolMatrix(t3); } return(new BoolMatrix(A)); }