|
|||||||||
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.AbstractIntegerVector
org.jscience.mathematics.algebraic.matrices.IntegerSparseVector
public class IntegerSparseVector
The IntegerSparseVector class encapsulates sparse vectors. Uses Morse-coding.
Constructor Summary | |
---|---|
IntegerSparseVector(AbstractIntegerVector vec)
Constructs a vector by copying a vector. |
|
IntegerSparseVector(int dim)
Constructs an empty vector. |
|
IntegerSparseVector(int[] array)
Constructs a vector from an array. |
Method Summary | |
---|---|
AbelianGroup.Member |
add(AbelianGroup.Member v)
Returns the addition of this vector and another. |
AbstractIntegerVector |
add(AbstractIntegerVector v)
Returns the addition of this vector and another. |
IntegerSparseVector |
add(IntegerSparseVector v)
Returns the addition of this vector and another. |
IntegerVector |
add(IntegerVector 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. |
int |
getPrimitiveElement(int n)
Returns a component of this vector. |
AbstractDoubleVector |
mapElements(PrimitiveMapping f)
Applies a function on all the vector components. |
int |
mass()
Returns the mass. |
AbelianGroup.Member |
negate()
Returns the negative of this vector. |
double |
norm()
Returns the l2-norm (magnitude). |
AbstractIntegerVector |
scalarMultiply(int 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. |
int |
scalarProduct(AbstractIntegerVector v)
Returns the scalar product of this vector and another. |
int |
scalarProduct(IntegerSparseVector v)
Returns the scalar product of this vector and another. |
int |
scalarProduct(IntegerVector v)
DOCUMENT ME! |
void |
setElement(int n,
int x)
Sets the value of a component of this vector. |
void |
setElements(int r)
Sets the value of all elements of the vector. |
AbelianGroup.Member |
subtract(AbelianGroup.Member v)
Returns the subtraction of this vector by another. |
AbstractIntegerVector |
subtract(AbstractIntegerVector v)
Returns the subtraction of this vector by another. |
IntegerSparseVector |
subtract(IntegerSparseVector v)
Returns the subtraction of this vector by another. |
IntegerVector |
subtract(IntegerVector v)
DOCUMENT ME! |
int |
sumSquares()
Returns the sum of the squares of the components. |
IntegerSparseMatrix |
tensorProduct(IntegerSparseVector v)
Returns the tensor product of this vector and another. |
AbstractComplexVector |
toComplexVector()
Converts this vector to a complex vector. |
AbstractDoubleVector |
toDoubleVector()
Converts this vector to a double vector. |
int[] |
toPrimitiveArray()
Projects the vector to an array. |
Methods inherited from class org.jscience.mathematics.algebraic.matrices.AbstractIntegerVector |
---|
abs, equals, getColumn, getElement, getRow, getSubVector, hashCode, infNorm, max, mean, min, multiply, norm, read, reverse, scalarDivide, setAllElements, 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 IntegerSparseVector(int dim)
dim
- the dimension of the vector.public IntegerSparseVector(int[] array)
array
- DOCUMENT ME!public IntegerSparseVector(AbstractIntegerVector vec)
vec
- an assigned valueMethod Detail |
---|
public boolean equals(java.lang.Object obj, double tol)
equals
in class AbstractIntegerVector
obj
- a Integer sparse vectortol
- DOCUMENT ME!
public AbstractDoubleVector toDoubleVector()
toDoubleVector
in class AbstractIntegerVector
public AbstractComplexVector toComplexVector()
toComplexVector
in class AbstractIntegerVector
public int getPrimitiveElement(int n)
getPrimitiveElement
in class AbstractIntegerVector
n
- index of the vector component
IllegalDimensionException
- If attempting to access an invalid
component.public void setElement(int n, int x)
setElement
in class AbstractIntegerVector
n
- index of the vector componentx
- a number
IllegalDimensionException
- If attempting to access an invalid
component.public void setElements(int r)
r
- a int elementpublic double norm()
norm
in class AbstractIntegerVector
java.lang.ArithmeticException
- DOCUMENT ME!public int sumSquares()
sumSquares
in class AbstractIntegerVector
java.lang.ArithmeticException
- DOCUMENT ME!public int mass()
mass
in class AbstractIntegerVector
java.lang.ArithmeticException
- DOCUMENT ME!public AbelianGroup.Member negate()
negate
in interface AbelianGroup.Member
public AbelianGroup.Member add(AbelianGroup.Member v)
add
in interface AbelianGroup.Member
v
- DOCUMENT ME!
java.lang.IllegalArgumentException
- DOCUMENT ME!public AbstractIntegerVector add(AbstractIntegerVector v)
add
in class AbstractIntegerVector
v
- an integer vector
IllegalDimensionException
- If the vectors are different sizes.public IntegerVector add(IntegerVector v)
v
- DOCUMENT ME!
IllegalDimensionException
- DOCUMENT ME!public IntegerSparseVector add(IntegerSparseVector v)
v
- an integer sparse vector
IllegalDimensionException
- If the vectors are different sizes.public AbelianGroup.Member subtract(AbelianGroup.Member v)
subtract
in interface AbelianGroup.Member
v
- DOCUMENT ME!
java.lang.IllegalArgumentException
- DOCUMENT ME!public AbstractIntegerVector subtract(AbstractIntegerVector v)
subtract
in class AbstractIntegerVector
v
- an integer vector
IllegalDimensionException
- If the vectors are different sizes.public IntegerVector subtract(IntegerVector v)
v
- DOCUMENT ME!
IllegalDimensionException
- DOCUMENT ME!public IntegerSparseVector subtract(IntegerSparseVector v)
v
- an integer sparse vector
IllegalDimensionException
- If the vectors are different sizes.public Module.Member scalarMultiply(Ring.Member x)
scalarMultiply
in interface Module.Member
x
- DOCUMENT ME!
java.lang.IllegalArgumentException
- DOCUMENT ME!public AbstractIntegerVector scalarMultiply(int x)
scalarMultiply
in class AbstractIntegerVector
x
- an integer
public int scalarProduct(AbstractIntegerVector v)
scalarProduct
in class AbstractIntegerVector
v
- an integer vector
IllegalDimensionException
- If the vectors are different sizes.public int scalarProduct(IntegerVector v)
v
- DOCUMENT ME!
IllegalDimensionException
- DOCUMENT ME!public int scalarProduct(IntegerSparseVector v)
v
- an integer sparse vector
IllegalDimensionException
- If the vectors are different sizes.public IntegerSparseMatrix tensorProduct(IntegerSparseVector v)
v
- DOCUMENT ME!
public AbstractDoubleVector mapElements(PrimitiveMapping f)
mapElements
in class AbstractIntegerVector
f
- a user-defined function
public int[] toPrimitiveArray()
toPrimitiveArray
in class AbstractIntegerVector
public 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 |