public static RealVector fftConvolution(RealVector first,RealVector second){
  IncompatibleVectorsException.checkVectorsCompatible(first,second);
  DenseFloatMatrix1D coltVec1=new DenseFloatMatrix1D(first.getCoordinates());
  DenseFloatMatrix1D coltVec2=new DenseFloatMatrix1D(second.getCoordinates());
  int dimension=first.getDimension();
  DenseFComplexMatrix1D fft1=coltVec1.getFft();
  DenseFComplexMatrix1D fft2=coltVec2.getFft();
  for (int i=0; i < dimension; i++) {
    fft1.setQuick(i,FComplex.mult(fft1.getQuick(i),fft2.getQuick(i)));
  }
  fft1.ifft(true);
  DenseFloatMatrix1D coltResult=((DenseFloatMatrix1D)(fft1.getRealPart()));
  float[] coordinates=coltResult.elements();
  RealVector result=new RealVector(coordinates);
  return result;
}

public static RealVector fftConvolution ( RealVector first , RealVector second ) { IncompatibleVectorsException . checkVectorsCompatible ( first , second ) ; DenseFloatMatrix1D coltVec1 = new DenseFloatMatrix1D ( first . getCoordinates ( ) ) ; DenseFloatMatrix1D coltVec2 = new DenseFloatMatrix1D ( second . getCoordinates ( ) ) ; int dimension = first . getDimension ( ) ; DenseFComplexMatrix1D fft1 = coltVec1 . getFft ( ) ; DenseFComplexMatrix1D fft2 = coltVec2 . getFft ( ) ; for ( int i = 0 ; i < dimension ; i ++ ) { fft1 . setQuick ( i , FComplex . mult ( fft1 . getQuick ( i ) , fft2 . getQuick ( i ) ) ) ; } fft1 . ifft ( true ) ; DenseFloatMatrix1D coltResult = ( ( DenseFloatMatrix1D ) ( fft1 . getRealPart ( ) ) ) ; float [ ] coordinates = coltResult . elements ( ) ; RealVector result = new RealVector ( coordinates ) ; return result ; }
returns the circular convolution of the two input vectors . see plate , holographic reduced representations , section 3 . 1
