org.retro.neural
Class DoubleWrapper

java.lang.Object
  extended byorg.retro.neural.FieldElement
      extended byorg.retro.neural.DoubleWrapper
All Implemented Interfaces:
java.lang.Comparable

public class DoubleWrapper
extends FieldElement
implements java.lang.Comparable


Field Summary
protected  double value
           
 
Constructor Summary
DoubleWrapper(double value)
           
 
Method Summary
 FieldElement add(FieldElement val)
          Calculates the sum of this FieldElement and another one.
 int compareTo(java.lang.Object o)
          Implements Comparable.compareTo(Object).
 FieldElement divide(FieldElement val)
          Calculates the quotient of this element and another one.
 double doubleValue()
          Returns the double-precision floating-point value of this element.
 boolean equals(FieldElement val)
          Checks two FieldElements for equality.
 FieldElement instance(double dval)
          Returns an instance of this FieldElement to be used in computing mean and other values.
 FieldElement invert()
          Calculates the inverse element of multiplication for this element.
 FieldElement multiply(FieldElement val)
          Calculates the product of this element and another one.
 FieldElement negate()
          Calculates the inverse element of addition for this element.
 FieldElement one()
          Returns the neutral element of multiplication (one element) of this element's field.
 double sqrt()
          Returns the square root of this value.
 FieldElement subtract(FieldElement val)
          Calculates the product of this element and another one.
 java.lang.String toString()
          Returns a String representation of this element.
 FieldElement zero()
          Returns the neutral element of addition (zero element) of this FieldElement's field.
 
Methods inherited from class org.retro.neural.FieldElement
ge, gt, isOne, isZero, le, lt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected double value
Constructor Detail

DoubleWrapper

public DoubleWrapper(double value)
Method Detail

add

public FieldElement add(FieldElement val)
Description copied from class: FieldElement
Calculates the sum of this FieldElement and another one.

Specified by:
add in class FieldElement
Parameters:
val -
Returns:
sum

subtract

public FieldElement subtract(FieldElement val)
Calculates the product of this element and another one.

Overrides:
subtract in class FieldElement
Parameters:
val -
Returns:
product

multiply

public FieldElement multiply(FieldElement val)
Calculates the product of this element and another one.

Specified by:
multiply in class FieldElement
Parameters:
val -
Returns:
product

divide

public FieldElement divide(FieldElement val)
Calculates the quotient of this element and another one.

Overrides:
divide in class FieldElement
Parameters:
val -
Returns:
this / val

negate

public FieldElement negate()
Calculates the inverse element of addition for this element.

Specified by:
negate in class FieldElement
Returns:
negated (-value)

invert

public FieldElement invert()
                    throws InvalidOperationException
Calculates the inverse element of multiplication for this element.

Specified by:
invert in class FieldElement
Returns:
inverted (1/value)
Throws:
InvalidOperationException - if original value is zero

zero

public FieldElement zero()
Returns the neutral element of addition (zero element) of this FieldElement's field.

Specified by:
zero in class FieldElement
Returns:
zero

one

public FieldElement one()
Returns the neutral element of multiplication (one element) of this element's field.

Specified by:
one in class FieldElement
Returns:
one

equals

public boolean equals(FieldElement val)
Checks two FieldElements for equality.

Overrides:
equals in class FieldElement
Parameters:
val -
Returns:
true if the two FieldElements are mathematically equal.

toString

public java.lang.String toString()
Returns a String representation of this element.

Returns:
String representation

doubleValue

public double doubleValue()
Returns the double-precision floating-point value of this element.

Returns:
value

compareTo

public int compareTo(java.lang.Object o)
Implements Comparable.compareTo(Object).

Specified by:
compareTo in interface java.lang.Comparable
Specified by:
compareTo in class FieldElement
Parameters:
o - the object
Returns:
{-,+,0} as this object is less than, equal to, or greater than the specified object.

sqrt

public double sqrt()
Returns the square root of this value.

Returns:
sqrt(value)

instance

public FieldElement instance(double dval)
Returns an instance of this FieldElement to be used in computing mean and other values.

Specified by:
instance in class FieldElement
Parameters:
dval - the value to use
Returns:
instance