org.rubato.math.module
Class RProperFreeElement

java.lang.Object
  extended by org.rubato.math.module.ProperFreeElement
      extended by org.rubato.math.module.RProperFreeElement
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<ModuleElement>, java.lang.Iterable<RingElement>, FreeElement, ModuleElement, RFreeElement, XMLInputOutput<ModuleElement>

public final class RProperFreeElement
extends ProperFreeElement
implements RFreeElement

Elements in a free module over reals.

Author:
Gérard Milmeister
See Also:
RProperFreeModule, Serialized Form

Field Summary
static RFreeElement nullElement
           
 
Method Summary
 void add(ModuleElement element)
          Adds element to this module element.
 void add(RProperFreeElement element)
           
 ModuleElement cast(Module module)
          Tries to cast this element to an element in the given module.
 RProperFreeElement clone()
          Returns a deep copy of this module element.
 int compareTo(ModuleElement object)
          Compares this module element with object.
 RProperFreeElement difference(ModuleElement element)
          Returns the difference of this module element and element.
 RProperFreeElement difference(RProperFreeElement element)
           
 boolean equals(java.lang.Object object)
          Returns true iff this element is equal to object.
 double[] fold(ModuleElement[] elements)
          Fold elements assuming they are of this same type.
 ModuleElement fromXML(XMLReader reader, org.w3c.dom.Element element)
          Reads XML representation from reader starting with element.
 RElement getComponent(int i)
          Returns the i-th component of this free element.
 java.lang.String getElementTypeName()
          Returns the value of the type attribute for this class.
 int getLength()
          Returns the length of this free element.
 Module getModule()
          Returns the module that this module element is an element of.
 RElement getRingElement(int i)
          Returns the i-th ring component of this free element.
 double[] getValue()
           
 double getValue(int i)
           
static XMLInputOutput<ModuleElement> getXMLInputOutput()
           
 int hashCode()
          Returns the hash code for this module element.
 boolean isZero()
          Returns true iff this element is zero.
static RFreeElement make(double[] v)
           
 void multiplyCW(ModuleElement element)
          Multiply this module element componentwise with element.
 void multiplyCW(RProperFreeElement element)
           
 void negate()
          Negate this module element.
 RProperFreeElement negated()
          Returns the negative of this module element.
 ModuleElement productCW(ModuleElement element)
          Returns the componentwise product of this module element and element.
 RProperFreeElement productCW(RProperFreeElement element)
           
 RFreeElement resize(int n)
          Returns this free element resized to length n.
 void scale(RElement element)
           
 void scale(RingElement element)
          Multiplies this element with element.
 RProperFreeElement scaled(RElement element)
           
 RProperFreeElement scaled(RingElement element)
          Returns the product of this element with element.
 java.lang.String stringRep(boolean... parens)
          Returns a string representation of this module element.
 void subtract(ModuleElement element)
          Subtracts element from this module element.
 void subtract(RProperFreeElement element)
           
 RProperFreeElement sum(ModuleElement element)
          Returns the sum of this module element and element.
 RProperFreeElement sum(RProperFreeElement element)
           
 java.lang.String toString()
          Returns a human readable string representation of this module element.
 void toXML(XMLWriter writer)
          Outputs XML representation to writer.
 
Methods inherited from class org.rubato.math.module.ProperFreeElement
iterator
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.rubato.math.module.FreeElement
iterator
 

Field Detail

nullElement

public static RFreeElement nullElement
Method Detail

make

public static RFreeElement make(double[] v)

isZero

public boolean isZero()
Description copied from interface: ModuleElement
Returns true iff this element is zero.

Specified by:
isZero in interface ModuleElement

sum

public RProperFreeElement sum(ModuleElement element)
                       throws DomainException
Description copied from interface: ModuleElement
Returns the sum of this module element and element.

Specified by:
sum in interface ModuleElement
Specified by:
sum in interface RFreeElement
Throws:
DomainException - if element is not in domain

sum

public RProperFreeElement sum(RProperFreeElement element)
                       throws DomainException
Throws:
DomainException

add

public void add(ModuleElement element)
         throws DomainException
Description copied from interface: ModuleElement
Adds element to this module element. This is a destructive operation.

Specified by:
add in interface ModuleElement
Throws:
DomainException - if element is not in domain

add

public void add(RProperFreeElement element)
         throws DomainException
Throws:
DomainException

difference

public RProperFreeElement difference(ModuleElement element)
                              throws DomainException
Description copied from interface: ModuleElement
Returns the difference of this module element and element.

Specified by:
difference in interface ModuleElement
Specified by:
difference in interface RFreeElement
Throws:
DomainException - if element is not in domain

difference

public RProperFreeElement difference(RProperFreeElement element)
                              throws DomainException
Throws:
DomainException

subtract

public void subtract(ModuleElement element)
              throws DomainException
Description copied from interface: ModuleElement
Subtracts element from this module element. This is a destructive operation.

Specified by:
subtract in interface ModuleElement
Throws:
DomainException - if element is not in domain

subtract

public void subtract(RProperFreeElement element)
              throws DomainException
Throws:
DomainException

productCW

public ModuleElement productCW(ModuleElement element)
                        throws DomainException
Description copied from interface: FreeElement
Returns the componentwise product of this module element and element.

Specified by:
productCW in interface FreeElement
Throws:
DomainException - if element is not in domain

