jsci.maths.vectors
Class IntegerVector
- java.lang.Object
-
- jsci.maths.vectors.MathVector
-
- jsci.maths.vectors.AbstractIntegerVector
-
- jsci.maths.vectors.IntegerVector
-
- All Implemented Interfaces:
- java.io.Serializable, Module.Member, AbelianGroup.Member, Member
public class IntegerVector extends AbstractIntegerVector
An array-based implementation of an integer vector.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description IntegerVector(int dim)Constructs an empty vector.IntegerVector(int[] array)Constructs a vector by wrapping an array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description AbelianGroup.Memberadd(AbelianGroup.Member v)Returns the addition of this vector and another.AbstractIntegerVectoradd(AbstractIntegerVector v)Returns the addition of this vector and another.IntegerVectoradd(IntegerVector v)booleanequals(java.lang.Object a)Compares two integer vectors for equality.intgetComponent(int n)Returns a component of this vector.doubleinfNorm()Returns the l
-norm.AbelianGroup.Membernegate()Returns the negative of this vector.doublenorm()Returns the l2-norm (magnitude).doublenorm(int n)Returns the ln-norm.AbstractIntegerVectorscalarMultiply(int x)Returns the multiplication of this vector by a scalar.Module.MemberscalarMultiply(Ring.Member x)Returns the multiplication of this vector by a scalar.intscalarProduct(AbstractIntegerVector v)Returns the scalar product of this vector and another.intscalarProduct(IntegerVector v)voidsetComponent(int n, int x)Sets the value of a component of this vector.AbelianGroup.Membersubtract(AbelianGroup.Member v)Returns the subtraction of this vector by another.AbstractIntegerVectorsubtract(AbstractIntegerVector v)Returns the subtraction of this vector by another.IntegerVectorsubtract(IntegerVector v)AbstractComplexVectortoComplexVector()Converts this vector to a complex vector.AbstractDoubleVectortoDoubleVector()Converts this vector to a double vector.java.lang.StringtoString()Returns a comma delimited string representing the value of this vector.-
Methods inherited from class jsci.maths.vectors.AbstractIntegerVector
getSet, hashCode
-
Methods inherited from class jsci.maths.vectors.MathVector
dimension
-
-
-
-
Constructor Detail
-
IntegerVector
public IntegerVector(int dim)
Constructs an empty vector.- Parameters:
dim- the dimension of the vector.
-
IntegerVector
public IntegerVector(int[] array)
Constructs a vector by wrapping an array.- Parameters:
array- an assigned value
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object a)
Compares two integer vectors for equality.- Overrides:
equalsin classAbstractIntegerVector- Parameters:
a- an integer vector
-
toString
public java.lang.String toString()
Returns a comma delimited string representing the value of this vector.- Overrides:
toStringin classAbstractIntegerVector
-
toDoubleVector
public AbstractDoubleVector toDoubleVector()
Converts this vector to a double vector.- Overrides:
toDoubleVectorin classAbstractIntegerVector- Returns:
- a double vector
-
toComplexVector
public AbstractComplexVector toComplexVector()
Converts this vector to a complex vector.- Returns:
- a complex vector
-
getComponent
public int getComponent(int n)
Returns a component of this vector.- Specified by:
getComponentin classAbstractIntegerVector- Parameters:
n- index of the vector component- Throws:
VectorDimensionException- If attempting to access an invalid component.
-
setComponent
public void setComponent(int n, int x)Sets the value of a component of this vector.- Specified by:
setComponentin classAbstractIntegerVector- Parameters:
n- index of the vector componentx- an integer- Throws:
VectorDimensionException- If attempting to access an invalid component.
-
norm
public double norm(int n)
Returns the ln-norm.- Overrides:
normin classAbstractIntegerVector
-
norm
public double norm()
Returns the l2-norm (magnitude).- Overrides:
normin classAbstractIntegerVector
-
infNorm
public double infNorm()
Returns the l
-norm.- Overrides:
infNormin classAbstractIntegerVector
-
negate
public AbelianGroup.Member negate()
Returns the negative of this vector.
-
add
public AbelianGroup.Member add(AbelianGroup.Member v)
Returns the addition of this vector and another.- Parameters:
v- a group member
-
add
public AbstractIntegerVector add(AbstractIntegerVector v)
Returns the addition of this vector and another.- Specified by:
addin classAbstractIntegerVector- Parameters:
v- an integer vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
add
public IntegerVector add(IntegerVector v)
-
subtract
public AbelianGroup.Member subtract(AbelianGroup.Member v)
Returns the subtraction of this vector by another.- Parameters:
v- a group member
-
subtract
public AbstractIntegerVector subtract(AbstractIntegerVector v)
Returns the subtraction of this vector by another.- Specified by:
subtractin classAbstractIntegerVector- Parameters:
v- an integer vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
subtract
public IntegerVector subtract(IntegerVector v)
-
scalarMultiply
public Module.Member scalarMultiply(Ring.Member x)
Returns the multiplication of this vector by a scalar.- Parameters:
x- a ring member
-
scalarMultiply
public AbstractIntegerVector scalarMultiply(int x)
Returns the multiplication of this vector by a scalar.- Specified by:
scalarMultiplyin classAbstractIntegerVector- Parameters:
x- an integer
-
scalarProduct
public int scalarProduct(AbstractIntegerVector v)
Returns the scalar product of this vector and another.- Specified by:
scalarProductin classAbstractIntegerVector- Parameters:
v- an integer vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
scalarProduct
public int scalarProduct(IntegerVector v)
-
-
DMelt 3.0 © DataMelt by jWork.ORG