VectorType
- Type of VectorSpaceEntryType
- Type of Entry in the VectorSpacepublic abstract class AbstractVectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry> extends AbstractRing<VectorType> implements VectorSpace<VectorType,EntryType>
VectorSpace.Entry
Constructor and Description |
---|
AbstractVectorSpace()
Creates a new instance of AbstractVectorSpace
|
Modifier and Type | Method and Description |
---|---|
double |
angle(VectorType other)
Computes the angle between two Vectors.
|
double |
cosine(VectorType other)
Computes the cosine between two Vectors
|
double |
dot(VectorType other)
The inner product of this vector with the given vector.
|
boolean |
equals(java.lang.Object other)
Determines if two RingType objects are equal
|
boolean |
equals(VectorType other,
double effectiveZero)
Determines if two RingType objects are effectively equal
|
double |
euclideanDistance(VectorType other)
Euclidean distance between
this and other ,
which is the 2-norm between the difference of the Vectors |
boolean |
isUnitVector()
Determines if this vector is a unit vector (norm2 = 1.0).
|
boolean |
isUnitVector(double tolerance)
Determines if this vector is a unit vector within some tolerance for the
2-norm.
|
boolean |
isZero(double effectiveZero)
Determines if this ring is equal to zero using the element-wise effective
zero value.
|
double |
norm(double power)
Returns the p-norm of the Vector with the given power.
|
double |
norm1()
1-norm of the vector (sum of absolute values in the vector)
|
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)
|
double |
normInfinity()
Returns the infinity norm of the Vector, which is the maximum
absolute value of an element in the Vector.
|
void |
scaleEquals(double scaleFactor)
Inline element-wise scaling of
this by
scaleFactor |
double |
sum()
Computes the sum of the elements in the vector.
|
VectorType |
unitVector()
Returns the unit vector of this vector.
|
void |
unitVectorEquals()
Modifies this vector to be a the unit vector.
|
clone, dotTimes, isZero, minus, negative, negativeEquals, plus, scale, scaledMinus, scaledMinusEquals, scaledPlus, zero
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dotProduct, euclideanDistanceSquared, getMaxValue, getMinValue
clone, dotTimes, dotTimesEquals, isZero, minus, minusEquals, negative, negativeEquals, plus, plusEquals, scale, scaledMinus, scaledMinusEquals, scaledPlus, scaledPlusEquals, zero
public AbstractVectorSpace()
public boolean equals(java.lang.Object other)
Ring
equals
in interface Ring<VectorType extends VectorSpace<VectorType,? extends EntryType>>
equals
in class java.lang.Object
other
- RingType to compare against this
public double sum()
VectorSpace
sum
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public double norm1()
VectorSpace
norm1
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public double norm2()
VectorSpace
norm2
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public double norm2Squared()
VectorSpace
norm2Squared
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public double normInfinity()
VectorSpace
normInfinity
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public double norm(double power)
VectorSpace
norm
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
power
- Power to exponentiate each entry, must be greater than 0.0,
Double.POSITIVE_INFINITYpublic double dot(VectorType other)
VectorSpace
dot
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
other
- The Vector with which to compute the dot product with this.
Must have the same dimensionality as this.public double angle(VectorType other)
VectorSpace
angle
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
other
- Another vector with which to compute the angle. Must be the same
dimensionality.public double cosine(VectorType other)
VectorSpace
cosine
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
other
- another vector with which to compute the cosine, must be the
same dimension as thispublic double euclideanDistance(VectorType other)
VectorSpace
this
and other
,
which is the 2-norm between the difference of the VectorseuclideanDistance
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
other
- Vector to which to compute the distance, must be the same
dimension as thispublic VectorType unitVector()
VectorSpace
unitVector
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public void unitVectorEquals()
VectorSpace
unitVectorEquals
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public boolean isUnitVector()
VectorSpace
isUnitVector
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
public boolean isUnitVector(double tolerance)
VectorSpace
isUnitVector
in interface VectorSpace<VectorType extends VectorSpace<VectorType,? extends EntryType>,EntryType extends VectorSpace.Entry>
tolerance
- The tolerance around 1.0 to allow the length.public boolean equals(VectorType other, double effectiveZero)
Ring
equals
in interface Ring<VectorType extends VectorSpace<VectorType,? extends EntryType>>
other
- RingType to compare against this
effectiveZero
- tolerance threshold for element-wise equalitypublic void scaleEquals(double scaleFactor)
Ring
this
by
scaleFactor
scaleEquals
in interface Ring<VectorType extends VectorSpace<VectorType,? extends EntryType>>
scaleFactor
- amount to scale the elements of this
public boolean isZero(double effectiveZero)
Ring
isZero
in interface Ring<VectorType extends VectorSpace<VectorType,? extends EntryType>>
effectiveZero
- Tolerance threshold for element-wise equality