|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object JSci.maths.vectors.MathVector JSci.maths.vectors.AbstractDoubleVector JSci.maths.vectors.DoubleSparseVector
public final class DoubleSparseVector
The DoubleSparseVector class encapsulates sparse vectors. Uses Morse-coding.
Field Summary |
---|
Fields inherited from class JSci.maths.vectors.MathVector |
---|
N |
Constructor Summary | |
---|---|
DoubleSparseVector(double[] array)
Constructs a vector from an array. |
|
DoubleSparseVector(int dim)
Constructs an empty vector. |
|
DoubleSparseVector(int dim,
int capacityIncrement)
|
Method Summary | |
---|---|
AbelianGroup.Member |
add(AbelianGroup.Member v)
Returns the addition of this vector and another. |
AbstractDoubleVector |
add(AbstractDoubleVector v)
Returns the addition of this vector and another. |
DoubleSparseVector |
add(DoubleSparseVector v)
Returns the addition of this vector and another. |
DoubleVector |
add(DoubleVector v)
|
int |
componentCount()
Returns the number of non-zero components. |
boolean |
equals(java.lang.Object obj,
double tol)
Compares two vectors for equality. |
double |
getComponent(int n)
Returns a component of this vector. |
AbstractDoubleVector |
mapComponents(Mapping f)
Applies a function on all the vector components. |
double |
mass()
Returns the mass. |
AbelianGroup.Member |
negate()
Returns the negative of this vector. |
double |
norm()
Returns the l2-norm (magnitude). |
AbstractDoubleVector |
scalarDivide(double x)
Returns the division of this vector by a scalar. |
VectorSpace.Member |
scalarDivide(Field.Member x)
Returns the division of this vector by a scalar. |
AbstractDoubleVector |
scalarMultiply(double x)
Returns the multiplication of this vector by a scalar. |
Module.Member |
scalarMultiply(Ring.Member x)
Returns the multiplication of this vector by a scalar. |
double |
scalarProduct(AbstractDoubleVector v)
Returns the scalar product of this vector and another. |
double |
scalarProduct(DoubleSparseVector v)
Returns the scalar product of this vector and another. |
double |
scalarProduct(DoubleVector v)
|
void |
setComponent(int n,
double x)
Sets the value of a component of this vector. |
AbelianGroup.Member |
subtract(AbelianGroup.Member v)
Returns the subtraction of this vector by another. |
AbstractDoubleVector |
subtract(AbstractDoubleVector v)
Returns the subtraction of this vector by another. |
DoubleSparseVector |
subtract(DoubleSparseVector v)
Returns the subtraction of this vector by another. |
DoubleVector |
subtract(DoubleVector v)
|
double |
sumSquares()
Returns the sum of the squares of the components. |
DoubleSparseMatrix |
tensorProduct(DoubleSparseVector v)
Returns the tensor product of this vector and another. |
Methods inherited from class JSci.maths.vectors.AbstractDoubleVector |
---|
equals, getSet, hashCode, infNorm, norm, normalize, toString |
Methods inherited from class JSci.maths.vectors.MathVector |
---|
dimension, getInvalidComponentMsg |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DoubleSparseVector(int dim)
dim
- the dimension of the vector.public DoubleSparseVector(int dim, int capacityIncrement)
public DoubleSparseVector(double[] array)
Method Detail |
---|
public boolean equals(java.lang.Object obj, double tol)
equals
in class AbstractDoubleVector
obj
- a double sparse vectorpublic double getComponent(int n)
getComponent
in class AbstractDoubleVector
n
- index of the vector component
VectorDimensionException
- If attempting to access an invalid component.public void setComponent(int n, double x)
setComponent
in class AbstractDoubleVector
n
- index of the vector componentx
- a number
VectorDimensionException
- If attempting to access an invalid component.public int componentCount()
public double norm()
norm
in interface BanachSpace.Member
norm
in class AbstractDoubleVector
public double sumSquares()
public double mass()
mass
in class AbstractDoubleVector
public AbelianGroup.Member negate()
public AbelianGroup.Member add(AbelianGroup.Member v)
v
- a group memberpublic AbstractDoubleVector add(AbstractDoubleVector v)
add
in class AbstractDoubleVector
v
- a double vector
VectorDimensionException
- If the vectors are different sizes.public DoubleVector add(DoubleVector v)
public DoubleSparseVector add(DoubleSparseVector v)
v
- a double sparse vector
VectorDimensionException
- If the vectors are different sizes.public AbelianGroup.Member subtract(AbelianGroup.Member v)
v
- a group memberpublic AbstractDoubleVector subtract(AbstractDoubleVector v)
subtract
in class AbstractDoubleVector
v
- a double vector
VectorDimensionException
- If the vectors are different sizes.public DoubleVector subtract(DoubleVector v)
public DoubleSparseVector subtract(DoubleSparseVector v)
v
- a double sparse vector
VectorDimensionException
- If the vectors are different sizes.public Module.Member scalarMultiply(Ring.Member x)
x
- a ring memberpublic AbstractDoubleVector scalarMultiply(double x)
scalarMultiply
in class AbstractDoubleVector
x
- a doublepublic VectorSpace.Member scalarDivide(Field.Member x)
x
- a field memberpublic AbstractDoubleVector scalarDivide(double x)
scalarDivide
in class AbstractDoubleVector
x
- a double
java.lang.ArithmeticException
- If divide by zero.public double scalarProduct(AbstractDoubleVector v)
scalarProduct
in class AbstractDoubleVector
v
- a double vector
VectorDimensionException
- If the vectors are different sizes.public double scalarProduct(DoubleVector v)
public double scalarProduct(DoubleSparseVector v)
v
- a double sparse vector
VectorDimensionException
- If the vectors are different sizes.public DoubleSparseMatrix tensorProduct(DoubleSparseVector v)
public AbstractDoubleVector mapComponents(Mapping f)
mapComponents
in class AbstractDoubleVector
f
- a user-defined function
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |