1 #ifndef MATSGN_ComplexArray_H 2 #define MATSGN_ComplexArray_H 106 return mValues[i][j];
164 if (mSize==0)
return (*
this);
166 fftw_complex* Ts=&(*this)[0];
167 for (i=0;i<
mSize;i++) {
181 if (mSize==0)
return (*
this);
183 "MATSGN_ComplexArray*=Y",
186 fftw_complex* Ts=&(*this)[0];
187 const fftw_complex *Ys=&Y[0];
188 for (i=0;i<
mSize;i++) {
189 mReal=(*Ts)[0]*(*Ys)[0]-(*Ts)[1]*(*Ys)[1];
190 (*Ts)[1]=(*Ts)[0]*(*Ys)[1]+(*Ts)[1]*(*Ys)[0];
201 if (s==0)
throw CORE_Exception(
"math/signam",
"MATSGN_ComplexArray/=",
"division by 0");
202 if (mSize==0)
return (*
this);
204 fftw_complex* Ts=&(*this)[0];
205 for (i=0;i<
mSize;i++) {
219 if (mSize==0)
return (*
this);
221 fftw_complex* Ts=&(*this)[0];
222 for (i=0;i<
mSize;i++) {
234 if (mSize==0)
return (*
this);
236 fftw_complex* Ts=&(*this)[0];
237 for (i=0;i<
mSize;i++) {
295 const complex<T>* pf=&f[0];
348 fftw_complex &c=mValues[index];
364 mIsPrivateAllocated=
false;
402 std::swap(mValues[i][0],mValues[j][0]);
403 std::swap(mValues[i][1],mValues[j][1]);
417 return sqrt(
norm2());
void copy(const complex< T > *f, const tUIndex &n)
copy the complex array
Definition: MATSGN_ComplexArray.h:278
#define tDouble
Definition: types.h:52
tReal distance(const MATSGN_ComplexArray &x) const
compute the distance of this to x
Definition: MATSGN_ComplexArray.h:434
MATSGN_ComplexArray & operator*=(const MATSGN_ComplexArray &Y)
multiply the array by Y
Definition: MATSGN_ComplexArray.h:180
virtual ~MATSGN_ComplexArray(void)
destroy an FFT complex array
Definition: MATSGN_ComplexArray.cpp:24
tReal distance2(const MATSGN_ComplexArray &x) const
compute the square of distance of this to x
Definition: MATSGN_ComplexArray.cpp:261
DEFINE_SPTR(MATSGN_ComplexArray)
tBoolean setValuesByReference(const tUIndex &n, fftw_complex *array)
set the the values by reference
Definition: MATSGN_ComplexArray.h:359
fftw_complex * getValues()
get values for reading or writing
Definition: MATSGN_ComplexArray.h:379
This class describes FFT complex array based on fft_complex structure.
Definition: MATSGN_ComplexArray.h:16
MATSGN_ComplexArray & operator=(const CORE_RealArray &s)
copy only the real part to s
Definition: MATSGN_ComplexArray.h:130
const fftw_complex & operator[](const tUIndex &i) const
get the value for reading only
Definition: MATSGN_ComplexArray.h:78
#define tUSInt
Definition: types.h:28
MATSGN_ComplexArray(void)
create a FFT complex array
Definition: MATSGN_ComplexArray.cpp:7
#define tBoolean
Definition: types.h:139
tString toString() const
return the string associated to the integer
Definition: CORE_Integer.h:106
const fftw_complex * getValues() const
get values for reading only
Definition: MATSGN_ComplexArray.h:373
static void InPlaceTranspose(fftw_complex *A, const tUIndex &nRows, const tUIndex &nCols)
transpose the vector A considered as a matrix of size nRows x nCols
Definition: MATSGN_ComplexArray.cpp:391
const tUIndex & getSize() const
get the size
Definition: MATSGN_ComplexArray.h:385
void swap(const tUIndex &i, const tUIndex &j)
swap the lines i & j
Definition: MATSGN_ComplexArray.h:401
MATSGN_ComplexArray & operator/=(const tReal &s)
divide operator
Definition: MATSGN_ComplexArray.h:200
void copy(const MATSGN_ComplexArray &f)
copy the complex array
Definition: MATSGN_ComplexArray.cpp:165
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
this class describes an array
Definition: CORE_Array.h:19
MATSGN_ComplexArray & operator+=(const tReal &s)
add s to the array
Definition: MATSGN_ComplexArray.h:218
void desallocate()
desallocate the memory
Definition: MATSGN_ComplexArray.cpp:28
tBoolean mIsPrivateAllocated
Definition: MATSGN_ComplexArray.h:33
void initArray(const tReal &f)
init uniform value of f
Definition: MATSGN_ComplexArray.cpp:103
SP_OBJECT(MATSGN_ComplexArray)
MATSGN_ComplexArray & operator=(const tReal &s)
init uniform value
Definition: MATSGN_ComplexArray.h:146
void setSize(const tUIndex &n)
set size of the array
Definition: MATSGN_ComplexArray.h:333
tReal norm2() const
compute the square of norm
Definition: MATSGN_ComplexArray.cpp:231
tUIndex mSize
Definition: MATSGN_ComplexArray.h:27
#define tUIndex
Definition: types.h:126
static void InPlaceTransposeWithMarker(fftw_complex *A, const tUIndex &nRows, const tUIndex &nCols)
transpose the vector A considered as a matrix of size nRows x nCols
Definition: MATSGN_ComplexArray.cpp:367
abstract base class for most classes.
Definition: CORE_Object.h:53
#define tString
Definition: types.h:135
tUIndex mCapacity
Definition: MATSGN_ComplexArray.h:30
tReal norm() const
compute the norm
Definition: MATSGN_ComplexArray.h:416
MATSGN_ComplexArray & operator-=(const tReal &s)
sub s to the array
Definition: MATSGN_ComplexArray.h:233
void fitToSize()
set the capacityto size
Definition: MATSGN_ComplexArray.cpp:157
fftw_complex & operator[](const tUIndex &i)
get the value for reading & writing
Definition: MATSGN_ComplexArray.h:70
fftw_complex * mValues
Definition: MATSGN_ComplexArray.h:24
const tUIndex & getCapacity() const
get the capacity
Definition: MATSGN_ComplexArray.h:391
MATSGN_ComplexArray & operator=(const MATSGN_ComplexArray &s)
copy the values of the complex array
Definition: MATSGN_ComplexArray.h:112
MATSGN_ComplexArray & operator=(const fftw_complex &s)
init uniform value
Definition: MATSGN_ComplexArray.h:154
void allocate(const tUIndex &cap)
allocate the memory if the array
Definition: MATSGN_ComplexArray.cpp:43
MATSGN_ComplexArray & operator*=(const tReal &s)
multiply the array by s
Definition: MATSGN_ComplexArray.h:163
tReal fabs(tUIndex &i) const
compute the index of the array where the module is max
Definition: MATSGN_ComplexArray.cpp:244
tDouble mImag
Definition: MATSGN_ComplexArray.h:36
tDouble mReal
Definition: MATSGN_ComplexArray.h:36
const tDouble & operator()(const tUIndex &i, const tUSInt &j) const
get the value for reading only
Definition: MATSGN_ComplexArray.h:103
virtual tString toString() const
to string
Definition: MATSGN_ComplexArray.cpp:345
tDouble & operator()(const tUIndex &i, const tUSInt &j)
get the value for reading & writing
Definition: MATSGN_ComplexArray.h:91
void setValue(const tUIndex &index, const tDouble &x, const tDouble &y)
set the value at index
Definition: MATSGN_ComplexArray.h:347
#define tReal
Definition: types.h:118
MATSGN_ComplexArray & operator=(const CORE_ComplexArray &s)
copy the values of the tComplex array
Definition: MATSGN_ComplexArray.h:120
#define ASSERT_IN(a)
Definition: types.h:196
MATSGN_ComplexArray & operator=(const CORE_DoubleArray &s)
copy only the real part to s
Definition: MATSGN_ComplexArray.h:138