/** @file  psVectorFFT.h
 *
 *  @brief Contains FFT transform related functions for psVector
 *
 *  @ingroup Transform
 *
 *  @author Robert DeSonia, MHPCC
 *
 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
 *  @date $Date: 2005-06-08 23:40:45 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
 */

#ifndef PS_VECTOR_FFT_H
#define PS_VECTOR_FFT_H

#include "psVector.h"

/// @addtogroup Transform
/// @{

/** Specify direction of FFT */
typedef enum {
    /// psImageFFT/psVectorFFT should perform a forward FFT.
    PS_FFT_FORWARD = 1,

    /// psImageFFT/psVectorFFT should perform a reverse FFT.
    PS_FFT_REVERSE = 2,

    /// psImageFFT/psVectorFFT should perform a reverse FFT with a real result.
    PS_FFT_REAL_RESULT = 4
} psFFTFlags;


/** Forward and reverse FFT calculations.
 *
 *  This takes as input the vector of interest (in) and the direction
 *  (direction), which is specified by an enumerated type psFftDirection.
 *  The input vector may be of type psF32 or psC32, the result is always
 *  psC32. If the input vector is psF32, the direction must be forward.
 *
 *  @return psVector* the FFT transformation result
 */
psVector* psVectorFFT(
    psVector* out,                     ///< a psVector to recycle.  If NULL, a new psVector is made.
    const psVector* in,                ///< the vector to apply transform to
    psFFTFlags direction               ///< the direction of the transform
);

/** extract the real portion of a complex vector
 *
 *  @return psVector*   real portion of the input vector.
 */
psVector* psVectorReal(
    psVector* out,                     ///< a psVector to recycle.  If NULL, a new psVector is made.
    const psVector* in                ///< the psVector to extract real portion from
);

/** extract the imaginary portion of a complex vector
 *
 *  @return psVector*   imaginary portion of the input vector.
 */
psVector* psVectorImaginary(
    psVector* out,                     ///< a psVector to recycle.  If NULL, a new psVector is made.
    const psVector* in                 ///< the psVector to extract imaginary portion from
);

/** creates a complex vector from separate real and imaginary vectors
 *
 *  @return psVector*   resulting complex vector
 */
psVector* psVectorComplex(
    psVector* out,                     ///< a psVector to recycle.  If NULL, a new psVector is made.
    const psVector* real,              ///< the real vector
    const psVector* imag               ///< the imaginary vector
);

/** computes the complex conjugate of a vector
 *
 *  @return psVector*   the complex conjugate of the 'in' vector
 */
psVector* psVectorConjugate(
    psVector* out,                     ///< a psVector to recycle.  If NULL, a new psVector is made.
    const psVector* in                 ///< the psVector to compute conjugate of
);

/** computes the power spectrum of a vector
 *
 *  @return psVector*   the power spectrum of the 'in' vector
 */
psVector* psVectorPowerSpectrum(
    psVector* out,                     ///< a psVector to recycle.  If NULL, a new psVector is made.
    const psVector* in                 ///< the psVector to power spectrum of
);

/// @}

#endif // #ifndef PS_VECTOR_FFT_H
