jsci.maths.vectors
Class AbstractComplexVector
- java.lang.Object
-
- jsci.maths.vectors.MathVector
-
- jsci.maths.vectors.AbstractComplexVector
-
- All Implemented Interfaces:
- java.io.Serializable, BanachSpace.Member, HilbertSpace.Member, Module.Member, VectorSpace.Member, AbelianGroup.Member, Member
- Direct Known Subclasses:
- Complex2Vector, Complex3Vector, ComplexVector
public abstract class AbstractComplexVector extends MathVector implements HilbertSpace.Member
The AbstractComplexVector class encapsulates vectors containing complex numbers.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract AbstractComplexVectoradd(AbstractComplexVector v)Returns the addition of this vector and another.abstract AbstractComplexVectorconjugate()Returns the complex conjugate of this vector.booleanequals(java.lang.Object obj)Compares two complex vectors for equality.booleanequals(java.lang.Object obj, double tol)abstract ComplexgetComponent(int n)Returns a component of this vector.abstract doublegetImagComponent(int n)abstract doublegetRealComponent(int n)java.lang.ObjectgetSet()inthashCode()Returns a hashcode for this vector.abstract AbstractDoubleVectorimag()Returns the imaginary part of this complex vector.doubleinfNorm()Returns the l
-norm.abstract AbstractComplexVectormapComponents(ComplexMapping f)Applies a function on all the vector components.doublenorm()Returns the l2-norm (magnitude).AbstractComplexVectornormalize()Returns a normalised vector (a vector with norm equal to one).abstract AbstractDoubleVectorreal()Returns the real part of this complex vector.abstract AbstractComplexVectorscalarDivide(Complex z)Returns the division of this vector by a scalar.abstract AbstractComplexVectorscalarDivide(double x)Returns the division of this vector by a scalar.abstract AbstractComplexVectorscalarMultiply(Complex z)Returns the multiplication of this vector by a scalar.abstract AbstractComplexVectorscalarMultiply(double x)Returns the multiplication of this vector by a scalar.abstract ComplexscalarProduct(AbstractComplexVector v)Returns the scalar product of this vector and another.abstract voidsetComponent(int n, Complex z)Sets the value of a component of this vector.abstract voidsetComponent(int n, double x, double y)Sets the value of a component of this vector.abstract AbstractComplexVectorsubtract(AbstractComplexVector v)Returns the subtraction of this vector by another.java.lang.StringtoString()Returns a comma delimited string representing the value of this vector.-
Methods inherited from class jsci.maths.vectors.MathVector
dimension
-
Methods inherited from interface jsci.maths.algebras.HilbertSpace.Member
scalarProduct
-
Methods inherited from interface jsci.maths.algebras.VectorSpace.Member
scalarDivide
-
Methods inherited from interface jsci.maths.algebras.Module.Member
scalarMultiply
-
Methods inherited from interface jsci.maths.groups.AbelianGroup.Member
add, negate, subtract
-
-
-
-
Method Detail
-
equals
public final boolean equals(java.lang.Object obj)
Compares two complex vectors for equality. Two vectors are considered to be equal if the norm of their difference is within the zero tolerance.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- a complex vector
-
equals
public boolean equals(java.lang.Object obj, double tol)
-
toString
public java.lang.String toString()
Returns a comma delimited string representing the value of this vector.- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hashcode for this vector.- Overrides:
hashCodein classjava.lang.Object
-
real
public abstract AbstractDoubleVector real()
Returns the real part of this complex vector.
-
imag
public abstract AbstractDoubleVector imag()
Returns the imaginary part of this complex vector.
-
getComponent
public abstract Complex 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.
-
getRealComponent
public abstract double getRealComponent(int n)
-
getImagComponent
public abstract double getImagComponent(int n)
-
setComponent
public abstract void setComponent(int n, Complex z)Sets the value of a component of this vector. Should only be used to initialise this vector.- Parameters:
n- index of the vector componentz- a complex number- Throws:
VectorDimensionException- If attempting to access an invalid component.
-
setComponent
public abstract void setComponent(int n, double x, double y)Sets the value of a component of this vector. Should only be used to initialise this vector.- Parameters:
n- index of the vector componentx- the real part of a complex numbery- the imaginary part of a complex number- Throws:
VectorDimensionException- If attempting to access an invalid component.
-
norm
public double norm()
Returns the l2-norm (magnitude).- Specified by:
normin interfaceBanachSpace.Member- Specified by:
normin classMathVector
-
infNorm
public double infNorm()
Returns the l
-norm.
-
conjugate
public abstract AbstractComplexVector conjugate()
Returns the complex conjugate of this vector.
-
add
public abstract AbstractComplexVector add(AbstractComplexVector v)
Returns the addition of this vector and another.- Parameters:
v- a complex vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
subtract
public abstract AbstractComplexVector subtract(AbstractComplexVector v)
Returns the subtraction of this vector by another.- Parameters:
v- a complex vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
scalarMultiply
public abstract AbstractComplexVector scalarMultiply(Complex z)
Returns the multiplication of this vector by a scalar.- Parameters:
z- a complex number
-
scalarMultiply
public abstract AbstractComplexVector scalarMultiply(double x)
Returns the multiplication of this vector by a scalar.- Parameters:
x- a double
-
scalarDivide
public abstract AbstractComplexVector scalarDivide(Complex z)
Returns the division of this vector by a scalar.- Parameters:
z- a complex number- Throws:
java.lang.ArithmeticException- If divide by zero.
-
scalarDivide
public abstract AbstractComplexVector scalarDivide(double x)
Returns the division of this vector by a scalar.- Parameters:
x- a double- Throws:
java.lang.ArithmeticException- If divide by zero.
-
normalize
public AbstractComplexVector normalize()
Returns a normalised vector (a vector with norm equal to one).
-
scalarProduct
public abstract Complex scalarProduct(AbstractComplexVector v)
Returns the scalar product of this vector and another.- Parameters:
v- a complex vector- Throws:
VectorDimensionException- If the vectors are different sizes.
-
mapComponents
public abstract AbstractComplexVector mapComponents(ComplexMapping f)
Applies a function on all the vector components.- Parameters:
f- a user-defined function- Returns:
- a complex vector
-
-
DMelt 3.0 © DataMelt by jWork.ORG