productCW

public RProperFreeElement productCW(RProperFreeElement element)
                             throws DomainException
Throws:
DomainException

multiplyCW

public void multiplyCW(ModuleElement element)
                throws DomainException
Description copied from interface: FreeElement
Multiply this module element componentwise with element. This is a destructive operation.

Specified by:
multiplyCW in interface FreeElement
Throws:
DomainException - if element is not in domain

multiplyCW

public void multiplyCW(RProperFreeElement element)
                throws DomainException
Throws:
DomainException

negated

public RProperFreeElement negated()
Description copied from interface: ModuleElement
Returns the negative of this module element.

Specified by:
negated in interface ModuleElement
Specified by:
negated in interface RFreeElement

negate

public void negate()
Description copied from interface: ModuleElement
Negate this module element. This is a destructive operation.

Specified by:
negate in interface ModuleElement

scaled

public RProperFreeElement scaled(RingElement element)
                          throws DomainException
Description copied from interface: ModuleElement
Returns the product of this element with element.

Specified by:
scaled in interface ModuleElement
Specified by:
scaled in interface RFreeElement
Throws:
DomainException - if element is not in domain

scaled

public RProperFreeElement scaled(RElement element)

scale

public void scale(RingElement element)
           throws DomainException
Description copied from interface: ModuleElement
Multiplies this element with element. This is a destructive operation.

Specified by:
scale in interface ModuleElement
Throws:
DomainException - if element is not in domain

scale

public void scale(RElement element)

getComponent

public RElement getComponent(int i)
Description copied from interface: FreeElement
Returns the i-th component of this free element.

Specified by:
getComponent in interface FreeElement
Specified by:
getComponent in interface ModuleElement
Specified by:
getComponent in interface RFreeElement

getRingElement

public RElement getRingElement(int i)
Description copied from interface: FreeElement
Returns the i-th ring component of this free element.

Specified by:
getRingElement in interface FreeElement
Specified by:
getRingElement in interface RFreeElement

getLength

public int getLength()
Description copied from interface: FreeElement
Returns the length of this free element.

Specified by:
getLength in interface FreeElement
Specified by:
getLength in interface ModuleElement

getModule

public Module getModule()
Description copied from interface: ModuleElement
Returns the module that this module element is an element of.

Specified by:
getModule in interface ModuleElement

getValue

public double[] getValue()

getValue

public double getValue(int i)

resize

public RFreeElement resize(int n)
Description copied from interface: FreeElement
Returns this free element resized to length n. If the new length n is greater than the old length, the new values are filled with the zero of the underlying ring. If the new length n is less than the old length, the vector of values is simply truncated.

Specified by:
resize in interface FreeElement
Specified by:
resize in interface RFreeElement

equals

public boolean equals(java.lang.Object object)
Description copied from interface: ModuleElement
Returns true iff this element is equal to object.

Specified by:
equals in interface ModuleElement
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(ModuleElement object)
Description copied from interface: ModuleElement
Compares this module element with object.

Specified by:
compareTo in interface java.lang.Comparable<ModuleElement>
Specified by:
compareTo in interface ModuleElement
Overrides:
compareTo in class ProperFreeElement

cast

public ModuleElement cast(Module module)
Description copied from interface: ModuleElement
Tries to cast this element to an element in the given module.

Specified by:
cast in interface ModuleElement
Returns:
a new module element in the required module and null if the cast cannot be performed.

clone

public RProperFreeElement clone()
Description copied from interface: ModuleElement
Returns a deep copy of this module element.

Specified by:
clone in interface ModuleElement
Specified by:
clone in interface RFreeElement
Specified by:
clone in class ProperFreeElement

stringRep

public java.lang.String stringRep(boolean... parens)
Description copied from interface: ModuleElement
Returns a string representation of this module element. The representation is meant to be parseable. If the argument parens is present then the the representation is parenthesized if necessary.

Specified by:
stringRep in interface ModuleElement

toString

public java.lang.String toString()
Description copied from interface: ModuleElement
Returns a human readable string representation of this module element. The representation is not meant to be parseable.

Specified by:
toString in interface ModuleElement
Overrides:
toString in class java.lang.Object

fold

public double[] fold(ModuleElement[] elements)
Description copied from interface: ModuleElement
Fold elements assuming they are of this same type.

Specified by:
fold in interface ModuleElement

toXML

public void toXML(XMLWriter writer)
Description copied from interface: XMLInputOutput
Outputs XML representation to writer.

Specified by:
toXML in interface XMLInputOutput<ModuleElement>

fromXML

public ModuleElement fromXML(XMLReader reader,
                             org.w3c.dom.Element element)
Description copied from interface: XMLInputOutput
Reads XML representation from reader starting with element.

Specified by:
fromXML in interface XMLInputOutput<ModuleElement>
Returns:
an object of type T or null if parsing failed

getXMLInputOutput

public static XMLInputOutput<ModuleElement> getXMLInputOutput()

getElementTypeName

public java.lang.String getElementTypeName()
Description copied from interface: XMLInputOutput
Returns the value of the type attribute for this class.

Specified by:
getElementTypeName in interface XMLInputOutput<ModuleElement>

hashCode

public int hashCode()
Description copied from interface: ModuleElement
Returns the hash code for this module element.

Specified by:
hashCode in interface ModuleElement
Overrides:
hashCode in class java.lang.Object