org.apache.mahout.math
Class GenericPermuting

java.lang.Object
  extended by org.apache.mahout.math.GenericPermuting

Deprecated. until unit tests are in place. Until this time, this class/interface is unsupported.

@Deprecated
public class GenericPermuting
extends java.lang.Object


Method Summary
static void permute(int[] indexes, org.apache.mahout.math.Swapper swapper, int[] work1, int[] work2)
          Deprecated. Generically reorders arbitrary shaped generic data g such that g[i] == g[indexes[i]].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

permute

public static void permute(int[] indexes,
                           org.apache.mahout.math.Swapper swapper,
                           int[] work1,
                           int[] work2)
Deprecated. 
Generically reorders arbitrary shaped generic data g such that g[i] == g[indexes[i]]. (The generic data may be one array, a 2-d matrix, two linked lists or whatever). This class swaps elements around, in a way that avoids stumbling over its own feet.

Example:

 Reordering
 [A,B,C,D,E] with indexes [0,4,2,3,1] yields
 [A,E,C,D,B]
 In other words g[0]<--g[0], g[1]<--g[4], g[2]<--g[2], g[3]<--g[3], g[4]<--g[1].

 Reordering
 [A,B,C,D,E] with indexes [0,4,1,2,3] yields
 [A,E,B,C,D]
 In other words g[0]<--g[0], g[1]<--g[4], g[2]<--g[1], g[3]<--g[2], g[4]<--g[3].
 

Parameters:
indexes - the permutation indexes.
swapper - an object that knows how to swap two indexes a,b.
work1 - some working storage, must satisfy work1.length >= indexes.length; set work1==null if you don't care about performance.
work2 - some working storage, must satisfy work2.length >= indexes.length; set work2==null if you don't care about performance.


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.