|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSci.maths.MathVector
JSci.maths.IntegerVector
public class IntegerVector
The IntegerVector class encapsulates vectors containing integers.
Field Summary | |
---|---|
protected static int |
ARRAY_1D
Storage format identifier. |
protected int[] |
vector
Array containing the components of the vector. |
Fields inherited from class JSci.maths.MathVector |
---|
CLASS_SPECIFIC, N, storageFormat |
Constructor Summary | |
---|---|
|
IntegerVector(int dim)
Constructs an empty vector. |
|
IntegerVector(int[] array)
Constructs a vector by wrapping an array. |
protected |
IntegerVector(int dim,
int storeID)
|
Method Summary | |
---|---|
AbelianGroup.Member |
add(AbelianGroup.Member v)
Returns the addition of this vector and another. |
IntegerVector |
add(IntegerVector v)
Returns the addition of this vector and another. |
boolean |
equals(java.lang.Object a)
Compares two integer vectors for equality. |
int |
getComponent(int n)
Returns a component of this vector. |
int |
hashCode()
Returns a hashcode for this vector. |
double |
infNorm()
Returns the l ![]() |
AbelianGroup.Member |
negate()
Returns the negative of this vector. |
double |
norm()
Returns the l2-norm (magnitude). |
double |
norm(int n)
Returns the ln-norm. |
IntegerVector |
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(IntegerVector v)
Returns the scalar product of this vector and another. |
void |
setComponent(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. |
IntegerVector |
subtract(IntegerVector v)
Returns the subtraction of this vector by another. |
ComplexVector |
toComplexVector()
Converts this vector to a complex vector. |
DoubleVector |
toDoubleVector()
Converts this vector to a double vector. |
java.lang.String |
toString()
Returns a comma delimited string representing the value of this vector. |
Methods inherited from class JSci.maths.MathVector |
---|
dimension, getInvalidComponentMsg |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int ARRAY_1D
protected int[] vector
Constructor Detail |
---|
protected IntegerVector(int dim, int storeID)
public IntegerVector(int dim)
dim
- the dimension of the vector.public IntegerVector(int[] array)
array
- an assigned valueMethod Detail |
---|
public boolean equals(java.lang.Object a)
equals
in class java.lang.Object
a
- an integer vectorpublic java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public DoubleVector toDoubleVector()
public ComplexVector toComplexVector()
public int getComponent(int n)
n
- index of the vector component
VectorDimensionException
- If attempting to access an invalid component.public void setComponent(int n, int x)
n
- index of the vector componentx
- an integer
VectorDimensionException
- If attempting to access an invalid component.public double norm(int n)
public double norm()
norm
in class MathVector
public double infNorm()
public AbelianGroup.Member negate()
public AbelianGroup.Member add(AbelianGroup.Member v)
v
- a group memberpublic IntegerVector add(IntegerVector v)
v
- an integer vector
VectorDimensionException
- If the vectors are different sizes.public AbelianGroup.Member subtract(AbelianGroup.Member v)
v
- a group memberpublic IntegerVector subtract(IntegerVector v)
v
- an integer vector
VectorDimensionException
- If the vectors are different sizes.public Module.Member scalarMultiply(Ring.Member x)
x
- a ring memberpublic IntegerVector scalarMultiply(int x)
x
- an integerpublic int scalarProduct(IntegerVector v)
v
- an integer vector
VectorDimensionException
- If the vectors are different sizes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |