package jsci.maths.vectors;
import jsci.maths.Complex;
import jsci.maths.ComplexMapping;
import jsci.maths.MathDouble;
import jsci.maths.MathInteger;
import jsci.maths.algebras.HilbertSpace;
import jsci.maths.algebras.Module;
import jsci.maths.algebras.VectorSpace;
import jsci.maths.fields.Field;
import jsci.maths.fields.Ring;
import jsci.maths.groups.AbelianGroup;
/**
* An array-based implementation of a complex vector.
* @version 2.2
* @author Mark Hale
*/
public class ComplexVector extends AbstractComplexVector {
/**
* Arrays containing the components of the vector.
*/
protected double vectorRe[];
protected double vectorIm[];
/**
* Constructs an empty vector.
* @param dim the dimension of the vector.
*/
public ComplexVector(final int dim) {
super(dim);
vectorRe=new double[dim];
vectorIm=new double[dim];
}
/**
* Constructs a vector by wrapping two arrays.
* @param real an array of real values
* @param imag an array of imaginary values
*/
public ComplexVector(final double real[],final double imag[]) {
super(real.length);
vectorRe=real;
vectorIm=imag;
}
/**
* Constructs a vector from an array.
* @param array an assigned value
*/
public ComplexVector(final Complex array[]) {
this(array.length);
for(int i=0;i=0 && n=0 && n=0 && n=0 && n=0 && n2-norm (magnitude).
*/
public double norm() {
double answer=vectorRe[0]*vectorRe[0]+vectorIm[0]*vectorIm[0];
for(int i=1;i
-norm.
*/
public double infNorm() {
double infNorm=vectorRe[0]*vectorRe[0]+vectorIm[0]*vectorIm[0];
for(int i=1;iinfNorm)
infNorm=mod;
}
return Math.sqrt(infNorm);
}
//============
// OPERATIONS
//============
/**
* Returns the negative of this vector.
*/
public AbelianGroup.Member negate() {
final double arrayRe[]=new double[N];
final double arrayIm[]=new double[N];
arrayRe[0]=-vectorRe[0];
arrayIm[0]=-vectorIm[0];
for(int i=1;i
Ads help maintain this website.