/// <summary> /// Checks if given object is equal to this matrix. The method returns false whenever the given object is not a matrix over GF(2^m) /// </summary> /// /// <param name="Obj">The object to compare to this</param> /// /// <returns>Returns <c>true</c> if the object is equal</returns> public override bool Equals(Object Obj) { if (Obj == null || !(Obj is GF2mMatrix)) { return(false); } GF2mMatrix otherMatrix = (GF2mMatrix)Obj; if ((!this.FieldG.Equals(otherMatrix.FieldG)) || (otherMatrix.RowCount != this.ColumnCount) || (otherMatrix.ColumnCount != this.ColumnCount)) { return(false); } for (int i = 0; i < this.RowCount; i++) { for (int j = 0; j < this.ColumnCount; j++) { if (this.MatrixN[i][j] != otherMatrix.MatrixN[i][j]) { return(false); } } } return(true); }
/// <summary> /// Create an instance using values from another GF2mMatrix instance /// </summary> /// /// <param name="G">The GF2mMatrix instance</param> public GF2mMatrix(GF2mMatrix G) { RowCount = G.RowCount; ColumnCount = G.ColumnCount; FieldG = G.FieldG; MatrixN = new int[RowCount][]; for (int i = 0; i < RowCount; i++) { MatrixN[i] = IntUtils.DeepCopy(G.MatrixN[i]); } }