public static double max(Vector column) { double max = -Double.MAX_VALUE; for (VectorEntry vectorEntry : column) { max = Math.max(max, vectorEntry.getValue()); } return max; }
public static double min(Vector column) { double min = Double.MAX_VALUE; for (VectorEntry vectorEntry : column) { min = Math.min(min, vectorEntry.getValue()); } return min; }
public Set<IndexedTermSimilarityRelation> relationsTo(final IndexedTerm target) { final int targetIndex = target.getIndex(); final LinkedHashSet<IndexedTermSimilarityRelation> result = new LinkedHashSet<IndexedTermSimilarityRelation>(); // Walk the columns of the matrix to get the relation. for (VectorEntry entry : this.similarities.getColumn(targetIndex)) { final double similarity = entry.getValue(); if (similarity != 0.0) { final IndexedTerm source = this.termIndex.getIndexedTerm(entry.getIndex()); result.add(new IndexedTermSimilarityRelation(source, target, similarity)); } // else - We ignore zero similarities. } return result; }