Return True if all Mentions in the given candidate are from the same Row or Col.

    :param c: The candidate whose Mentions are being compared
    :rtype: boolean
198780
def is_tabular_aligned(c):
    
    return same_table(c) and (
        is_col_aligned(_to_span(c[i]).sentence, _to_span(c[0]).sentence)
        or is_row_aligned(_to_span(c[i]).sentence, _to_span(c[0]).sentence)
        for i in range(len(c))
    )
774039
def similarity(
        M_c, X_L_list, X_D_list, given_row_id, target_row_id,
        target_column=None):
    
    score = 0.0

    # Set col_idxs: defaults to all columns.
    if target_column:
        if type(target_column) == str:
            col_idxs = [M_c['name_to_idx'][target_column]]
        elif type(target_column) == list:
            col_idxs = target_column
        else:
            col_idxs = [target_column]
    else:
        col_idxs = M_c['idx_to_name'].keys()
    col_idxs = [int(col_idx) for col_idx in col_idxs]

    ## Iterate over all latent states.
    for X_L, X_D in zip(X_L_list, X_D_list):
        for col_idx in col_idxs:
            view_idx = X_L['column_partition']['assignments'][col_idx]
            if X_D[view_idx][given_row_id] == X_D[view_idx][target_row_id]:
                score += 1.0

    return score / (len(X_L_list)*len(col_idxs))
1278253
public static boolean sameClass(Class c, Object o) {
        if (o==null) return false;
        return o.getClass() == c;
    }
505947
def get_max_col_num(mention):
    
    span = _to_span(mention, idx=-1)
    if span.sentence.is_tabular():
        return span.sentence.cell.col_end
    else:
        return None
304075
def _same_elements_per_channel(x):
    
    eps = 1e-5
    dims = x.shape
    for c in range(dims[-1]):
        xc = x[:,:,c].flatten()
        if not np.all(np.absolute(xc - xc[0]) < eps):
            return False
    return True
573354
public boolean retainAll(Collection<?> c) {
		boolean modified = false;
		for (int i = 0; i < events.size(); i++) {
			try {
				if (c.contains(events.get(i)) == false) {
					events.remove(i);
					modified = true;
					i--;
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return modified;
	}
816925
def is_duplicate_of(self, other):
        """"""
        if super(Spectrum, self).is_duplicate_of(other):
            return True
        row_matches = 0
        for ri, row in enumerate(self.get(self._KEYS.DATA, [])):
            lambda1, flux1 = tuple(row[0:2])
            if (self._KEYS.DATA not in other or
                    ri > len(other[self._KEYS.DATA])):
                break
            lambda2, flux2 = tuple(other[self._KEYS.DATA][ri][0:2])
            minlambdalen = min(len(lambda1), len(lambda2))
            minfluxlen = min(len(flux1), len(flux2))
            if (lambda1[:minlambdalen + 1] == lambda2[:minlambdalen + 1] and
                    flux1[:minfluxlen + 1] == flux2[:minfluxlen + 1] and
                    float(flux1[:minfluxlen + 1]) != 0.0):
                row_matches += 1
            # Five row matches should be enough to be sure spectrum is a dupe.
            if row_matches >= 5:
                return True
            # Matches need to happen in the first 10 rows.
            if ri >= 10:
                break
        return False
301242
def row_includes_spans(table, row, spans):
    
    for column in range(len(table[row])):
        for span in spans:
            if [row, column] in span:
                return True
    return False
875551
def _is_duplicate_record(self, rtype, name, content):
        """"""
        records = self._list_records(rtype, name, content)
        is_duplicate = len(records) >= 1
        if is_duplicate:
            LOGGER.info('Duplicate record %s %s %s, NOOP', rtype, name, content)
        return is_duplicate
476480
public static int cusparseScsr2dense(
        cusparseHandle handle, 
        int m, 
        int n, 
        cusparseMatDescr descrA, 
        Pointer csrSortedValA, 
        Pointer csrSortedRowPtrA, 
        Pointer csrSortedColIndA, 
        Pointer A, 
        int lda)
    {
        return checkResult(cusparseScsr2denseNative(handle, m, n, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, A, lda));
    }
624788
def apply(self, mentions):
        
        seen_spans = set()
        for m in mentions:
            if self.f(m) and (
                not self.longest_match_only
                or not any([self._is_subspan(m, s) for s in seen_spans])
            ):
                if self.longest_match_only:
                    seen_spans.add(self._get_span(m))
                yield m
623978
public static boolean compareCursors(Cursor c1, Cursor c2) {
        if (c1 == null || c2 == null) {
            return false;
        }

        int numColumns = c1.getColumnCount();
        if (numColumns != c2.getColumnCount()) {
            return false;
        }

        if (c1.getCount() != c2.getCount()) {
            return false;
        }

        c1.moveToPosition(-1);
        c2.moveToPosition(-1);
        while (c1.moveToNext() && c2.moveToNext()) {
            for (int i = 0; i < numColumns; i++) {
                if (!TextUtils.equals(c1.getString(i), c2.getString(i))) {
                    return false;
                }
            }
        }

        return true;
    }
624393
public static boolean checkIndicesSorted( DMatrixSparseCSC A ) {
        for (int j = 0; j < A.numCols; j++) {
            int idx0 = A.col_idx[j];
            int idx1 = A.col_idx[j+1];

            if( idx0 != idx1 && A.nz_rows[idx0] >= A.numRows )
                return false;

            for (int i = idx0+1; i < idx1; i++) {
                int row = A.nz_rows[i];
                if( A.nz_rows[i-1] >= row)
                    return false;
                if( row >= A.numRows )
                    return false;
            }
        }
        return true;
    }
580285
private boolean existsStrongerInColumn(INode source, INode target) {
        boolean result = false;

        char current = defautlMappings.getRelation(source, target);

        //compare with the other relations in the column
        for (INode i : defautlMappings.getSourceContext().getNodesList()) {
            if (i != source && defautlMappings.getRelation(i, target) != IMappingElement.IDK
                    && isPrecedent(defautlMappings.getRelation(i, target), current)) {
                result = true;
                break;
            }
        }

        return result;
    }
794484
def get_mentions(self, min_lp=None):
        '''
        
        '''
        return (m for m in self.mentions if min_lp is None or m.linkprob > min_lp)
169864
public boolean matchMiddle(char[] chars, int start, int end) {
    if (midClauses == null)
      return true;
    int[] cursor = new int[] {start, end};
    for (int i = 0; i < midClauses.length; i++) {
      Clause clause = midClauses[i];
      if (!find(clause, chars, cursor))
        return false;
    }
    return true;
  }
75595
public boolean contains(char c) {
        for (int k = pos; k < len; k++) {
            if (chars[k] == c) return true;
        }
        return false;
    }