public void convolveCartesian(ComplexVector other,int direction){
  IncompatibleVectorsException.checkVectorsCompatible(this,other);
  float[] norms=new float[dimension];
  float[] otherNorms=new float[dimension];
  for (int q=0; q < dimension; q++) {
    float norm=0;
    float othernorm=0;
    norm+=Math.pow(this.coordinates[q * 2],2);
    norm+=Math.pow(this.coordinates[2 * q + 1],2);
    othernorm+=Math.pow(other.coordinates[q * 2],2);
    othernorm+=Math.pow(other.coordinates[2 * q + 1],2);
    norm=(float)Math.sqrt(norm);
    othernorm=(float)Math.sqrt(othernorm);
    norms[q]=norm;
    otherNorms[q]=othernorm;
  }
  toDensePolar();
  ComplexVector otherCopy=other.copy();
  otherCopy.toDensePolar();
  short[] otherAngles=otherCopy.getPhaseAngles();
  for (int i=0; i < dimension; i++) {
    if (otherAngles[i] == CircleLookupTable.ZERO_INDEX) {
      continue;
    }
    if (phaseAngles[i] == CircleLookupTable.ZERO_INDEX) {
      phaseAngles[i]=otherAngles[i];
      continue;
    }
    short angleToAdd=otherAngles[i];
    if (direction <= 0) {
      angleToAdd=(short)(CircleLookupTable.PHASE_RESOLUTION - angleToAdd);
    }
    phaseAngles[i]=(short)((phaseAngles[i] + angleToAdd) % CircleLookupTable.PHASE_RESOLUTION);
  }
  toCartesian();
  double newNorm=0;
  for (int q=0; q < dimension; q++) {
    this.coordinates[q * 2]*=(norms[q] * otherNorms[q]);
    this.coordinates[q * 2 + 1]*=(norms[q] * otherNorms[q]);
  }
  normalizeHermitian();
}

public void convolveCartesian ( ComplexVector other , int direction ) { IncompatibleVectorsException . checkVectorsCompatible ( this , other ) ; float [ ] norms = new float [ dimension ] ; float [ ] otherNorms = new float [ dimension ] ; for ( int q = 0 ; q < dimension ; q ++ ) { float norm = 0 ; float othernorm = 0 ; norm += Math . pow ( this . coordinates [ q * 2 ] , 2 ) ; norm += Math . pow ( this . coordinates [ 2 * q + 1 ] , 2 ) ; othernorm += Math . pow ( other . coordinates [ q * 2 ] , 2 ) ; othernorm += Math . pow ( other . coordinates [ 2 * q + 1 ] , 2 ) ; norm = ( float ) Math . sqrt ( norm ) ; othernorm = ( float ) Math . sqrt ( othernorm ) ; norms [ q ] = norm ; otherNorms [ q ] = othernorm ; } toDensePolar ( ) ; ComplexVector otherCopy = other . copy ( ) ; otherCopy . toDensePolar ( ) ; short [ ] otherAngles = otherCopy . getPhaseAngles ( ) ; for ( int i = 0 ; i < dimension ; i ++ ) { if ( otherAngles [ i ] == CircleLookupTable . ZERO_INDEX ) { continue ; } if ( phaseAngles [ i ] == CircleLookupTable . ZERO_INDEX ) { phaseAngles [ i ] = otherAngles [ i ] ; continue ; } short angleToAdd = otherAngles [ i ] ; if ( direction <= 0 ) { angleToAdd = ( short ) ( CircleLookupTable . PHASE_RESOLUTION - angleToAdd ) ; } phaseAngles [ i ] = ( short ) ( ( phaseAngles [ i ] + angleToAdd ) % CircleLookupTable . PHASE_RESOLUTION ) ; } toCartesian ( ) ; double newNorm = 0 ; for ( int q = 0 ; q < dimension ; q ++ ) { this . coordinates [ q * 2 ] *= ( norms [ q ] * otherNorms [ q ] ) ; this . coordinates [ q * 2 + 1 ] *= ( norms [ q ] * otherNorms [ q ] ) ; } normalizeHermitian ( ) ; }
convolves this vector with the other . if the value of direction < = 0 then the correlation operation is performed , ie . convolution inverse
