/** * This {@code SparseBinaryMatrix} will contain the operation of or-ing * the inputMatrix with the contents of this matrix; returning this matrix * as the result. * * @param inputMatrix the matrix containing the "on" bits to or * @return this matrix */ public AbstractSparseBinaryMatrix Or(AbstractSparseBinaryMatrix inputMatrix) { int[] mask = inputMatrix.GetSparseIndices(); int[] ones = new int[mask.Length]; Arrays.Fill(ones, 1); return(Set(mask, ones)); }
/** * Returns true if any of the on bits of the specified matrix are * matched by the on bits of this matrix. It is allowed that * this matrix have more on bits than the specified matrix. * * @param matrix * @return */ public bool Any(AbstractSparseBinaryMatrix matrix) { HashSet <int> keySet = GetSparseSet(); foreach (int i in matrix.GetSparseIndices()) { if (keySet.Contains(i)) { return(true); } } return(false); }
/** * Returns true if the on bits of the specified matrix are * matched by the on bits of this matrix. It is allowed that * this matrix have more on bits than the specified matrix. * * @param matrix * @return */ public bool All(AbstractSparseBinaryMatrix matrix) { return(ContainsAll(GetSparseSet(), matrix.GetSparseIndices())); //return GetSparseSet().SetEquals(matrix.GetSparseIndices()); }