1 #ifndef MATSGN_Complex_H 2 #define MATSGN_Complex_H 115 mWork=mValue[0]*s[0]-mValue[1]*s[1];
116 mValue[1]=mValue[0]*s[1]+mValue[1]*s[0];
125 mWork=mValue[0]*s[0]-mValue[1]*s[1];
126 mValue[1]=mValue[0]*s[1]+mValue[1]*s[0];
136 if (s==0)
throw CORE_Exception(
"math/signam",
"MATSGN_Complex/=",
"division by 0");
146 mWork=mValue[0]*s[0]+mValue[1]*s[1];
147 mValue[1]=(-mValue[0]*s[1]+mValue[1]*s[0]);
150 if (mWork==0)
throw CORE_Exception(
"math/signam",
"MATSGN_Complex/=",
"division by 0");
242 return f[0]*f[0]+f[1]*f[1];
256 inline static void product(fftw_complex& a,
const fftw_complex& b) {
264 inline static void product(fftw_complex& a,
const fftw_complex& b,
tDouble& temp) {
265 temp=a[0]*b[0]-a[1]*b[1];
266 a[1]=a[0]*b[1]+a[1]*b[0];
276 inline static void product(
const fftw_complex& a,
const fftw_complex& b,fftw_complex& r,
tDouble& temp) {
277 temp=a[0]*b[0]-a[1]*b[1];
278 r[1]=a[0]*b[1]+a[1]*b[0];
286 inline static void product(
const fftw_complex& a,
const fftw_complex& b,fftw_complex& r) {
289 r[0]=a[0]*b[0]-a[1]*b[1];
290 r[1]=a[0]*b[1]+a[1]*b[0];
321 inline static void add(fftw_complex& a,
const fftw_complex& b) {
330 inline static void add(
const fftw_complex& a,
const fftw_complex& b,fftw_complex& r) {
338 inline static void sub(fftw_complex& a,
const fftw_complex& b) {
347 inline static void sub(
const fftw_complex& a,
const fftw_complex& b,fftw_complex& r) {
355 inline static void swap(fftw_complex& a,fftw_complex& b) {
356 std::swap(a[0],b[0]);
357 std::swap(a[1],b[1]);
363 inline static tDouble norm2(
const fftw_complex& a,
const fftw_complex& b) {
365 return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]);
369 inline static tDouble norm(
const fftw_complex& a,
const fftw_complex& b) {
371 return sqrt(
norm2(a,b));
static tString toString(const fftw_complex &f)
to string
Definition: MATSGN_Complex.h:383
static void add(fftw_complex &a, const fftw_complex &b)
Definition: MATSGN_Complex.h:321
static void product(const tDouble &a, const tDouble &b, const tDouble &x, const tDouble &y, fftw_complex &r)
Definition: MATSGN_Complex.h:313
MATSGN_Complex & operator-=(const MATSGN_Complex &s)
sub operator
Definition: MATSGN_Complex.h:177
#define tDouble
Definition: types.h:52
tDouble & operator[](const tUSInt &i)
get the value for reading & writing
Definition: MATSGN_Complex.h:59
MATSGN_Complex & operator+=(const fftw_complex &s)
add operator
Definition: MATSGN_Complex.h:168
static tDouble module(const fftw_complex &f)
compute the module of f
Definition: MATSGN_Complex.h:248
static tDouble module2(const fftw_complex &f)
compute the square of module of f
Definition: MATSGN_Complex.h:241
void conjugate()
conjugate the complex
Definition: MATSGN_Complex.h:222
static void add(const fftw_complex &a, const fftw_complex &b, fftw_complex &r)
Definition: MATSGN_Complex.h:330
static void product(const fftw_complex &a, const fftw_complex &b, fftw_complex &r, tDouble &temp)
Definition: MATSGN_Complex.h:276
static void swap(fftw_complex &a, fftw_complex &b)
Definition: MATSGN_Complex.h:355
MATSGN_Complex & operator*=(const fftw_complex &s)
multiply operator
Definition: MATSGN_Complex.h:124
#define tUSInt
Definition: types.h:28
MATSGN_Complex(void)
create a FFT complex
Definition: MATSGN_Complex.cpp:4
fftw_complex & getValue()
get values for reading or writing
Definition: MATSGN_Complex.h:216
void setValue(const tDouble &x, const tDouble &y)
set the value at index
Definition: MATSGN_Complex.h:200
MATSGN_Complex & operator/=(const MATSGN_Complex &s)
divide operator
Definition: MATSGN_Complex.h:145
MATSGN_Complex & operator-=(const fftw_complex &s)
sub operator
Definition: MATSGN_Complex.h:186
DEFINE_SPTR(MATSGN_Complex)
MATSGN_Complex & operator/=(const tReal &s)
divide operator
Definition: MATSGN_Complex.h:135
const fftw_complex & getValue() const
get values for reading only
Definition: MATSGN_Complex.h:210
tDouble module2() const
compute the square of module of this
Definition: MATSGN_Complex.h:228
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
tDouble mWork
Definition: MATSGN_Complex.h:23
virtual tString toString() const
Definition: MATSGN_Complex.h:378
MATSGN_Complex & operator*=(const MATSGN_Complex &s)
multiply operator
Definition: MATSGN_Complex.h:114
const tDouble & operator[](const tUSInt &i) const
get the value for reading only
Definition: MATSGN_Complex.h:67
virtual ~MATSGN_Complex(void)
destroy an FFT complex array
Definition: MATSGN_Complex.cpp:26
static void product(fftw_complex &a, const fftw_complex &b)
Definition: MATSGN_Complex.h:256
abstract base class for most classes.
Definition: CORE_Object.h:53
static void product(const MATSGN_Complex &a, const MATSGN_Complex &b, MATSGN_Complex &r)
Definition: MATSGN_Complex.h:297
#define tString
Definition: types.h:135
static tDouble norm(const fftw_complex &a, const fftw_complex &b)
return the norm of the difference
Definition: MATSGN_Complex.h:369
static tString toString(const fftw_complex &f, const tUSInt &nDigits)
to string
Definition: MATSGN_Complex.h:395
MATSGN_Complex & operator*=(const tReal &s)
multiply operator
Definition: MATSGN_Complex.h:105
MATSGN_Complex & operator=(const tReal &s)
copy the real
Definition: MATSGN_Complex.h:95
MATSGN_Complex & operator+=(const MATSGN_Complex &s)
add operator
Definition: MATSGN_Complex.h:159
MATSGN_Complex & operator=(const MATSGN_Complex &s)
copy the complex
Definition: MATSGN_Complex.h:76
tString toString() const
return the string associated to the real
Definition: CORE_Real.h:97
This class describes complex based on fftw_complex sructure.
Definition: MATSGN_Complex.h:16
static void sub(const fftw_complex &a, const fftw_complex &b, fftw_complex &r)
Definition: MATSGN_Complex.h:347
static tDouble norm2(const fftw_complex &a, const fftw_complex &b)
return the norm of the difference
Definition: MATSGN_Complex.h:363
fftw_complex mValue
Definition: MATSGN_Complex.h:22
tDouble module() const
compute the module of this
Definition: MATSGN_Complex.h:234
#define tReal
Definition: types.h:118
SP_OBJECT(MATSGN_Complex)
static void product(fftw_complex &a, const fftw_complex &b, tDouble &temp)
Definition: MATSGN_Complex.h:264
static void sub(fftw_complex &a, const fftw_complex &b)
Definition: MATSGN_Complex.h:338
MATSGN_Complex & operator=(const fftw_complex &s)
copy the complex
Definition: MATSGN_Complex.h:85
static void product(const fftw_complex &a, const fftw_complex &b, fftw_complex &r)
Definition: MATSGN_Complex.h:286
#define ASSERT_IN(a)
Definition: types.h:196