public class IntegerVector extends MathVector
Modifier and Type | Field and Description |
---|---|
protected static int |
ARRAY_1D
Storage format identifier.
|
protected int[] |
vector
Array containing the components of the vector.
|
CLASS_SPECIFIC, N, storageFormat
Modifier | Constructor and Description |
---|---|
|
IntegerVector(int dim)
Constructs an empty vector.
|
|
IntegerVector(int[] array)
Constructs a vector by wrapping an array.
|
protected |
IntegerVector(int dim,
int storeID) |
Modifier and Type | Method and Description |
---|---|
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.
|
dimension, getInvalidComponentMsg
protected static final int ARRAY_1D
protected int[] vector
protected IntegerVector(int dim, int storeID)
public IntegerVector(int dim)
dim
- the dimension of the vector.public IntegerVector(int[] array)
array
- an assigned valuepublic 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 componentVectorDimensionException
- If attempting to access an invalid component.public void setComponent(int n, int x)
n
- index of the vector componentx
- an integerVectorDimensionException
- 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 vectorVectorDimensionException
- If the vectors are different sizes.public AbelianGroup.Member subtract(AbelianGroup.Member v)
v
- a group memberpublic IntegerVector subtract(IntegerVector v)
v
- an integer vectorVectorDimensionException
- 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 vectorVectorDimensionException
- If the vectors are different sizes.