

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object java.lang.Number gov.sandia.cognition.math.MutableDouble
public class MutableDouble
A mutable object containing a double. It is meant to be used for cases where you may want to use a java.lang.Double but its value will be updated frequently, such as in a map or other data structure. Many of the implementations of the methods in this class are based on the behavior described in java.lang.Double.
Field Summary  

double 
value
The value. 
Constructor Summary  

MutableDouble()
Creates an MutableDouble with an initial value of zero. 

MutableDouble(double value)
Creates an MutableDouble with the given value. 

MutableDouble(MutableDouble other)
Creates a copy of a MutableDouble . 
Method Summary  

MutableDouble 
clone()
Creates a new clone (shallow copy) of this object. 
int 
compareTo(MutableDouble other)

void 
convertFromVector(Vector parameters)
Converts the object from a Vector of parameters. 
Vector1 
convertToVector()
Converts the object to a vector. 
MutableDouble 
divide(MutableDouble other)
Divides this value by the other value, returning the
result of the division as a new value. 
void 
divideEquals(MutableDouble other)
Inline divises this value by the other value, storing
the result inside this . 
MutableDouble 
dotTimes(MutableDouble other)
Elementwise multiplication of this and other 
void 
dotTimesEquals(MutableDouble other)
Inline elementwise multiplication of this and
other 
double 
doubleValue()

boolean 
equals(double other)
Determines if this MutableDouble's value is equal to a given double. 
boolean 
equals(MutableDouble other)
Determines if this MutableDouble is equal to another MutableDouble. 
boolean 
equals(MutableDouble other,
double effectiveZero)
Determines if two RingType objects are effectively equal 
boolean 
equals(Object other)
Determines if two RingType objects are equal 
float 
floatValue()

double 
getValue()
Gets the value stored in the object. 
int 
hashCode()

int 
intValue()

MutableDouble 
inverse()
Returns the inverse of this . 
void 
inverseEquals()
Changes this value to be its inverse. 
boolean 
isZero()
Determines if this ring is equal to zero. 
boolean 
isZero(double effectiveZero)
Determines if this ring is equal to zero using the elementwise effective zero value. 
long 
longValue()

MutableDouble 
minus(MutableDouble other)
Arithmetic subtraction of other from this 
void 
minusEquals(MutableDouble other)
Inline arithmetic subtraction of other from
this 
MutableDouble 
negative()
Returns the elementwise negation of this , such that
this.plus( this.negative() ) has only zero elements. 
void 
negativeEquals()
Inline elementwise negation of this 
MutableDouble 
plus(MutableDouble other)
Arithmetic addition of this and other 
void 
plusEquals(MutableDouble other)
Inline arithmetic addition of this and other 
MutableDouble 
scale(double scaleFactor)
Elementwise scaling of this by scaleFactor 
MutableDouble 
scaledMinus(double scaleFactor,
MutableDouble other)
Arithmetic subtraction other after elementwise scaling of
other by scaleFactor from this . 
void 
scaledMinusEquals(double scaleFactor,
MutableDouble other)
Inline arithmetic subtraction of other after elementwise
scaling of other by scaleFactor from this . 
MutableDouble 
scaledPlus(double scaleFactor,
MutableDouble other)
Arithmetic addition of this and other after
elementwise scaling of other by scaleFactor . 
void 
scaledPlusEquals(double scaleFactor,
MutableDouble other)
Inline arithmetic addition of this and other after
elementwise scaling of other by scaleFactor . 
void 
scaleEquals(double scaleFactor)
Inline elementwise scaling of this by
scaleFactor 
void 
setValue(double value)
Sets the value stored in the object. 
MutableDouble 
times(MutableDouble other)
Multiplies this value by the other value, returning the
result of the multiplication as a new value. 
void 
timesEquals(MutableDouble other)
Inline multiplies this value by the other value,
storing the result inside this . 
String 
toString()

void 
zero()
Zeros out all elements of this , so that the following are
equivalent
r1.scaleEquals( 0.0 );
and
r1.zero();
Furthermore,
r1.zero(); anything.dotTimes( r1 ).equals( r1 ); 
Methods inherited from class java.lang.Number 

byteValue, shortValue 
Methods inherited from class java.lang.Object 

finalize, getClass, notify, notifyAll, wait, wait, wait 
Field Detail 

public double value
Constructor Detail 

public MutableDouble()
MutableDouble
with an initial value of zero.
public MutableDouble(double value)
MutableDouble
with the given value.
value
 The value to store in the object.public MutableDouble(MutableDouble other)
MutableDouble
.
other
 The other value.Method Detail 

public MutableDouble clone()
CloneableSerializable
clone
in interface Vectorizable
clone
in interface Ring<MutableDouble>
clone
in interface CloneableSerializable
clone
in class Object
public boolean equals(Object other)
Ring
equals
in interface Ring<MutableDouble>
equals
in class Object
other
 RingType to compare against this
public boolean equals(MutableDouble other)
other
 The other value.
public boolean equals(double other)
other
 A double.
public int compareTo(MutableDouble other)
compareTo
in interface Comparable<MutableDouble>
public int hashCode()
hashCode
in class Object
public int intValue()
intValue
in class Number
public long longValue()
longValue
in class Number
public float floatValue()
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number
public double getValue()
public void setValue(double value)
value
 The value.public String toString()
