|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSci.maths.MathVector
JSci.maths.DoubleVector
public class DoubleVector
The DoubleVector class encapsulates double vectors.
Field Summary | |
---|---|
protected static int |
ARRAY_1D
Storage format identifier. |
protected double[] |
vector
Array containing the components of the vector. |
Fields inherited from class JSci.maths.MathVector |
---|
CLASS_SPECIFIC, N, storageFormat |
Constructor Summary | |
---|---|
|
DoubleVector(double[] array)
Constructs a vector by wrapping an array. |
|
DoubleVector(int dim)
Constructs an empty vector. |
protected |
DoubleVector(int dim,
int storeID)
|
Method Summary | |
---|---|
AbelianGroup.Member |
add(AbelianGroup.Member v)
Returns the addition of this vector and another. |
DoubleVector |
add(DoubleVector v)
Returns the addition of this vector and another. |
boolean |
equals(java.lang.Object a)
Compares two double vectors for equality. |
double |
getComponent(int n)
Returns a component of this vector. |
int |
hashCode()
Returns a hashcode for this vector. |
double |
infNorm()
Returns the l ![]() |
DoubleVector |
mapComponents(Mapping f)
Applies a function on all the vector components. |
AbelianGroup.Member |
negate()
Returns the negative of this vector. |
double |
norm()
Returns the l2-norm (magnitude). |
double |
norm(int n)
Returns the ln-norm. |
void |
normalize()
Makes the norm of this vector equal to 1. |
DoubleVector |
scalarDivide(double x)
Returns the division of this vector by a scalar. |
VectorSpace.Member |
scalarDivide(Field.Member x)
Returns the division of this vector by a scalar. |
DoubleVector |
scalarMultiply(double x)
Returns the multiplication of this vector by a scalar. |
Module.Member |
scalarMultiply(Ring.Member x)
Returns the multiplication of this vector by a scalar. |
double |
scalarProduct(DoubleVector v)
Returns the scalar product of this vector and another. |
void |
setComponent(int n,
double x)
Sets the value of a component of this vector. |
AbelianGroup.Member |
subtract(AbelianGroup.Member v)
Returns the subtraction of this vector by another. |
DoubleVector |
subtract(DoubleVector v)
Returns the subtraction of this vector by another. |
ComplexVector |
toComplexVector()
Converts this vector to a complex vector. |
IntegerVector |
toIntegerVector()
Converts this vector to an integer vector. |
java.lang.String |
toString()
Returns a comma delimited string representing the value of this vector. |
Methods inherited from class JSci.maths.MathVector |
---|
dimension, getInvalidComponentMsg |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int ARRAY_1D
protected double[] vector
Constructor Detail |
---|
protected DoubleVector(int dim, int storeID)
public DoubleVector(int dim)
dim
- the dimension of the vector.public DoubleVector(double[] array)
array
- an assigned value.Method Detail |
---|
public boolean equals(java.lang.Object a)
equals
in class java.lang.Object
a
- a double vector.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public IntegerVector toIntegerVector()
public ComplexVector toComplexVector()
public double getComponent(int n)
n
- index of the vector component.
VectorDimensionException
- If attempting to access an invalid component.public void setComponent(int n, double x)
n
- index of the vector component.x
- a number.
VectorDimensionException
- If attempting to access an invalid component.public double norm(int n)
public double norm()
norm
in interface BanachSpace.Member
norm
in class MathVector
public void normalize()
public double infNorm()
public AbelianGroup.Member negate()
negate
in interface AbelianGroup.Member
public AbelianGroup.Member add(AbelianGroup.Member v)
add
in interface AbelianGroup.Member
v
- a group memberpublic DoubleVector add(DoubleVector v)
v
- a double vector.
VectorDimensionException
- If the vectors are different sizes.public AbelianGroup.Member subtract(AbelianGroup.Member v)
subtract
in interface AbelianGroup.Member
v
- a group memberpublic DoubleVector subtract(DoubleVector v)
v
- a double vector.
VectorDimensionException
- If the vectors are different sizes.public Module.Member scalarMultiply(Ring.Member x)
scalarMultiply
in interface Module.Member
x
- a ring memberpublic DoubleVector scalarMultiply(double x)
x
- a double.public VectorSpace.Member scalarDivide(Field.Member x)
scalarDivide
in interface VectorSpace.Member
x
- a field memberpublic DoubleVector scalarDivide(double x)
x
- a double.
java.lang.ArithmeticException
- If divide by zero.public double scalarProduct(DoubleVector v)
v
- a double vector.
VectorDimensionException
- If the vectors are different sizes.public DoubleVector mapComponents(Mapping f)
f
- a user-defined function.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |