jsci.maths.vectors
Class AbstractIntegerVector
- java.lang.Object
-
- jsci.maths.vectors.MathVector
-
- jsci.maths.vectors.AbstractIntegerVector
-
- All Implemented Interfaces:
- java.io.Serializable, Module.Member, AbelianGroup.Member, Member
- Direct Known Subclasses:
- Integer2Vector, Integer3Vector, IntegerVector
public abstract class AbstractIntegerVector extends MathVector
The AbstractIntegerVector class encapsulates vectors containing integers.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract AbstractIntegerVectoradd(AbstractIntegerVector v)Returns the addition of this vector and another.booleanequals(java.lang.Object obj)Compares two integer vectors for equality.abstract intgetComponent(int n)Returns a component of this vector.java.lang.ObjectgetSet()inthashCode()Returns a hashcode for this vector.doubleinfNorm()Returns the l
-norm.doublenorm()Returns the l2-norm (magnitude).doublenorm(int n)Returns the ln-norm.abstract AbstractIntegerVectorscalarMultiply(int x)Returns the multiplication of this vector by a scalar.abstract intscalarProduct(AbstractIntegerVector v)Returns the scalar product of this vector and another.abstract voidsetComponent(int n, int x)Sets the value of a component of this vector.abstract AbstractIntegerVectorsubtract(AbstractIntegerVector v)Returns the subtraction of this vector by another.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.MathVector
dimension
-
Methods inherited from interface jsci.maths.algebras.Module.Member
scalarMultiply
-
Methods inherited from interface jsci.maths.groups.AbelianGroup.Member
add, negate, subtract
-
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Compares two integer vectors for equality. Two vectors are considered to be equal if the norm of their difference is zero.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- an integer vector
-
toString
public java.lang.String toString()
Returns a comma delimited string representing the value of this vector.- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hashcode for this vector.- Overrides:
hashCodein classjava.lang.Object
-
toDoubleVector
public AbstractDoubleVector toDoubleVector()
Converts this vector to a double vector.- Returns:
- a double vector
-
getComponent
public abstract int getComponent(int n)
Returns a component of this vector.- Parameters:
n- index of the vector component- Throws:
VectorDimensionException- If attempting to access an invalid component.
-
setComponent
public abstract void setComponent(int n, int x)Sets the value of a component of this vector.- Parameters:
n- index of the vector componentx- an integer- Throws:
VectorDimensionException- If attempting to access an invalid component.
-
getSet
public java.lang.Object getSet()
-
norm
public double norm(int n)
Returns the ln-norm.
-
norm
public double norm()
Returns the l2-norm (magnitude).- Specified by:
normin classMathVector
-
infNorm
public double infNorm()
Returns the l
-norm.
-
add
public abstract AbstractIntegerVector add(AbstractIntegerVector v)
Returns the addition of this vector and another.- Parameters:
v- an integer vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
subtract
public abstract AbstractIntegerVector subtract(AbstractIntegerVector v)
Returns the subtraction of this vector by another.- Parameters:
v- an integer vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
scalarMultiply
public abstract AbstractIntegerVector scalarMultiply(int x)
Returns the multiplication of this vector by a scalar.- Parameters:
x- an integer
-
scalarProduct
public abstract int scalarProduct(AbstractIntegerVector v)
Returns the scalar product of this vector and another.- Parameters:
v- an integer vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
-
DMelt 3.0 © DataMelt by jWork.ORG