DPJRuntime
Class DPJUtils

java.lang.Object
  extended by DPJRuntime.DPJUtils

public class DPJUtils
extends java.lang.Object

This class provides various utility methods for DPJ.


Constructor Summary
DPJUtils()
           
 
Method Summary
static int log2(int x)
          Quickly computes the floor of the base 2 log of x.
static
<type T,region R>
void
permute(T[]<R> A)
          Randomly permutes array A
static
<region R> void
permuteInt(int[]<R> A)
          Randomly permutes integer array A
static
<type T,region R>
void
swap(T[]<R> A, int i, int j)
          Swaps the values at indices i and j of array A.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DPJUtils

public DPJUtils()
         [unknown]
Method Detail

log2

public static int log2(int x)
                pure
Quickly computes the floor of the base 2 log of x.

Parameters:
x - Input
Returns:
Floor of base 2 log of x

swap

public static <type T,region R> void swap(T[]<R> A,
                                          int i,
                                          int j)
                 writes R
Swaps the values at indices i and j of array A.

Type Parameters:
T - Element type of array A
R - Region of array A
Parameters:
i - First index of values to swap
j - Second index of values to swap

permute

public static <type T,region R> void permute(T[]<R> A)
                    writes Root : *
Randomly permutes array A

Type Parameters:
T - Element type of array A
R - Region of array A
Parameters:
A - Array to permute

permuteInt

public static <region R> void permuteInt(int[]<R> A)
                       writes Root : *
Randomly permutes integer array A

Type Parameters:
R - Region of array A
Parameters:
A - Integer array to permute