|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSci.maths.MathVector
JSci.maths.ComplexVector
public class ComplexVector
The ComplexVector class encapsulates vectors containing complex numbers.
Field Summary | |
---|---|
protected static int |
ARRAY_1D
Storage format identifier. |
protected double[] |
vectorIm
Arrays containing the components of the vector. |
protected double[] |
vectorRe
Arrays containing the components of the vector. |
Fields inherited from class JSci.maths.MathVector |
---|
CLASS_SPECIFIC, N, storageFormat |
Constructor Summary | |
---|---|
|
ComplexVector(Complex[] array)
Constructs a vector from an array. |
|
ComplexVector(double[] real,
double[] imag)
Constructs a vector by wrapping two arrays. |
|
ComplexVector(int dim)
Constructs an empty vector. |
protected |
ComplexVector(int dim,
int storeID)
|
Method Summary | |
---|---|
AbelianGroup.Member |
add(AbelianGroup.Member v)
Returns the addition of this vector and another. |
ComplexVector |
add(ComplexVector v)
Returns the addition of this vector and another. |
ComplexVector |
add(DoubleVector v)
Returns the addition of this vector and another. |
ComplexVector |
add(IntegerVector v)
Returns the addition of this vector and another. |
ComplexVector |
conjugate()
Returns the complex conjugate of this vector. |
boolean |
equals(java.lang.Object a)
Compares two complex vectors for equality. |
Complex |
getComponent(int n)
Returns a component of this vector. |
int |
hashCode()
Returns a hashcode for this vector. |
DoubleVector |
imag()
Returns the imaginary part of this complex vector. |
double |
infNorm()
Returns the l ![]() |
ComplexVector |
mapComponents(ComplexMapping 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). |
void |
normalize()
Makes the norm of this vector equal to 1. |
DoubleVector |
real()
Returns the real part of this complex vector. |
ComplexVector |
scalarDivide(Complex z)
Returns the division of this vector by a scalar. |
ComplexVector |
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. |
ComplexVector |
scalarMultiply(Complex z)
Returns the multiplication of this vector by a scalar. |
ComplexVector |
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. |
Complex |
scalarProduct(ComplexVector v)
Returns the scalar product of this vector and another. |
Complex |
scalarProduct(HilbertSpace.Member v)
Returns the scalar product of this vector and another. |
void |
setComponent(int n,
Complex z)
Sets the value of a component of this vector. |
void |
setComponent(int n,
double x,
double y)
Sets the value of a component of this vector. |
AbelianGroup.Member |
subtract(AbelianGroup.Member v)
Returns the subtraction of this vector by another. |
ComplexVector |
subtract(ComplexVector v)
Returns the subtraction of this vector by another. |
ComplexVector |
subtract(DoubleVector v)
Returns the subtraction of this vector by another. |
ComplexVector |
subtract(IntegerVector v)
Returns the subtraction of this vector by another. |
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[] vectorRe
protected double[] vectorIm
Constructor Detail |
---|
protected ComplexVector(int dim, int storeID)
public ComplexVector(int dim)
dim
- the dimension of the vector.public ComplexVector(double[] real, double[] imag)
real
- an array of real valuesimag
- an array of imaginary valuespublic ComplexVector(Complex[] array)
array
- an assigned valueMethod Detail |
---|
public boolean equals(java.lang.Object a)
equals
in class java.lang.Object
a
- a complex vectorpublic java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public DoubleVector real()
public DoubleVector imag()
public Complex getComponent(int n)
n
- index of the vector component
VectorDimensionException
- If attempting to access an invalid component.public void setComponent(int n, Complex z)
n
- index of the vector componentz
- a complex number
VectorDimensionException
- If attempting to access an invalid component.public void setComponent(int n, double x, double y)
n
- index of the vector componentx
- the real part of a complex numbery
- the imaginary part of a complex number
VectorDimensionException
- If attempting to access an invalid component.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 ComplexVector conjugate()
public AbelianGroup.Member add(AbelianGroup.Member v)
add
in interface AbelianGroup.Member
v
- a group memberpublic ComplexVector add(ComplexVector v)
v
- a complex vector
VectorDimensionException
- If the vectors are different sizes.public ComplexVector add(DoubleVector v)
v
- a double vector
VectorDimensionException
- If the vectors are different sizes.public ComplexVector add(IntegerVector v)
v
- an integer vector
VectorDimensionException
- If the vectors are different sizes.public AbelianGroup.Member subtract(AbelianGroup.Member v)
subtract
in interface AbelianGroup.Member
v
- a group memberpublic ComplexVector subtract(ComplexVector v)
v
- a complex vector
VectorDimensionException
- If the vectors are different sizes.public ComplexVector subtract(DoubleVector v)
v
- a double vector
VectorDimensionException
- If the vectors are different sizes.public ComplexVector subtract(IntegerVector v)
v
- an integer vector
VectorDimensionException
- If the vectors are different sizes.public Module.Member scalarMultiply(Ring.Member x)
scalarMultiply
in interface Module.Member
x
- a ring memberpublic ComplexVector scalarMultiply(Complex z)
z
- a complex numberpublic ComplexVector scalarMultiply(double x)
x
- a doublepublic VectorSpace.Member scalarDivide(Field.Member x)
scalarDivide
in interface VectorSpace.Member
x
- a field memberpublic ComplexVector scalarDivide(Complex z)
z
- a complex number
java.lang.ArithmeticException
- If divide by zero.public ComplexVector scalarDivide(double x)
x
- a double
java.lang.ArithmeticException
- If divide by zero.public Complex scalarProduct(HilbertSpace.Member v)
scalarProduct
in interface HilbertSpace.Member
v
- a Hilbert space vectorpublic Complex scalarProduct(ComplexVector v)
v
- a complex vector
VectorDimensionException
- If the vectors are different sizes.public ComplexVector mapComponents(ComplexMapping f)
f
- a user-defined function
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |