org.encog.util
Class EngineArray

java.lang.Object
  extended by org.encog.util.EngineArray

public final class EngineArray
extends Object

Some array functions used by Encog.


Method Summary
static double[] add(double[] d, double[] m)
           
static void arrayAdd(double[][] target, double[][] h)
           
static byte[] arrayCopy(byte[] input)
          Copy a byte array.
static void arrayCopy(byte[] source, int sourcePos, byte[] target, int targetPos, int length)
           
static double[] arrayCopy(double[] input)
          Copy a double array.
static double[][] arrayCopy(double[][] source)
          Copy a 2D double array.
static void arrayCopy(double[] src, double[] dst)
          Completely copy one array into another.
static void arrayCopy(double[] source, float[] target)
          Copy an array of floats to an array of doubles.
static void arrayCopy(double[] source, int sourcePos, double[] target, int targetPos, int length)
          Copy an array of doubles.
static void arrayCopy(float[] source, double[] target)
          Copy an array of floats to an array of doubles.
static int[] arrayCopy(int[] input)
          Copy an int array.
static void arrayCopy(int[] src, int[] dst)
          Completely copy one array into another.
static void arrayCopy(int[] source, int sourcePos, int[] target, int targetPos, int length)
           
static boolean contains(int[] array, int target)
           
static Double[] doubleToObject(double[] array)
          Convert an array of double primitives to Double objects.
static double euclideanDistance(double[] p1, double[] p2)
           
static void fill(boolean[] a, boolean b)
           
static void fill(double[][] sigma, int value)
           
static void fill(double[] array, double value)
          Fill a double array.
static void fill(float[] array, float value)
          Fill a float array.
static void fill(int[] a, int value)
           
static int findStringInArray(String[] search, String searchFor)
          Search for a string in an array.
static int indexOfLargest(double[] data)
           
static double[] listToDouble(Collection<?> list)
          Convert the collection to an array list of doubles.
static double max(double[] weights)
           
static int max(int[] data)
           
static int maxIndex(double[] data)
           
static int maxIndex(int[] data)
           
static double mean(double[] data)
           
static double mean(int[] data)
           
static double min(double[] weights)
           
static int min(int[] data)
           
static double[] objectToDouble(Double[] array)
          Convert an array of Double objects to double primitives.
static String replace(String str, String searchFor, String replace)
           
static double sdev(int[] data)
           
static double[] subtract(double[] a, double[] b)
           
static double vectorProduct(double[] a, double[] b)
          Calculate the product of two vectors (a scalar value).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

arrayCopy

public static double[] arrayCopy(double[] input)
Copy a double array.

Parameters:
input - The array to copy.
Returns:
The result of the copy.

arrayCopy

public static byte[] arrayCopy(byte[] input)
Copy a byte array.

Parameters:
input - The array to copy.
Returns:
The result of the copy.

arrayCopy

public static void arrayCopy(double[] src,
                             double[] dst)
Completely copy one array into another.

Parameters:
src - Source array.
dst - Destination array.

arrayCopy

public static void arrayCopy(double[] source,
                             float[] target)
Copy an array of floats to an array of doubles.

Parameters:
source - The source array.
target - The target array.

arrayCopy

public static void arrayCopy(double[] source,
                             int sourcePos,
                             double[] target,
                             int targetPos,
                             int length)
Copy an array of doubles.

Parameters:
source - The source.
sourcePos - The source index.
target - The target.
targetPos - The target index.
length - The length.

arrayCopy

public static double[][] arrayCopy(double[][] source)
Copy a 2D double array.

Parameters:
source - The source.
Returns:
The copied array.

arrayCopy

public static void arrayCopy(float[] source,
                             double[] target)
Copy an array of floats to an array of doubles.

Parameters:
source - The source array.
target - The target array.

arrayCopy

public static int[] arrayCopy(int[] input)
Copy an int array.

Parameters:
input - The array to copy.
Returns:
The result of the copy.

arrayCopy

public static void arrayCopy(int[] src,
                             int[] dst)
Completely copy one array into another.

Parameters:
src - Source array.
dst - Destination array.

doubleToObject

public static Double[] doubleToObject(double[] array)
Convert an array of double primitives to Double objects.

Parameters:
array - The primitive array.
Returns:
The object array.

fill

public static void fill(double[] array,
                        double value)
Fill a double array.

Parameters:
array - The array to fill.
value - What to fill the array with.

fill

public static void fill(float[] array,
                        float value)
Fill a float array.

Parameters:
array - The array to fill.
value - What to fill the array with.

findStringInArray

public static int findStringInArray(String[] search,
                                    String searchFor)
Search for a string in an array.

Parameters:
search - Where to search.
searchFor - What we are looking for.
Returns:
The index that the string occurs at.

listToDouble

public static double[] listToDouble(Collection<?> list)
Convert the collection to an array list of doubles.

Parameters:
list - The list to convert.
Returns:
The array of doubles.

objectToDouble

public static double[] objectToDouble(Double[] array)
Convert an array of Double objects to double primitives.

Parameters:
array - An array of Double objects.
Returns:
An array of double primitives.

vectorProduct

public static double vectorProduct(double[] a,
                                   double[] b)
Calculate the product of two vectors (a scalar value).

Parameters:
a - First vector to multiply.
b - Second vector to multiply.
Returns:
The product of the two vectors (a scalar value).

indexOfLargest

public static int indexOfLargest(double[] data)

min

public static double min(double[] weights)

max

public static double max(double[] weights)

contains

public static boolean contains(int[] array,
                               int target)

maxIndex

public static int maxIndex(double[] data)

maxIndex

public static int maxIndex(int[] data)

max

public static int max(int[] data)

min

public static int min(int[] data)

mean

public static double mean(int[] data)

sdev

public static double sdev(int[] data)

euclideanDistance

public static double euclideanDistance(double[] p1,
                                       double[] p2)

fill

public static void fill(double[][] sigma,
                        int value)

fill

public static void fill(boolean[] a,
                        boolean b)

add

public static double[] add(double[] d,
                           double[] m)

subtract

public static double[] subtract(double[] a,
                                double[] b)

mean

public static double mean(double[] data)

fill

public static void fill(int[] a,
                        int value)

replace

public static String replace(String str,
                             String searchFor,
                             String replace)

arrayCopy

public static void arrayCopy(byte[] source,
                             int sourcePos,
                             byte[] target,
                             int targetPos,
                             int length)

arrayCopy

public static void arrayCopy(int[] source,
                             int sourcePos,
                             int[] target,
                             int targetPos,
                             int length)

arrayAdd

public static void arrayAdd(double[][] target,
                            double[][] h)


Copyright © 2014. All Rights Reserved.