Class SortVectorByRightmostNZ

java.lang.Object
solvers.basis.comparators.SortVectorByRightmostNZ
All Implemented Interfaces:
Comparator<EnhancedVector>

public class SortVectorByRightmostNZ extends Object implements Comparator<EnhancedVector>
A comparator to sort an array of Enhanced Vectors, to be used by Basis objects.
Author:
Jack Bradshaw
  • Constructor Details

    • SortVectorByRightmostNZ

      public SortVectorByRightmostNZ()
  • Method Details

    • compare

      public int compare(EnhancedVector v1, EnhancedVector v2)
      Compares two PopulationChangeVector objects. First vector are compared according to the position of their rightmost non-zero element Then the number of non zero elements (h) Then the value at the non-zero positions, left to right
      Specified by:
      compare in interface Comparator<EnhancedVector>
      Parameters:
      v1 - , v2 The PopulationChangeVectors to be compared.
      v2 - the v2 parameter
      Returns:
      -1 if this < o, 0 if this = o, 1 if this > o