mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 13:57:32 +02:00
cmath4.c, correct scale for ifft
This commit is contained in:
@@ -780,7 +780,7 @@ cx_ifft(void *data, short int type, int length, int *newlength, short int *newty
|
|||||||
{
|
{
|
||||||
ngcomplex_t *indata = (ngcomplex_t *) data;
|
ngcomplex_t *indata = (ngcomplex_t *) data;
|
||||||
int i, tpts;
|
int i, tpts;
|
||||||
double span, scale;
|
double span;
|
||||||
double *xscale;
|
double *xscale;
|
||||||
ngcomplex_t *outdata = NULL;
|
ngcomplex_t *outdata = NULL;
|
||||||
struct dvec *sv;
|
struct dvec *sv;
|
||||||
@@ -792,6 +792,7 @@ cx_ifft(void *data, short int type, int length, int *newlength, short int *newty
|
|||||||
#else
|
#else
|
||||||
int N, M;
|
int N, M;
|
||||||
double *datax = NULL;
|
double *datax = NULL;
|
||||||
|
double scale;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (grouping == 0)
|
if (grouping == 0)
|
||||||
@@ -895,10 +896,9 @@ cx_ifft(void *data, short int type, int length, int *newlength, short int *newty
|
|||||||
*newlength = tpts;
|
*newlength = tpts;
|
||||||
outdata = alloc_c(tpts);
|
outdata = alloc_c(tpts);
|
||||||
|
|
||||||
scale = (double) tpts;
|
|
||||||
for (i = 0; i < tpts; i++) {
|
for (i = 0; i < tpts; i++) {
|
||||||
outdata[i].cx_real = out[i][0] * scale;
|
outdata[i].cx_real = out[i][0];
|
||||||
outdata[i].cx_imag = out[i][1] * scale;
|
outdata[i].cx_imag = out[i][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
fftw_free(in);
|
fftw_free(in);
|
||||||
|
|||||||
Reference in New Issue
Block a user