org.retro.neural
Class F2

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

public class F2
extends FieldElement
implements java.lang.Comparable


Field Summary
 int value
           
 
Constructor Summary
F2(int value)
          Builds an element from an integer value.
 
Method Summary
 FieldElement add(FieldElement val)
          Calculates the sum of this element and another one.
 int compareTo(java.lang.Object o)
          Implements Comparable.compareTo(Object).
 boolean equals(FieldElement val)
          Checks two elements 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.
 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
divide, ge, gt, isOne, isZero, le, lt, subtract
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public int value
Constructor Detail

F2

public F2(int value)
Builds an element from an integer value. The resulting value is simply this integer value, modulo 2.

Method Detail

add

public FieldElement add(FieldElement val)
Calculates the sum of this element and another one.

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

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 mod 2

negate

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

Specified by:
negate in class FieldElement
Returns:
negated (i.e., the value itself)

invert

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

Specified by:
invert in class FieldElement
Returns:
inverted (i.e., the value itself)
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 elements 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

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.

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