|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.mathematics.algebraic.AbstractHypermatrix
org.jscience.mathematics.algebraic.AbstractMatrix
org.jscience.mathematics.algebraic.AbstractVector
org.jscience.mathematics.algebraic.matrices.AbstractDoubleVector
org.jscience.mathematics.algebraic.matrices.DoubleVector
public class DoubleVector
An array-based implementation of an double vector.
| Field Summary | |
|---|---|
protected double[] |
vector
Array containing the components of the vector. |
| Constructor Summary | |
|---|---|
DoubleVector(AbstractDoubleVector vec)
Constructs a vector by copying a vector. |
|
DoubleVector(double[] array)
Constructs a vector by wrapping an array. |
|
DoubleVector(int dim)
Constructs an empty vector. |
|
| Method Summary | |
|---|---|
AbelianGroup.Member |
add(AbelianGroup.Member v)
Returns the addition of this vector and another. |
AbstractDoubleVector |
add(AbstractDoubleVector v)
Returns the addition of this vector and another. |
DoubleVector |
add(DoubleVector v)
|
java.lang.Object |
clone()
Clone vector into a new vector. |
boolean |
equals(java.lang.Object a,
double tol)
Compares two double vectors for equality. |
double |
getPrimitiveElement(int n)
Returns an element of this vector. |
double |
infNorm()
Returns the l -norm. |
AbstractDoubleVector |
mapElements(PrimitiveMapping f)
Applies a function on all the vector components. |
double |
mass()
Returns the mass. |
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. |
AbstractDoubleVector |
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. |
AbstractDoubleVector |
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(AbstractDoubleVector v)
Returns the scalar product of this vector and another. |
double |
scalarProduct(DoubleVector v)
|
void |
setAllElements(double r)
Sets the value of all elements of the vector. |
void |
setElement(int n,
double x)
Sets the value of a element of this vector. |
AbelianGroup.Member |
subtract(AbelianGroup.Member v)
Returns the subtraction of this vector by another. |
AbstractDoubleVector |
subtract(AbstractDoubleVector v)
Returns the subtraction of this vector by another. |
DoubleVector |
subtract(DoubleVector v)
|
double |
sumSquares()
Returns the sum of the squares of the components. |
AbstractComplexVector |
toComplexVector()
Converts this vector to a complex vector. |
AbstractIntegerVector |
toIntegerVector()
Converts this vector to an integer vector. |
double[] |
toPrimitiveArray()
Projects the vector to an array. |
java.lang.String |
toString()
Returns a comma delimited string representing the value of this vector. |
| Methods inherited from class org.jscience.mathematics.algebraic.matrices.AbstractDoubleVector |
|---|
abs, equals, getColumn, getElement, getRow, getSubVector, hashCode, max, mean, min, multiply, read, reverse, setColumn, setElement, setRow, setSubVector, standardDeviation, tensorProduct, toMatrix, transpose, variance |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractVector |
|---|
getDimension, getElement, getInvalidElementMsg, toArray, toArray |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractMatrix |
|---|
getElement, getInvalidElementMsg, numColumns, numRows, print, print, print, print, toArray |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractHypermatrix |
|---|
getDimensions, numDimensions, numElements, numElements, toArray |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jscience.mathematics.algebraic.Matrix |
|---|
numColumns, numRows, toArray |
| Methods inherited from interface org.jscience.mathematics.algebraic.Hypermatrix |
|---|
getDimensions, getElement, numDimensions, numElements, numElements, toArray |
| Field Detail |
|---|
protected double[] vector
| Constructor Detail |
|---|
public DoubleVector(int dim)
dim - the dimension of the vector.public DoubleVector(double[] array)
array - an assigned value.public DoubleVector(AbstractDoubleVector vec)
vec - an assigned value| Method Detail |
|---|
public boolean equals(java.lang.Object a,
double tol)
equals in class AbstractDoubleVectora - a double vector.public java.lang.String toString()
toString in class AbstractDoubleVectorpublic AbstractIntegerVector toIntegerVector()
toIntegerVector in class AbstractDoubleVectorpublic AbstractComplexVector toComplexVector()
toComplexVector in class AbstractDoubleVectorpublic double getPrimitiveElement(int n)
getPrimitiveElement in class AbstractDoubleVectorn - index of the vector element.
IllegalDimensionException - If attempting to access an invalid element .
public void setElement(int n,
double x)
setElement in class AbstractDoubleVectorn - index of the vector element .x - a number.
IllegalDimensionException - If attempting to access an invalid element .public void setAllElements(double r)
setAllElements in class AbstractDoubleVectorr - a ring elementpublic double norm(int n)
norm in class AbstractDoubleVectorpublic double norm()
norm in interface BanachSpace.Membernorm in class AbstractDoubleVectorpublic void normalize()
normalize in class AbstractDoubleVectorpublic double infNorm()
-norm.
infNorm in class AbstractDoubleVectorpublic double sumSquares()
sumSquares in class AbstractDoubleVectorpublic double mass()
mass in class AbstractDoubleVectorpublic AbelianGroup.Member negate()
negate in interface AbelianGroup.Memberpublic AbelianGroup.Member add(AbelianGroup.Member v)
add in interface AbelianGroup.Memberv - a group member
public AbstractDoubleVector add(AbstractDoubleVector v)
add in class AbstractDoubleVectorv - a double vector.
IllegalDimensionException - If the vectors are different sizes.public DoubleVector add(DoubleVector v)
public AbelianGroup.Member subtract(AbelianGroup.Member v)
subtract in interface AbelianGroup.Memberv - a group member
public AbstractDoubleVector subtract(AbstractDoubleVector v)
subtract in class AbstractDoubleVectorv - a double vector.
IllegalDimensionException - If the vectors are different sizes.public DoubleVector subtract(DoubleVector v)
public Module.Member scalarMultiply(Ring.Member x)
scalarMultiply in interface Module.Memberx - a ring member
public AbstractDoubleVector scalarMultiply(double x)
scalarMultiply in class AbstractDoubleVectorx - a double.public VectorSpace.Member scalarDivide(Field.Member x)
scalarDivide in interface VectorSpace.Memberx - a field member
public AbstractDoubleVector scalarDivide(double x)
scalarDivide in class AbstractDoubleVectorx - a double.
java.lang.ArithmeticException - If divide by zero.public double scalarProduct(AbstractDoubleVector v)
scalarProduct in class AbstractDoubleVectorv - a double vector.
IllegalDimensionException - If the vectors are different sizes.public double scalarProduct(DoubleVector v)
public AbstractDoubleVector mapElements(PrimitiveMapping f)
mapElements in class AbstractDoubleVectorf - a user-defined function.
public double[] toPrimitiveArray()
toPrimitiveArray in class AbstractDoubleVectorpublic java.lang.Object clone()
clone in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||