toString
in class Object
public boolean equals(MutableDouble other, double effectiveZero)
Ring
equals
in interface Ring<MutableDouble>
other
 RingType to compare against this
effectiveZero
 tolerance threshold for elementwise equality
public MutableDouble plus(MutableDouble other)
Ring
this
and other
plus
in interface Ring<MutableDouble>
other
 object to add to this
this
and other
public void plusEquals(MutableDouble other)
Ring
this
and other
plusEquals
in interface Ring<MutableDouble>
other
 object to add to this
public MutableDouble minus(MutableDouble other)
Ring
other
from this
minus
in interface Ring<MutableDouble>
other
 object to subtract from this
this
and other
public void minusEquals(MutableDouble other)
Ring
other
from
this
minusEquals
in interface Ring<MutableDouble>
other
 object to subtract from this
public MutableDouble times(MutableDouble other)
EuclideanRing
this
value by the other
value, returning the
result of the multiplication as a new value.
times
in interface EuclideanRing<MutableDouble>
other
 The other value.
public void timesEquals(MutableDouble other)
EuclideanRing
this
value by the other
value,
storing the result inside this
.
timesEquals
in interface EuclideanRing<MutableDouble>
other
 The other value.public MutableDouble divide(MutableDouble other)
EuclideanRing
this
value by the other
value, returning the
result of the division as a new value.
divide
in interface EuclideanRing<MutableDouble>
other
 The other value.
public void divideEquals(MutableDouble other)
EuclideanRing
this
value by the other
value, storing
the result inside this
.
divideEquals
in interface EuclideanRing<MutableDouble>
other
 The other value.public MutableDouble dotTimes(MutableDouble other)
Ring
this
and other
dotTimes
in interface Ring<MutableDouble>
other
 elements of other will be multiplied to the corresponding
elements of this
this
and
other
public void dotTimesEquals(MutableDouble other)
Ring
this
and
other
dotTimesEquals
in interface Ring<MutableDouble>
other
 elements of other will be multiplied to the corresponding
elements of this
public MutableDouble scale(double scaleFactor)
Ring
this
by scaleFactor
scale
in interface Ring<MutableDouble>
scaleFactor
 amount to scale the elements of this
this
public void scaleEquals(double scaleFactor)
Ring
this
by
scaleFactor
scaleEquals
in interface Ring<MutableDouble>
scaleFactor
 amount to scale the elements of this
public MutableDouble scaledPlus(double scaleFactor, MutableDouble other)
Ring
this
and other
after
elementwise scaling of other
by scaleFactor
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x + a * y. It is typically a more efficient way of doing
this.plus(other.scale(scaleFactor))
since it can avoid
intermediate object creation.
scaledPlus
in interface Ring<MutableDouble>
scaleFactor
 The scale factor to multiply by the elements of other before
adding to the elements of this.other
 Object to scale and then add to this.
public void scaledPlusEquals(double scaleFactor, MutableDouble other)
Ring
this
and other
after
elementwise scaling of other
by scaleFactor
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x += a * y. It is typically a more efficient way of doing
this.plusEquals(other.scale(scaleFactor))
since it can avoid
intermediate object creation.
scaledPlusEquals
in interface Ring<MutableDouble>
scaleFactor
 The scale factor to multiply by the elements of other before
adding to the elements of this.other
 Object to scale and then add to this.public MutableDouble scaledMinus(double scaleFactor, MutableDouble other)
Ring
other
after elementwise scaling of
other
by scaleFactor
from this
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x  a * y. It is typically a more efficient way of doing
this.minus(other.scale(scaleFactor))
since it can avoid
intermediate object creation.
scaledMinus
in interface Ring<MutableDouble>
scaleFactor
 The scale factor to multiply by the elements of other before
subtracting from the elements of this.other
 Object to scale and then subtract from this.
public void scaledMinusEquals(double scaleFactor, MutableDouble other)
Ring
other
after elementwise
scaling of other
by scaleFactor
from this
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x = a * y. It is typically a more efficient way of doing
this.minusEquals(other.scale(scaleFactor))
since it can avoid
intermediate object creation.
scaledMinusEquals
in interface Ring<MutableDouble>
scaleFactor
 The scale factor to multiply by the elements of other before
adding to the elements of this.other
 Object to scale and then add to this.public MutableDouble negative()
Ring
this
, such that
this.plus( this.negative() )
has only zero elements.
negative
in interface Ring<MutableDouble>
this
public void negativeEquals()
Ring
this
negativeEquals
in interface Ring<MutableDouble>
public MutableDouble inverse()
Field
this
.
inverse
in interface Field<MutableDouble>
public void inverseEquals()
Field
inverseEquals
in interface Field<MutableDouble>
public void zero()
Ring
this
, so that the following are
equivalent
r1.scaleEquals( 0.0 );
and
r1.zero();
Furthermore,
r1.zero(); anything.dotTimes( r1 ).equals( r1 );
zero
in interface Ring<MutableDouble>
public boolean isZero()
Ring
isZero
in interface Ring<MutableDouble>
public boolean isZero(double effectiveZero)
Ring
isZero
in interface Ring<MutableDouble>
effectiveZero
 Tolerance threshold for elementwise equality
public Vector1 convertToVector()
Vectorizable
convertToVector
in interface Vectorizable
public void convertFromVector(Vector parameters)
Vectorizable
convertFromVector
in interface Vectorizable
parameters
 The parameters to incorporate.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 