Class ExchangeWeigher

java.lang.Object
it.unimi.dsi.law.big.util.ExchangeWeigher

public class ExchangeWeigher
extends Object
Computes the weight of discordances using a generalisation of Knight's algorithm.
  • Constructor Details

    • ExchangeWeigher

      public ExchangeWeigher​(Long2DoubleFunction weigher, long[][] perm, double[][] v, long[][] rank, boolean multiplicative, long[][] support)
      Creates a new exchange weigher.
      Parameters:
      weigher - the function used to weight indices.
      perm - the big array to be sorted.
      v - the score big vector used to compare the element of perm.
      rank - a rank on the indices.
      multiplicative - whether to combine weights multiplicatively, rather than additively, which is the default.
      support - a big array that will be used as temporary storage during the computation; its content will be erased, and it must be at least as long as perm. If null, it will be allocated.
  • Method Details

    • weigh

      public double weigh()
      Computes the weight of exchanges for the current data.

      Note that a call to this method will actually order the big array provided at creation time using the comparator provided at creation time; thus, subsequent calls will always return 1.

      Returns:
      the weight of exchanges that will order the vector provided at creation time using the comparator provided at creation time.