jsci.maths.vectors
Class Integer3Vector
- java.lang.Object
-
- jsci.maths.vectors.MathVector
-
- jsci.maths.vectors.AbstractIntegerVector
-
- jsci.maths.vectors.Integer3Vector
-
- All Implemented Interfaces:
- java.io.Serializable, Module.Member, AbelianGroup.Member, Member
public final class Integer3Vector extends AbstractIntegerVector
An optimised implementation of a 3D integer vector.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Integer3Vector()Constructs an empty 3-vector.Integer3Vector(int[] array)Constructs a 3-vector.Integer3Vector(int x, int y, int z)Constructs a 3-vector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description AbelianGroup.Memberadd(AbelianGroup.Member vec)Returns the addition of this vector and another.AbstractIntegerVectoradd(AbstractIntegerVector vec)Returns the addition of this vector and another.booleanequals(java.lang.Object obj, double tol)Compares two integer vectors for equality.intgetComponent(int n)Returns a component of this vector.doubleinfNorm()Returns the l
-norm.Integer3Vectormultiply(Integer3Vector vec)Returns the vector product of this vector and another (so(3) algebra).AbelianGroup.Membernegate()Returns the negative of this vector.doublenorm()Returns the l2-norm (magnitude).doublenorm(int n)Returns the ln-norm.AbstractIntegerVectorscalarMultiply(int k)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 vec)Returns the scalar product of this vector and another.voidsetComponent(int n, int value)Sets the value of a component of this vector.AbelianGroup.Membersubtract(AbelianGroup.Member vec)Returns the subtraction of this vector by another.AbstractIntegerVectorsubtract(AbstractIntegerVector vec)Returns the subtraction of this vector by another.AbstractComplexVectortoComplexVector()Converts this 3-vector to a complex 3-vector.AbstractDoubleVectortoDoubleVector()Converts this 3-vector to a double 3-vector.java.lang.StringtoString()Returns a comma delimited string representing the value of this vector.-
Methods inherited from class jsci.maths.vectors.AbstractIntegerVector
equals, getSet, hashCode
-
Methods inherited from class jsci.maths.vectors.MathVector
dimension
-
-
-
-
Constructor Detail
-
Integer3Vector
public Integer3Vector()
Constructs an empty 3-vector.
-
Integer3Vector
public Integer3Vector(int x, int y, int z)Constructs a 3-vector.- Parameters:
x- x coordinate.y- y coordinate.z- z coordinate.
-
Integer3Vector
public Integer3Vector(int[] array)
Constructs a 3-vector.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj, double tol)Compares two integer vectors for equality.- Parameters:
obj- a integer 3-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 3-vector to a double 3-vector.- Overrides:
toDoubleVectorin classAbstractIntegerVector- Returns:
- a double 3-vector
-
toComplexVector
public AbstractComplexVector toComplexVector()
Converts this 3-vector to a complex 3-vector.- Returns:
- a complex 3-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 value)Sets the value of a component of this vector. Should only be used to initialise this vector.- Specified by:
setComponentin classAbstractIntegerVector- Parameters:
n- index of the vector componentvalue- a number- 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 vec)
Returns the addition of this vector and another.- Parameters:
vec- a group member
-
add
public AbstractIntegerVector add(AbstractIntegerVector vec)
Returns the addition of this vector and another.- Specified by:
addin classAbstractIntegerVector- Parameters:
vec- a integer 3-vector
-
subtract
public AbelianGroup.Member subtract(AbelianGroup.Member vec)
Returns the subtraction of this vector by another.- Parameters:
vec- a group member
-
subtract
public AbstractIntegerVector subtract(AbstractIntegerVector vec)
Returns the subtraction of this vector by another.- Specified by:
subtractin classAbstractIntegerVector- Parameters:
vec- a integer 3-vector
-
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 k)
Returns the multiplication of this vector by a scalar.- Specified by:
scalarMultiplyin classAbstractIntegerVector- Parameters:
k- a integer- Returns:
- a integer 3-vector
-
scalarProduct
public int scalarProduct(AbstractIntegerVector vec)
Returns the scalar product of this vector and another.- Specified by:
scalarProductin classAbstractIntegerVector- Parameters:
vec- a integer 3-vector
-
multiply
public Integer3Vector multiply(Integer3Vector vec)
Returns the vector product of this vector and another (so(3) algebra).- Parameters:
vec- a integer 3-vector
-
-
DMelt 3.0 © DataMelt by jWork.ORG