1 #ifndef __COMPLEX_ARRAY_H__
2 #define __COMPLEX_ARRAY_H__
7 #include <gsl/gsl_errno.h>
8 #include <gsl/gsl_fft_complex.h>
10 #define REAL(z,i) ((z)[2*(i)])
11 #define IMAG(z,i) ((z)[2*(i)+1])
12 namespace mspass::algorithms::deconvolution{
13 typedef std::complex<double> Complex64;
14 typedef std::complex<float> Complex32;
55 template<
class T>
ComplexArray(
int nsamp, std::vector<T> d);
84 template<
class T> std::vector<std::complex<T> > CPPData();
97 double *ptr(
int sample);
122 std::vector<double> abs()
const;
126 double norm2()
const;
128 std::vector<double> phase()
const;
153 template <
class T> std::vector<std::complex<T> > ComplexArray::CPPData()
155 std::vector<std::complex<T> > result;
156 result.reserve(nsamp);
158 for(i=0; i<nsamp; ++i)
160 std::complex<T> z(data[i].real, data[i].imag);
168 T* result=
new T[nsamp];
169 for(
int i=0; i<nsamp; i++)
180 for(
int i=0; i<d.size(); i++)
185 for(
int i=d.size(); i<nsamp; i++)
194 for(
int i=0; i<nsamp; i++)
205 for(
int i=0; i<nsamp; i++)
Definition: ComplexArray.h:29
T * FortranData()
Definition: ComplexArray.h:166
ComplexArray()
Definition: ComplexArray.cc:9
void conj()
Definition: ComplexArray.cc:273
Complex64 operator[](int sample)
Definition: ComplexArray.cc:142
ComplexArray(std::vector< double > mag, std::vector< double > phase)
ComplexArray(std::vector< Complex32 > &d)
ComplexArray(std::vector< Complex64 > &d)
Definition: ComplexArray.h:16
Definition: ComplexArray.h:20