|
|||||||||
| 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.IntegerVector
public class IntegerVector
An array-based implementation of an integer vector.
| Field Summary | |
|---|---|
protected int[] |
vector
Array containing the components of the vector. |
| Constructor Summary | |
|---|---|
IntegerVector(AbstractIntegerVector vec)
Constructs a vector by copying a vector. |
|
IntegerVector(int dim)
Constructs an empty vector. |
|
IntegerVector(int[] array)
Constructs a vector by wrapping 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. |
IntegerVector |
add(IntegerVector v)
DOCUMENT ME! |
java.lang.Object |
clone()
Clone vector into a new vector. |
boolean |
equals(java.lang.Object a,
double tol)
Compares two Integer vectors for equality. |
int |
getPrimitiveElement(int n)
Returns a component of this vector. |
int |
infNorm()
Returns the l -norm. |
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). |
double |
norm(int n)
Returns the ln-norm. |
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(IntegerVector v)
DOCUMENT ME! |
void |
setAllElements(int r)
Sets the value of all elements of the vector. |
void |
setElement(int n,
int x)
Sets the value of a component of this 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. |
IntegerVector |
subtract(IntegerVector v)
DOCUMENT ME! |
int |
sumSquares()
Returns the sum of the squares of the components. |
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. |
java.lang.String |
toString()
Returns a comma delimited string representing the value of this vector. |
| Methods inherited from class org.jscience.mathematics.algebraic.matrices.AbstractIntegerVector |
|---|
abs, equals, getColumn, getElement, getRow, getSubVector, hashCode, max, mean, min, multiply, read, reverse, scalarDivide, setColumn, setElement, setRow, setSubVector, standardDeviation, tensorProduct, toMatrix, 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 |
| Field Detail |
|---|
protected int[] vector
| Constructor Detail |
|---|
public IntegerVector(int dim)
dim - the dimension of the vector.public IntegerVector(int[] array)
array - an assigned valuepublic IntegerVector(AbstractIntegerVector vec)
vec - an assigned value| Method Detail |
|---|
public boolean equals(java.lang.Object a,
double tol)
equals in class AbstractIntegerVectora - a Integer vector.tol - DOCUMENT ME!
public java.lang.String toString()
toString in class AbstractIntegerVectorpublic AbstractDoubleVector toDoubleVector()
toDoubleVector in class AbstractIntegerVectorpublic AbstractComplexVector toComplexVector()
toComplexVector in class AbstractIntegerVectorpublic int getPrimitiveElement(int n)
getPrimitiveElement in class AbstractIntegerVectorn - index of the vector component
IllegalDimensionException - If attempting to access an invalid
component.
public void setElement(int n,
int x)
setElement in class AbstractIntegerVectorn - index of the vector componentx - an integer
IllegalDimensionException - If attempting to access an invalid
component.public void setAllElements(int r)
setAllElements in class AbstractIntegerVectorr - a int elementpublic double norm(int n)
norm in class AbstractIntegerVectorn - DOCUMENT ME!
java.lang.ArithmeticException - DOCUMENT ME!public double norm()
norm in class AbstractIntegerVectorjava.lang.ArithmeticException - DOCUMENT ME!public int infNorm()
-norm.
infNorm in class AbstractIntegerVectorjava.lang.ArithmeticException - DOCUMENT ME!public int sumSquares()
sumSquares in class AbstractIntegerVectorjava.lang.ArithmeticException - DOCUMENT ME!public int mass()
mass in class AbstractIntegerVectorjava.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 AbstractIntegerVector add(AbstractIntegerVector v)
add in class AbstractIntegerVectorv - an integer vector
IllegalDimensionException - If the vectors are different sizes.public IntegerVector add(IntegerVector v)
v - DOCUMENT ME!
IllegalDimensionException - DOCUMENT ME!public AbelianGroup.Member subtract(AbelianGroup.Member v)
subtract in interface AbelianGroup.Memberv - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!public AbstractIntegerVector subtract(AbstractIntegerVector v)
subtract in class AbstractIntegerVectorv - an integer vector
IllegalDimensionException - If the vectors are different sizes.public IntegerVector subtract(IntegerVector v)
v - DOCUMENT ME!
IllegalDimensionException - DOCUMENT ME!public Module.Member scalarMultiply(Ring.Member x)
scalarMultiply in interface Module.Memberx - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!public AbstractIntegerVector scalarMultiply(int x)
scalarMultiply in class AbstractIntegerVectorx - an integer
public int scalarProduct(AbstractIntegerVector v)
scalarProduct in class AbstractIntegerVectorv - an integer vector
IllegalDimensionException - If the vectors are different sizes.public int scalarProduct(IntegerVector v)
v - DOCUMENT ME!
IllegalDimensionException - DOCUMENT ME!public AbstractDoubleVector mapElements(PrimitiveMapping f)
mapElements in class AbstractIntegerVectorf - a user-defined function.
public int[] toPrimitiveArray()
toPrimitiveArray in class AbstractIntegerVectorpublic 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 | ||||||||