public class DoubleVector extends MathVector implements BanachSpace.Member
| Modifier and Type | Field and Description |
|---|---|
protected static int |
ARRAY_1D
Storage format identifier.
|
protected double[] |
vector
Array containing the components of the vector.
|
CLASS_SPECIFIC, N, storageFormat| Modifier | Constructor and Description |
|---|---|
|
DoubleVector(double[] array)
Constructs a vector by wrapping an array.
|
|
DoubleVector(int dim)
Constructs an empty vector.
|
protected |
DoubleVector(int dim,
int storeID) |
| Modifier and Type | Method and Description |
|---|---|
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
-norm. |
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.
|
dimension, getInvalidComponentMsgprotected static final int ARRAY_1D
protected double[] vector
protected DoubleVector(int dim,
int storeID)
public DoubleVector(int dim)
dim - the dimension of the vector.public DoubleVector(double[] array)
array - an assigned value.public boolean equals(java.lang.Object a)
equals in class java.lang.Objecta - a double vector.public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic 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.Membernorm in class MathVectorpublic void normalize()
public double infNorm()
-norm.public AbelianGroup.Member negate()
negate in interface AbelianGroup.Memberpublic AbelianGroup.Member add(AbelianGroup.Member v)
add in interface AbelianGroup.Memberv - 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.Memberv - 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.Memberx - a ring memberpublic DoubleVector scalarMultiply(double x)
x - a double.public VectorSpace.Member scalarDivide(Field.Member x)
scalarDivide in interface VectorSpace.Memberx - 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.