@CodeReview(reviewer="Jonathan McClain", date="2006-05-19", changesNeeded=false, comments="Comments marked throughout the file with / / / on first column.") @PublicationReference(author="Bjorn-Ove Heimsund", title="Matrix Toolkits for Java (MTJ)", type=WebPage, year=2006, url="http://ressim.berlios.de/", notes="All subclasses essentially wrap one of MTJ\'s vector classes.") @SoftwareReference(name="Matrix Toolkits for Java (MTJ)", version="0.9.6", url="http://ressim.berlios.de/", license=LGPL, licenseVersion="2.1", licenseURL="http://ressim.berlios.de/") public abstract class AbstractMTJVector extends AbstractVector implements java.io.Serializable
Vector.IndexValueConsumer, Vector.IndexValueTransformVectorSpace.EntryDEFAULT_DELIMITER| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMTJVector(no.uib.cipr.matrix.Vector internalVector)
Creates a new instance of AbstractMTJVector
|
| Modifier and Type | Method and Description |
|---|---|
AbstractMTJVector |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
double |
dotProduct(AbstractMTJVector other)
Inner Vector product between two Vectors
|
double |
dotProduct(Vector other)
The inner product of this vector with the given vector.
|
void |
dotTimesEquals(Vector other)
Inline element-wise multiplication of
this and
other |
double |
get(int index)
Gets the value of element of the vector at the zero-based index.
|
int |
getDimensionality()
Returns the number of elements in the Vector
|
double |
getElement(int index)
Gets the zero-based indexed element from the Vector
|
protected no.uib.cipr.matrix.Vector |
getInternalVector()
Getter for internalVector
|
void |
increment(int index,
double value)
Increments the value of the given index by the given value.
|
java.util.Iterator<VectorEntry> |
iterator() |
void |
minusEquals(AbstractMTJVector other)
Inline subtraction of the elements of other from the elements of this
|
void |
minusEquals(Vector other)
Inline arithmetic subtraction of
other from
this |
double |
norm2()
2-norm of the vector (aka Euclidean distance of the vector)
|
double |
norm2Squared()
Squared 2-norm of the vector (aka squared Euclidean distance of the
vector)
|
abstract AbstractMTJMatrix |
outerProduct(AbstractMTJVector other)
Computes the outer matrix product between the two vectors
|
Matrix |
outerProduct(Vector other)
Computes the outer matrix product between the two vectors
|
void |
plusEquals(AbstractMTJVector other)
Inline addition of this and the other vector
|
void |
plusEquals(Vector other)
Inline arithmetic addition of
this and other |
void |
scaledMinusEquals(double scaleFactor,
AbstractMTJVector other)
Subtracts from this vector the scaled version of the other given vector.
|
void |
scaledPlusEquals(double scaleFactor,
AbstractMTJVector other)
Adds to this vector the scaled version of the other given vector.
|
void |
scaledPlusEquals(double scaleFactor,
Vector other)
Inline arithmetic addition of
this and other after
element-wise scaling of other by scaleFactor. |
void |
scaleEquals(double scaleFactor)
Inline element-wise scaling of
this by
scaleFactor |
void |
set(int index,
double value)
Sets the value for an element at the zero-based index from the vector.
|
void |
setElement(int index,
double value)
Sets the zero-based indexed element in the Vector from the specified value
|
protected void |
setInternalVector(no.uib.cipr.matrix.Vector internalVector)
Setter for internalVector
|
Vector |
times(AbstractMTJMatrix matrix)
Premultiplies the matrix by the vector "this"
|
Vector |
times(Matrix matrix)
Premultiplies the matrix by the vector "this"
|
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 ); |
assertDimensionalityEquals, assertEqualDimensionality, assertSameDimensionality, checkSameDimensionality, convertFromVector, convertToVector, decrement, decrement, dotDivide, dotDivideEquals, equals, equals, euclideanDistanceSquared, forEachElement, forEachEntry, forEachNonZero, hashCode, increment, stack, toArray, toString, toString, toString, transform, transform, transformEquals, transformEquals, transformNonZeros, transformNonZeros, transformNonZerosEquals, transformNonZerosEquals, valuesAsListangle, cosine, dot, euclideanDistance, isUnitVector, isUnitVector, isZero, norm, norm1, normInfinity, sum, unitVector, unitVectorEqualsdotTimes, isZero, minus, negative, negativeEquals, plus, scale, scaledMinus, scaledMinusEquals, scaledPlusfinalize, getClass, notify, notifyAll, wait, wait, waitcountNonZeros, getEntryCount, getVectorFactory, isSparse, subVectorangle, cosine, dot, euclideanDistance, getMaxValue, getMinValue, isUnitVector, isUnitVector, norm, norm1, normInfinity, sum, unitVector, unitVectorEqualsdotTimes, isZero, isZero, minus, negative, negativeEquals, plus, scale, scaledMinus, scaledMinusEquals, scaledPlusprotected AbstractMTJVector(no.uib.cipr.matrix.Vector internalVector)
internalVector - Internal MTJ-based vector that does the heavy liftingpublic AbstractMTJVector clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface Vectorclone in interface Vectorizableclone in interface Ring<Vector>clone in interface CloneableSerializableclone in class AbstractRing<Vector>public int getDimensionality()
VectorgetDimensionality in interface Vectorpublic double get(int index)
VectorgetElement.public void set(int index,
double value)
VectorsetElement.public double getElement(int index)
VectorgetElement in interface Vectorindex - zero-based indexpublic void setElement(int index,
double value)
VectorsetElement in interface Vectorindex - zero-based indexvalue - value to set the element in the Vectorpublic void increment(int index,
double value)
Vectorincrement in interface Vectorincrement in class AbstractVectorindex - The index of the dimension to increment.value - The value to add.public Vector times(Matrix matrix)
Vectortimes in interface Vectortimes in class AbstractVectormatrix - Matrix to premultiply by "this", must have the same number of rows as
the dimensionality of "this"public Vector times(AbstractMTJMatrix matrix)
matrix - Matrix to premultiply by "this", must have the same number of rows as
the dimensionality of "this"protected no.uib.cipr.matrix.Vector getInternalVector()
protected void setInternalVector(no.uib.cipr.matrix.Vector internalVector)
internalVector - internal MTJ-based vector that does the heavy liftingpublic double norm2()
VectorSpacenorm2 in interface VectorSpace<Vector,VectorEntry>norm2 in class AbstractVectorSpace<Vector,VectorEntry>public double norm2Squared()
VectorSpacenorm2Squared in interface VectorSpace<Vector,VectorEntry>norm2Squared in class AbstractVectorSpace<Vector,VectorEntry>public void plusEquals(Vector other)
Ringthis and otherplusEquals in interface Ring<Vector>plusEquals in class AbstractVectorother - object to add to thispublic void plusEquals(AbstractMTJVector other)
other - Vector to which to add the elements of this, must be the
same dimension as thispublic void minusEquals(Vector other)
Ringother from
thisminusEquals in interface Ring<Vector>minusEquals in class AbstractVectorother - object to subtract from thispublic void minusEquals(AbstractMTJVector other)
other - Vector from which to subtract the elements of this, must be the
same dimension as thispublic double dotProduct(Vector other)
VectorSpacedotProduct in interface VectorSpace<Vector,VectorEntry>dotProduct in class AbstractVectorother - The Vector with which to compute the dot product with this.
Must have the same dimensionality as this.public double dotProduct(AbstractMTJVector other)
other - the Vector with which to compute the dot product with this,
must be the same dimension as thispublic void dotTimesEquals(Vector other)
Ringthis and
otherdotTimesEquals in interface Ring<Vector>dotTimesEquals in class AbstractVectorother - elements of other will be multiplied to the corresponding
elements of thispublic void scaleEquals(double scaleFactor)
Ringthis by
scaleFactorscaleEquals in interface Ring<Vector>scaleEquals in class AbstractVectorSpace<Vector,VectorEntry>scaleFactor - amount to scale the elements of thispublic void scaledPlusEquals(double scaleFactor,
Vector other)
Ringthis and other after
element-wise 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<Vector>scaledPlusEquals in class AbstractVectorscaleFactor - 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,
AbstractMTJVector other)
scaleFactor - The scale factor to use.other - The other vector to scale and then add to this vector.public void scaledMinusEquals(double scaleFactor,
AbstractMTJVector other)
scaleFactor - The scale factor to use.other - The other vector to scale and then subtract from this vector.public java.util.Iterator<VectorEntry> iterator()
iterator in interface java.lang.Iterable<VectorEntry>public void zero()
Ringthis, so that the following are
equivalent
r1.scaleEquals( 0.0 );
and
r1.zero();
Furthermore,
r1.zero(); anything.dotTimes( r1 ).equals( r1 );public Matrix outerProduct(Vector other)
VectorouterProduct in interface VectorouterProduct in class AbstractVectorother - post-multiplied Vector with which to compute the outer productpublic abstract AbstractMTJMatrix outerProduct(AbstractMTJVector other)
other - post-multiplied Vector with which to compute the outer product