jsci.maths.vectors
Class AbstractIntegerVector

java.lang.Object
  extended by jsci.maths.vectors.MathVector
      extended by jsci.maths.vectors.AbstractIntegerVector
All Implemented Interfaces:
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
abstract  AbstractIntegerVector add(AbstractIntegerVector v)
          Returns the addition of this vector and another.
 boolean equals(Object obj)
          Compares two integer vectors for equality.
abstract  int getComponent(int n)
          Returns a component of this vector.
 Object getSet()
           
 int hashCode()
          Returns a hashcode for this vector.
 double infNorm()
          Returns the linfinity-norm.
 double norm()
          Returns the l2-norm (magnitude).
 double norm(int n)
          Returns the ln-norm.
abstract  AbstractIntegerVector scalarMultiply(int x)
          Returns the multiplication of this vector by a scalar.
abstract  int scalarProduct(AbstractIntegerVector v)
          Returns the scalar product of this vector and another.
abstract  void setComponent(int n, int x)
          Sets the value of a component of this vector.
abstract  AbstractIntegerVector subtract(AbstractIntegerVector v)
          Returns the subtraction of this vector by another.
 AbstractDoubleVector toDoubleVector()
          Converts this vector to a double vector.
 String toString()
          Returns a comma delimited string representing the value of this vector.
 
Methods inherited from class jsci.maths.vectors.MathVector
dimension
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
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(Object obj)
Compares two integer vectors for equality. Two vectors are considered to be equal if the norm of their difference is zero.

Overrides:
equals in class Object
Parameters:
obj - an integer vector

toString

public String toString()
Returns a comma delimited string representing the value of this vector.

Overrides:
toString in class Object

hashCode

public int hashCode()
Returns a hashcode for this vector.

Overrides:
hashCode in class 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 component
x - an integer
Throws:
VectorDimensionException - If attempting to access an invalid component.

getSet

public Object getSet()

norm

public double norm(int n)
Returns the ln-norm.


norm

public double norm()
Returns the l2-norm (magnitude).

Specified by:
norm in class MathVector

infNorm

public double infNorm()
Returns the linfinity-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.


jHepWork 3.1 ©