Class SortVectorMatLab
java.lang.Object
solvers.basis.comparators.SortVectorMatLab
- All Implemented Interfaces:
Comparator<EnhancedVector>
A comparator to sort an array of Enhanced Vectors, to be used by Basis objects.
Sorts in the order used in the MatLab implementation.
- Author:
- Jack Bradshaw
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(EnhancedVector v1, EnhancedVector v2) Compares two PopulationChangeVector objects according to the same order as in the MatLab implementation First vectors are compared at the number of non zero elements (h) Then the position of those elements Then the value at those positions, left to right leftmost non-zero is the smaller.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
SortVectorMatLab
public SortVectorMatLab()
-
-
Method Details
-
compare
Compares two PopulationChangeVector objects according to the same order as in the MatLab implementation First vectors are compared at the number of non zero elements (h) Then the position of those elements Then the value at those positions, left to right leftmost non-zero is the smaller.- Specified by:
comparein interfaceComparator<EnhancedVector>- Parameters:
v1- the first vector to comparev2- the second vector to compare- Returns:
- -1 if this < o, 0 if this = o, 1 if this > o
-