org.apache.mahout.df.data
Class DataUtils

java.lang.Object
  extended by org.apache.mahout.df.data.DataUtils

public class DataUtils
extends java.lang.Object

Helper methods that deals with data lists and arrays of values


Method Summary
static void add(int[] array1, int[] array2)
          foreach i : array1[i] += array2[i]
static void dec(int[] array1, int[] array2)
          foreach i : array1[i] -= array2[i]
static int maxindex(java.util.Random rng, int[] values)
          return the index of the maximum of the array, breaking ties randomly
static int sum(int[] values)
          Computes the sum of the values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sum

public static int sum(int[] values)
Computes the sum of the values

Parameters:
values -
Returns:

add

public static void add(int[] array1,
                       int[] array2)
foreach i : array1[i] += array2[i]

Parameters:
array1 -
array2 -

dec

public static void dec(int[] array1,
                       int[] array2)
foreach i : array1[i] -= array2[i]

Parameters:
array1 -
array2 -

maxindex

public static int maxindex(java.util.Random rng,
                           int[] values)
return the index of the maximum of the array, breaking ties randomly

Parameters:
rng - used to break ties
values -
Returns:
index of the maximum


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