org.retro.neural
Class DoubleFactory

java.lang.Object
  extended byorg.retro.neural.LinAlgFactory
      extended byorg.retro.neural.DoubleFactory

public class DoubleFactory
extends LinAlgFactory


Constructor Summary
DoubleFactory()
           
 
Method Summary
static Matrix buildMatrix(double[][] theValues)
           
static Vector buildVector(double[] theValues)
           
static double doubleValue(FieldElement d)
          Returns the double-precision floating-point value in a FieldElement.
static double doubleValue(Matrix a, int i, int j)
          Returns the I,Jth double-precision floating-point value in a Matrix.
static double doubleValue(Vector x, int i)
          Returns the Ith double-precision floating-point value in a Vector.
static double[][] doubleValues(Matrix theMatrix)
          Returns an array of double-precision floating-point values contained in a Matrix.
static double[] doubleValues(Vector theVector)
          Returns an array of double-precision floating-point values contained in a Vector.
static double eucDist(Vector x, Vector y)
          Returns the Euclidean distance between two Vectors.
 Vector gaussianNoise(int length)
          Returns a Vector of normally distributed random values.
 Matrix gaussianNoise(int numberOfRows, int numberOfCols)
           
 Matrix gaussianNoise(int numberOfRows, int numberOfCols, long seed)
           
 Matrix gaussianNoise(int numberOfRows, int numberOfCols, java.util.Random random)
           
 Vector gaussianNoise(int length, long seed)
          Returns a Vector of normally distributed random values.
 Vector gaussianNoise(int length, java.util.Random random)
           
static double L2Norm(Vector x)
          Returns the L2 norm of a vector
 FieldElement randomValue(java.util.Random random)
          Returns a random value.
 FieldElement unityValue()
          Returns a FieldElement corresponding to unity (1), the neutral element of multiplication.
 FieldElement zeroValue()
          Returns a FieldElement corresponding to zero (0), the neutral element of addition.
 
Methods inherited from class org.retro.neural.LinAlgFactory
identity, ones, ones, uniformNoise, uniformNoise, uniformNoise, uniformNoise, uniformNoise, uniformNoise, zeros, zeros
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleFactory

public DoubleFactory()
Method Detail

buildMatrix

public static Matrix buildMatrix(double[][] theValues)
                          throws InvalidOperationException
Throws:
InvalidOperationException

buildVector

public static Vector buildVector(double[] theValues)
                          throws InvalidOperationException
Throws:
InvalidOperationException

gaussianNoise

public Matrix gaussianNoise(int numberOfRows,
                            int numberOfCols,
                            java.util.Random random)

gaussianNoise

public Matrix gaussianNoise(int numberOfRows,
                            int numberOfCols,
                            long seed)

gaussianNoise

public Matrix gaussianNoise(int numberOfRows,
                            int numberOfCols)

gaussianNoise

public Vector gaussianNoise(int length,
                            java.util.Random random)

gaussianNoise

public Vector gaussianNoise(int length,
                            long seed)
Returns a Vector of normally distributed random values. Values are taken from a Gaussian distribution with zero mean and standard deviation one.

Parameters:
length -
seed - seed for random-number generator
Returns:
Vector of normally distributed random values

gaussianNoise

public Vector gaussianNoise(int length)
Returns a Vector of normally distributed random values. Values are taken from a Gaussian distribution with zero mean and standard deviation one.

Parameters:
length -
Returns:
Vector of normally distributed random values

doubleValues

public static double[][] doubleValues(Matrix theMatrix)
                               throws InvalidOperationException
Returns an array of double-precision floating-point values contained in a Matrix.

Parameters:
theMatrix -
Returns:
2D array of double
Throws:
InvalidOperationException - if theMatrix does not contain doubles

doubleValues

public static double[] doubleValues(Vector theVector)
                             throws InvalidOperationException
Returns an array of double-precision floating-point values contained in a Vector.

Parameters:
theVector -
Returns:
1D array of double
Throws:
InvalidOperationException - if theVector does not contain doubles

eucDist

public static double eucDist(Vector x,
                             Vector y)
                      throws InvalidOperationException
Returns the Euclidean distance between two Vectors.

Parameters:
x - one Vector
y - the other Vector
Returns:
distance between x and y
Throws:
InvalidOperationException - if either Vector does not contain doubles

L2Norm

public static double L2Norm(Vector x)
                     throws InvalidOperationException
Returns the L2 norm of a vector

Parameters:
x - the Vector
Returns:
L2 norm of X
Throws:
InvalidOperationException - if x does not contain doubles

doubleValue

public static double doubleValue(FieldElement d)
                          throws InvalidOperationException
Returns the double-precision floating-point value in a FieldElement.

Parameters:
d - the element
Returns:
double contained in d
Throws:
InvalidOperationException - if d does not contain a double

doubleValue

public static double doubleValue(Vector x,
                                 int i)
                          throws InvalidOperationException
Returns the Ith double-precision floating-point value in a Vector. First index is 1.

Parameters:
x - the Vector
i - the index
Returns:
double contained in at v(i)
Throws:
InvalidOperationException - if v does not contain double
InvalidOperationException - if the index is out of bounds

doubleValue

public static double doubleValue(Matrix a,
                                 int i,
                                 int j)
                          throws InvalidOperationException
Returns the I,Jth double-precision floating-point value in a Matrix. First index is 1,1.

Parameters:
a - the Matrix
i - row index
j - column index
Returns:
double contained in at a(i,j)
Throws:
InvalidOperationException - if v does not contain double
InvalidOperationException - if either index is out of bounds

unityValue

public FieldElement unityValue()
Returns a FieldElement corresponding to unity (1), the neutral element of multiplication.

Specified by:
unityValue in class LinAlgFactory
Returns:
one

zeroValue

public FieldElement zeroValue()
Returns a FieldElement corresponding to zero (0), the neutral element of addition.

Specified by:
zeroValue in class LinAlgFactory
Returns:
zero

randomValue

public FieldElement randomValue(java.util.Random random)
Returns a random value. The value is a double-precision floating-point number between 0.0 and 1.0.

Specified by:
randomValue in class LinAlgFactory
Returns:
random value