All Packages Class Hierarchy This Package Previous Next Index
Class JSci.maths.DoubleVector
java.lang.Object
|
+----JSci.maths.MathVector
|
+----JSci.maths.DoubleVector
- public class DoubleVector
- extends MathVector
The DoubleVector class encapsulates double vectors.
-
ARRAY_1D
- Storage format identifier.
-
storageFormat
-
-
vector
- Array containing the components of the vector.
-
DoubleVector(double[])
- Constructs a vector by wrapping an array.
-
DoubleVector(int)
- Constructs an empty vector.
-
add(AbelianGroupMember)
- Returns the addition of this vector and another.
-
add(DoubleVector)
- Returns the addition of this vector and another.
-
dimension()
- Returns the vector's dimension.
-
equals(Object)
- Compares two double vectors for equality.
-
getComponent(int)
- Returns a component of this vector.
-
hashCode()
- Returns a hashcode for this vector.
-
infNorm()
- Returns the l(infinity)-norm.
-
mapComponents(Mapping)
- Applies a function on all the vector components.
-
negate()
- Returns the negative of this vector.
-
norm()
- Returns the l2-norm (magnitude).
-
norm(int)
- Returns the ln-norm.
-
scalarDivide(double)
- Returns the division of this vector by a scalar.
-
scalarMultiply(double)
- Returns the multiplication of this vector by a scalar.
-
scalarMultiply(RingMember)
- Returns the multiplication of this vector by a scalar.
-
scalarProduct(DoubleVector)
- Returns the scalar product of this vector and another.
-
setComponent(int, double)
- Sets the value of a component of this vector.
-
subtract(AbelianGroupMember)
- Returns the subtraction of this vector by another.
-
subtract(DoubleVector)
- Returns the subtraction of this vector by another.
-
toComplexVector()
- Converts this vector to a complex vector.
-
toIntegerVector()
- Converts this vector to an integer vector.
-
toString()
- Returns a comma delimited string representing the value of this vector.
ARRAY_1D
protected static final int ARRAY_1D
- Storage format identifier.
storageFormat
protected static final int storageFormat
vector
protected double vector[]
- Array containing the components of the vector.
DoubleVector
public DoubleVector(int dim)
- Constructs an empty vector.
- Parameters:
- dim - the dimension of the vector.
DoubleVector
public DoubleVector(double array[])
- Constructs a vector by wrapping an array.
- Parameters:
- array - an assigned value
equals
public boolean equals(Object a)
- Compares two double vectors for equality.
- Parameters:
- a - a double vector
- Overrides:
- equals in class Object
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
toIntegerVector
public IntegerVector toIntegerVector()
- Converts this vector to an integer vector.
- Returns:
- an integer vector
toComplexVector
public ComplexVector toComplexVector()
- Converts this vector to a complex vector.
- Returns:
- a complex vector
getComponent
public double 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 void setComponent(int n,
double x)
- Sets the value of a component of this vector.
- Parameters:
- n - index of the vector component
- x - a number
- Throws: VectorDimensionException
- If attempting to access an invalid component.
dimension
public int dimension()
- Returns the vector's dimension.
- Overrides:
- dimension in class MathVector
norm
public double norm(int n)
- Returns the ln-norm.
norm
public double norm()
- Returns the l2-norm (magnitude).
- Overrides:
- norm in class MathVector
infNorm
public double infNorm()
- Returns the l(infinity)-norm.
negate
public AbelianGroupMember negate()
- Returns the negative of this vector.
- Overrides:
- negate in class MathVector
add
public AbelianGroupMember add(AbelianGroupMember v)
- Returns the addition of this vector and another.
- Overrides:
- add in class MathVector
add
public DoubleVector add(DoubleVector v)
- Returns the addition of this vector and another.
- Parameters:
- v - a double vector
- Throws: VectorDimensionException
- If the vectors are different sizes.
subtract
public AbelianGroupMember subtract(AbelianGroupMember v)
- Returns the subtraction of this vector by another.
- Overrides:
- subtract in class MathVector
subtract
public DoubleVector subtract(DoubleVector v)
- Returns the subtraction of this vector by another.
- Parameters:
- v - a double vector
- Throws: VectorDimensionException
- If the vectors are different sizes.
scalarMultiply
public ModuleMember scalarMultiply(RingMember x)
- Returns the multiplication of this vector by a scalar.
- Overrides:
- scalarMultiply in class MathVector
scalarMultiply
public DoubleVector scalarMultiply(double x)
- Returns the multiplication of this vector by a scalar.
- Parameters:
- x - a double
scalarDivide
public DoubleVector scalarDivide(double x)
- Returns the division of this vector by a scalar.
- Parameters:
- x - a double
- Throws: ArithmeticException
- If divide by zero.
scalarProduct
public double scalarProduct(DoubleVector v)
- Returns the scalar product of this vector and another.
- Parameters:
- v - a double vector
- Throws: VectorDimensionException
- If the vectors are different sizes.
mapComponents
public DoubleVector mapComponents(Mapping f)
- Applies a function on all the vector components.
- Parameters:
- f - a user-defined function
- Returns:
- a double vector
All Packages Class Hierarchy This Package Previous Next Index