|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.mathematics.algebraic.AbstractHypermatrix
org.jscience.mathematics.algebraic.AbstractMatrix
org.jscience.mathematics.algebraic.AbstractVector
org.jscience.mathematics.algebraic.matrices.AbstractDoubleVector
org.jscience.mathematics.algebraic.matrices.DoubleSparseVector
public class DoubleSparseVector
The DoubleSparseVector class encapsulates sparse vectors. Uses Morse-coding.
| Constructor Summary | |
|---|---|
DoubleSparseVector(AbstractDoubleVector vec)
Constructs a vector by copying a vector. |
|
DoubleSparseVector(double[] array)
Constructs a vector from an array. |
|
DoubleSparseVector(int dim)
Constructs an empty vector. |
|
| 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)
DOCUMENT ME! |
java.lang.Object |
clone()
Clone vector into a new vector. |
boolean |
equals(java.lang.Object obj,
double tol)
Compares two vectors for equality. |
double |
getPrimitiveElement(int n)
Returns a component of this vector. |
AbstractDoubleVector |
mapElements(PrimitiveMapping 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). |
void |
normalize()
Makes the norm of this vector equal to 1. |
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)
DOCUMENT ME! |
void |
setAllElements(double r)
Sets the value of all elements of the vector. |
void |
setElement(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)
DOCUMENT ME! |
double |
sumSquares()
Returns the sum of the squares of the components. |
DoubleSparseMatrix |
tensorProduct(DoubleSparseVector v)
Returns the tensor product of this vector and another. |
AbstractComplexVector |
toComplexVector()
Converts this vector to a complex vector. |
AbstractIntegerVector |
toIntegerVector()
Converts this vector to a double vector. |
double[] |
toPrimitiveArray()
Projects the vector to an array. |
| Methods inherited from class org.jscience.mathematics.algebraic.matrices.AbstractDoubleVector |
|---|
abs, equals, getColumn, getElement, getRow, getSubVector, hashCode, infNorm, max, mean, min, multiply, norm, read, reverse, setColumn, setElement, setRow, setSubVector, standardDeviation, tensorProduct, toMatrix, toString, transpose, variance |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractVector |
|---|
getDimension, getElement, getInvalidElementMsg, toArray, toArray |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractMatrix |
|---|
getElement, getInvalidElementMsg, numColumns, numRows, print, print, print, print, toArray |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractHypermatrix |
|---|
getDimensions, numDimensions, numElements, numElements, toArray |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jscience.mathematics.algebraic.Matrix |
|---|
numColumns, numRows, toArray |
| Methods inherited from interface org.jscience.mathematics.algebraic.Hypermatrix |
|---|
getDimensions, getElement, numDimensions, numElements, numElements, toArray |
| Constructor Detail |
|---|
public DoubleSparseVector(int dim)
dim - the dimension of the vector.public DoubleSparseVector(double[] array)
array - DOCUMENT ME!public DoubleSparseVector(AbstractDoubleVector vec)
vec - an assigned value| Method Detail |
|---|
public boolean equals(java.lang.Object obj,
double tol)
equals in class AbstractDoubleVectorobj - a double sparse vectortol - DOCUMENT ME!
public AbstractIntegerVector toIntegerVector()
toIntegerVector in class AbstractDoubleVectorpublic AbstractComplexVector toComplexVector()
toComplexVector in class AbstractDoubleVectorpublic double getPrimitiveElement(int n)
getPrimitiveElement in class AbstractDoubleVectorn - index of the vector component
IllegalDimensionException - If attempting to access an invalid
component.
public void setElement(int n,
double x)
setElement in class AbstractDoubleVectorn - index of the vector componentx - a number
IllegalDimensionException - If attempting to access an invalid
component.public void setAllElements(double r)
setAllElements in class AbstractDoubleVectorr - a ring elementpublic double norm()
norm in interface BanachSpace.Membernorm in class AbstractDoubleVectorjava.lang.ArithmeticException - DOCUMENT ME!public void normalize()
normalize in class AbstractDoubleVectorpublic double sumSquares()
sumSquares in class AbstractDoubleVectorjava.lang.ArithmeticException - DOCUMENT ME!public double mass()
mass in class AbstractDoubleVectorjava.lang.ArithmeticException - DOCUMENT ME!public AbelianGroup.Member negate()
negate in interface AbelianGroup.Memberpublic AbelianGroup.Member add(AbelianGroup.Member v)
add in interface AbelianGroup.Memberv - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!public AbstractDoubleVector add(AbstractDoubleVector v)
add in class AbstractDoubleVectorv - a double vector
IllegalDimensionException - If the vectors are different sizes.public DoubleVector add(DoubleVector v)
v - DOCUMENT ME!
IllegalDimensionException - DOCUMENT ME!public DoubleSparseVector add(DoubleSparseVector v)
v - a double sparse vector
IllegalDimensionException - If the vectors are different sizes.public AbelianGroup.Member subtract(AbelianGroup.Member v)
subtract in interface AbelianGroup.Memberv - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!public AbstractDoubleVector subtract(AbstractDoubleVector v)
subtract in class AbstractDoubleVectorv - a double vector
IllegalDimensionException - If the vectors are different sizes.public DoubleVector subtract(DoubleVector v)
v - DOCUMENT ME!
IllegalDimensionException - DOCUMENT ME!public DoubleSparseVector subtract(DoubleSparseVector v)
v - a double sparse vector
IllegalDimensionException - If the vectors are different sizes.public Module.Member scalarMultiply(Ring.Member x)
scalarMultiply in interface Module.Memberx - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!public AbstractDoubleVector scalarMultiply(double x)
scalarMultiply in class AbstractDoubleVectorx - a double
public VectorSpace.Member scalarDivide(Field.Member x)
scalarDivide in interface VectorSpace.Memberx - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!public AbstractDoubleVector scalarDivide(double x)
scalarDivide in class AbstractDoubleVectorx - a double
public double scalarProduct(AbstractDoubleVector v)
scalarProduct in class AbstractDoubleVectorv - a double vector
IllegalDimensionException - If the vectors are different sizes.public double scalarProduct(DoubleVector v)
v - DOCUMENT ME!
IllegalDimensionException - DOCUMENT ME!public double scalarProduct(DoubleSparseVector v)
v - a double sparse vector
IllegalDimensionException - If the vectors are different sizes.public DoubleSparseMatrix tensorProduct(DoubleSparseVector v)
v - DOCUMENT ME!
public AbstractDoubleVector mapElements(PrimitiveMapping f)
mapElements in class AbstractDoubleVectorf - a user-defined function
public double[] toPrimitiveArray()
toPrimitiveArray in class AbstractDoubleVectorpublic java.lang.Object clone()
clone in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||