JSci.maths
Class Integer3Vector

java.lang.Object
  extended by JSci.maths.MathVector
      extended by JSci.maths.IntegerVector
          extended by JSci.maths.Integer3Vector
All Implemented Interfaces:
java.io.Serializable, Module.Member, AbelianGroup.Member, Member

public class Integer3Vector
extends IntegerVector

The Integer3Vector class encapsulates integer 3-vectors.

Version:
2.0
Author:
Mark Hale
See Also:
Serialized Form

Field Summary
 
Fields inherited from class JSci.maths.IntegerVector
ARRAY_1D, vector
 
Fields inherited from class JSci.maths.MathVector
CLASS_SPECIFIC, N, storageFormat
 
Constructor Summary
Integer3Vector()
          Constructs an empty 3-vector.
Integer3Vector(int[] array)
          Constructs a vector by wrapping an array.
Integer3Vector(int x, int y, int z)
          Constructs a 3-vector.
 
Method Summary
 Integer3Vector add(Integer3Vector 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 linfinity-norm.
 Integer3Vector multiply(Integer3Vector v)
          Returns the vector product of this vector and another.
 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.
 int scalarProduct(Integer3Vector 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.
 Integer3Vector subtract(Integer3Vector v)
          Returns the subtraction of this vector by another.
 ComplexVector toComplexVector()
          Converts this 3-vector to a complex 3-vector.
 DoubleVector toDoubleVector()
          Converts this 3-vector to a double 3-vector.
 java.lang.String toString()
          Returns a comma delimited string representing the value of this vector.
 
Methods inherited from class JSci.maths.IntegerVector
add, add, negate, scalarMultiply, scalarProduct, subtract, subtract
 
Methods inherited from class JSci.maths.MathVector
dimension, getInvalidComponentMsg
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Integer3Vector

public Integer3Vector()
Constructs an empty 3-vector.


Integer3Vector

public Integer3Vector(int[] array)
Constructs a vector by wrapping an array.

Parameters:
array - an assigned value

Integer3Vector

public Integer3Vector(int x,
                      int y,
                      int z)
Constructs a 3-vector.

Parameters:
x - x coordinate
y - y coordinate
z - z coordinate
Method Detail

equals

public boolean equals(java.lang.Object a)
Compares two integer vectors for equality.

Overrides:
equals in class IntegerVector
Parameters:
a - an integer 3-vector

toString

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

Overrides:
toString in class IntegerVector

hashCode

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

Overrides:
hashCode in class IntegerVector

toDoubleVector

public DoubleVector toDoubleVector()
Converts this 3-vector to a double 3-vector.

Overrides:
toDoubleVector in class IntegerVector
Returns:
a double 3-vector

toComplexVector

public ComplexVector toComplexVector()
Converts this 3-vector to a complex 3-vector.

Overrides:
toComplexVector in class IntegerVector
Returns:
a complex 3-vector

getComponent

public int getComponent(int n)
Returns a component of this vector.

Overrides:
getComponent in class IntegerVector
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.

Overrides:
setComponent in class IntegerVector
Parameters:
n - index of the vector component
x - an integer
Throws:
VectorDimensionException - If attempting to access an invalid component.

norm

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

Overrides:
norm in class IntegerVector

norm

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

Overrides:
norm in class IntegerVector

infNorm

public double infNorm()
Returns the linfinity-norm.

Overrides:
infNorm in class IntegerVector

add

public Integer3Vector add(Integer3Vector v)
Returns the addition of this vector and another.

Parameters:
v - an integer 3-vector

subtract

public Integer3Vector subtract(Integer3Vector v)
Returns the subtraction of this vector by another.

Parameters:
v - an integer 3-vector

scalarMultiply

public IntegerVector scalarMultiply(int x)
Returns the multiplication of this vector by a scalar.

Overrides:
scalarMultiply in class IntegerVector
Parameters:
x - an integer
Returns:
an integer 3-vector

scalarProduct

public int scalarProduct(Integer3Vector v)
Returns the scalar product of this vector and another.

Parameters:
v - an integer 3-vector

multiply

public Integer3Vector multiply(Integer3Vector v)
Returns the vector product of this vector and another.

Parameters:
v - an integer 3-vector