Skip to content

Commit

Permalink
Saved more.
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-frigo committed Sep 21, 2002
1 parent 2008afb commit a49b921
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 53 deletions.
4 changes: 2 additions & 2 deletions dft/dft.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: dft.h,v 1.28 2002-09-02 15:46:57 athena Exp $ */
/* $Id: dft.h,v 1.29 2002-09-21 22:04:05 athena Exp $ */

#ifndef __DFT_H__
#define __DFT_H__
Expand All @@ -37,7 +37,7 @@ int X(problem_dft_p)(const problem *p);
#define DFTP X(problem_dft_p) /* shorthand */

void X(dft_zerotens)(tensor sz, R *ri, R *ii);
problem *X(mkproblem_dft)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_dft)(const tensor *sz, const tensor *vecsz,
R *ri, R *ii, R *ro, R *io);
problem *X(mkproblem_dft_d)(tensor sz, tensor vecsz,
R *ri, R *ii, R *ro, R *io);
Expand Down
10 changes: 5 additions & 5 deletions dft/problem.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: problem.c,v 1.21 2002-09-21 21:47:35 athena Exp $ */
/* $Id: problem.c,v 1.22 2002-09-21 22:04:05 athena Exp $ */

#include "dft.h"
#include <stddef.h>
Expand Down Expand Up @@ -77,7 +77,7 @@ int X(problem_dft_p)(const problem *p)
return (p->adt == &padt);
}

problem *X(mkproblem_dft)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_dft)(const tensor *sz, const tensor *vecsz,
R *ri, R *ii, R *ro, R *io)
{
problem_dft *ego =
Expand All @@ -86,8 +86,8 @@ problem *X(mkproblem_dft)(const tensor sz, const tensor vecsz,
/* both in place or both out of place */
CK((ri == ro) == (ii == io));

ego->sz = X(tensor_compress)(&sz);
ego->vecsz = X(tensor_compress_contiguous)(&vecsz);
ego->sz = X(tensor_compress)(sz);
ego->vecsz = X(tensor_compress_contiguous)(vecsz);
ego->ri = ri;
ego->ii = ii;
ego->ro = ro;
Expand All @@ -102,7 +102,7 @@ problem *X(mkproblem_dft_d)(tensor sz, tensor vecsz,
R *ri, R *ii, R *ro, R *io)
{
problem *p;
p = X(mkproblem_dft)(sz, vecsz, ri, ii, ro, io);
p = X(mkproblem_dft)(&sz, &vecsz, ri, ii, ro, io);
X(tensor_destroy)(&vecsz);
X(tensor_destroy)(&sz);
return p;
Expand Down
4 changes: 2 additions & 2 deletions dft/rank-geq2.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: rank-geq2.c,v 1.24 2002-09-21 21:47:35 athena Exp $ */
/* $Id: rank-geq2.c,v 1.25 2002-09-21 22:04:05 athena Exp $ */

/* plans for DFT of rank >= 2 (multidimensional) */

Expand Down Expand Up @@ -78,7 +78,7 @@ static void print(plan *ego_, printer *p)

static int picksplit(const S *ego, const tensor *sz, uint *rp)
{
A(sz.rnk > 1); /* cannot split rnk <= 1 */
A(sz->rnk > 1); /* cannot split rnk <= 1 */
if (!X(pickdim)(ego->spltrnk, ego->buddies, ego->nbuddies, sz, 1, rp))
return 0;
*rp += 1; /* convert from dim. index to rank */
Expand Down
4 changes: 2 additions & 2 deletions rdft/dft-r2hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: dft-r2hc.c,v 1.12 2002-09-21 21:47:35 athena Exp $ */
/* $Id: dft-r2hc.c,v 1.13 2002-09-21 22:04:05 athena Exp $ */

/* Compute the complex DFT by combining R2HC RDFTs on the real
and imaginary parts. This could be useful for people just wanting
Expand Down Expand Up @@ -141,7 +141,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
{
tensor ri_vec = X(mktensor_1d)(2, p->ii - p->ri, p->io - p->ro);
tensor cld_vec = X(tensor_append)(&ri_vec, &p->vecsz);
cldp = X(mkproblem_rdft_1)(p->sz, cld_vec, p->ri, p->ro, R2HC);
cldp = X(mkproblem_rdft_1)(&p->sz, &cld_vec, p->ri, p->ro, R2HC);
X(tensor_destroy)(&ri_vec); X(tensor_destroy)(&cld_vec);
}
cld = MKPLAN(plnr, cldp);
Expand Down
4 changes: 2 additions & 2 deletions rdft/dht-r2hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: dht-r2hc.c,v 1.10 2002-09-21 11:58:11 athena Exp $ */
/* $Id: dht-r2hc.c,v 1.11 2002-09-21 22:04:05 athena Exp $ */

/* Solve a DHT problem (Discrete Hartley Transform) via post-processing
of an R2HC problem. */
Expand Down Expand Up @@ -119,7 +119,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
/* stop infinite loops with rdft-dht.c */
plnr->problem_flags |= NO_DHT_R2HC;

cldp = X(mkproblem_rdft_1)(p->sz, p->vecsz, p->I, p->O, R2HC);
cldp = X(mkproblem_rdft_1)(&p->sz, &p->vecsz, p->I, p->O, R2HC);
cld = MKPLAN(plnr, cldp);
X(problem_destroy)(cldp);
if (!cld)
Expand Down
12 changes: 7 additions & 5 deletions rdft/hc2hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: hc2hc.c,v 1.13 2002-09-21 21:47:35 athena Exp $ */
/* $Id: hc2hc.c,v 1.14 2002-09-21 22:04:05 athena Exp $ */

/* generic Cooley-Tukey routines */
#include "rdft.h"
Expand Down Expand Up @@ -203,8 +203,9 @@ void X(rdft_mkcldrn_dit)(const solver_hc2hc *ego, const problem_rdft *p,

radix = X(mktensor_1d)(e->radix, m * d[0].os, m * d[0].os);
null = X(mktensor)(0);
*cld0p = X(mkproblem_rdft_1)(radix, null, p->O, p->O, R2HC);
*cldmp = X(mkproblem_rdft_1)(m%2 ? null : radix, null, p->O+omid,p->O+omid, R2HCII);
*cld0p = X(mkproblem_rdft_1)(&radix, &null, p->O, p->O, R2HC);
*cldmp = X(mkproblem_rdft_1)(m%2 ? &null : &radix, &null,
p->O + omid, p->O + omid, R2HCII);
X(tensor_destroy)(&null);
X(tensor_destroy)(&radix);
}
Expand All @@ -227,8 +228,9 @@ void X(rdft_mkcldrn_dif)(const solver_hc2hc *ego, const problem_rdft *p,

radix = X(mktensor_1d)(e->radix, m * d[0].is, m * d[0].is);
null = X(mktensor)(0);
*cld0p = X(mkproblem_rdft_1)(radix, null, p->I, p->I, HC2R);
*cldmp = X(mkproblem_rdft_1)(m%2 ? null : radix, null, p->I+imid,p->I+imid, HC2RIII);
*cld0p = X(mkproblem_rdft_1)(&radix, &null, p->I, p->I, HC2R);
*cldmp = X(mkproblem_rdft_1)(m%2 ? &null : &radix, &null,
p->I + imid, p->I + imid, HC2RIII);
X(tensor_destroy)(&null);
X(tensor_destroy)(&radix);
}
22 changes: 11 additions & 11 deletions rdft/problem.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: problem.c,v 1.26 2002-09-21 21:47:35 athena Exp $ */
/* $Id: problem.c,v 1.27 2002-09-21 22:04:05 athena Exp $ */

#include "rdft.h"
#include <stddef.h>
Expand Down Expand Up @@ -157,26 +157,26 @@ int X(problem_rdft_p)(const problem *p)
return (p->adt == &padt);
}

problem *X(mkproblem_rdft)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_rdft)(const tensor *sz, const tensor *vecsz,
R *I, R *O, const rdft_kind *kind)
{
problem_rdft *ego =
(problem_rdft *)X(mkproblem)(sizeof(problem_rdft)
+ sizeof(rdft_kind)
* (X(uimax)(1, sz.rnk) - 1),
* (X(uimax)(1, sz->rnk) - 1),
&padt);

uint i, total_n = 1;
for (i = 0; i < sz.rnk; ++i)
total_n *= X(rdft_real_n)(kind[i], sz.dims[i].n);
for (i = 0; i < sz->rnk; ++i)
total_n *= X(rdft_real_n)(kind[i], sz->dims[i].n);
A(total_n > 0); /* or should we use vecsz RNK_MINFTY? */

/* FIXME: how are shifted transforms compressed? */
ego->sz = X(tensor_compress)(&sz);
ego->vecsz = X(tensor_compress_contiguous)(&vecsz);
ego->sz = X(tensor_compress)(sz);
ego->vecsz = X(tensor_compress_contiguous)(vecsz);
ego->I = I;
ego->O = O;
for (i = 0; i < sz.rnk; ++i)
for (i = 0; i < sz->rnk; ++i)
ego->kind[i] = kind[i];

A(FINITE_RNK(ego->sz.rnk));
Expand All @@ -188,17 +188,17 @@ problem *X(mkproblem_rdft_d)(tensor sz, tensor vecsz,
R *I, R *O, const rdft_kind *kind)
{
problem *p;
p = X(mkproblem_rdft)(sz, vecsz, I, O, kind);
p = X(mkproblem_rdft)(&sz, &vecsz, I, O, kind);
X(tensor_destroy)(&vecsz);
X(tensor_destroy)(&sz);
return p;
}

/* As above, but for rnk == 1 only and takes a scalar kind parameter */
problem *X(mkproblem_rdft_1)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_rdft_1)(const tensor *sz, const tensor *vecsz,
R *I, R *O, rdft_kind kind)
{
A(sz.rnk <= 1);
A(sz->rnk <= 1);
return X(mkproblem_rdft)(sz, vecsz, I, O, &kind);
}

Expand Down
10 changes: 5 additions & 5 deletions rdft/problem2.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: problem2.c,v 1.17 2002-09-21 21:47:35 athena Exp $ */
/* $Id: problem2.c,v 1.18 2002-09-21 22:04:05 athena Exp $ */

#include "dft.h"
#include "rdft.h"
Expand Down Expand Up @@ -92,14 +92,14 @@ int X(problem_rdft2_p)(const problem *p)
return (p->adt == &padt);
}

problem *X(mkproblem_rdft2)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_rdft2)(const tensor *sz, const tensor *vecsz,
R *r, R *rio, R *iio, rdft_kind kind)
{
problem_rdft2 *ego =
(problem_rdft2 *)X(mkproblem)(sizeof(problem_rdft2), &padt);

ego->sz = X(tensor_compress)(&sz);
ego->vecsz = X(tensor_compress_contiguous)(&vecsz);
ego->sz = X(tensor_compress)(sz);
ego->vecsz = X(tensor_compress_contiguous)(vecsz);
ego->r = r;
ego->rio = rio;
ego->iio = iio;
Expand All @@ -115,7 +115,7 @@ problem *X(mkproblem_rdft2_d)(tensor sz, tensor vecsz,
R *r, R *rio, R *iio, rdft_kind kind)
{
problem *p;
p = X(mkproblem_rdft2)(sz, vecsz, r, rio, iio, kind);
p = X(mkproblem_rdft2)(&sz, &vecsz, r, rio, iio, kind);
X(tensor_destroy)(&vecsz);
X(tensor_destroy)(&sz);
return p;
Expand Down
4 changes: 2 additions & 2 deletions rdft/rank-geq2.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: rank-geq2.c,v 1.7 2002-09-21 21:47:35 athena Exp $ */
/* $Id: rank-geq2.c,v 1.8 2002-09-21 22:04:05 athena Exp $ */

/* plans for RDFT of rank >= 2 (multidimensional) */

Expand Down Expand Up @@ -89,7 +89,7 @@ static void print(plan *ego_, printer *p)

static int picksplit(const S *ego, const tensor *sz, uint *rp)
{
A(sz.rnk > 1); /* cannot split rnk <= 1 */
A(sz->rnk > 1); /* cannot split rnk <= 1 */
if (!X(pickdim)(ego->spltrnk, ego->buddies, ego->nbuddies, sz, 1, rp))
return 0;
*rp += 1; /* convert from dim. index to rank */
Expand Down
6 changes: 3 additions & 3 deletions rdft/rdft-dht.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: rdft-dht.c,v 1.7 2002-09-21 21:47:35 athena Exp $ */
/* $Id: rdft-dht.c,v 1.8 2002-09-21 22:04:05 athena Exp $ */

/* Solve an R2HC/HC2R problem via post/pre processing of a DHT. This
is mainly useful because we can use Rader to compute DHTs of prime
Expand Down Expand Up @@ -177,10 +177,10 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
p = (const problem_rdft *) p_;

if (p->kind[0] == R2HC || DESTROY_INPUTP(plnr))
cldp = X(mkproblem_rdft_1)(p->sz, p->vecsz, p->I, p->O, DHT);
cldp = X(mkproblem_rdft_1)(&p->sz, &p->vecsz, p->I, p->O, DHT);
else {
tensor sz = X(tensor_copy_inplace)(&p->sz, INPLACE_OS);
cldp = X(mkproblem_rdft_1)(sz, p->vecsz, p->O, p->O, DHT);
cldp = X(mkproblem_rdft_1)(&sz, &p->vecsz, p->O, p->O, DHT);
X(tensor_destroy)(&sz);
}
cld = MKPLAN(plnr, cldp);
Expand Down
8 changes: 4 additions & 4 deletions rdft/rdft.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: rdft.h,v 1.26 2002-09-21 21:47:35 athena Exp $ */
/* $Id: rdft.h,v 1.27 2002-09-21 22:04:05 athena Exp $ */

#ifndef __RDFT_H__
#define __RDFT_H__
Expand All @@ -38,11 +38,11 @@ int X(problem_rdft_p)(const problem *p);
#define RDFTP X(problem_rdft_p) /* shorthand */

void X(rdft_zerotens)(tensor sz, R *I);
problem *X(mkproblem_rdft)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_rdft)(const tensor *sz, const tensor *vecsz,
R *I, R *O, const rdft_kind *kind);
problem *X(mkproblem_rdft_d)(tensor sz, tensor vecsz,
R *I, R *O, const rdft_kind *kind);
problem *X(mkproblem_rdft_1)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_rdft_1)(const tensor *sz, const tensor *vecsz,
R *I, R *O, rdft_kind kind);
problem *X(mkproblem_rdft_1_d)(tensor sz, tensor vecsz,
R *I, R *O, rdft_kind kind);
Expand Down Expand Up @@ -111,7 +111,7 @@ typedef struct {
int X(problem_rdft2_p)(const problem *p);
#define RDFT2P X(problem_rdft2_p) /* shorthand */

problem *X(mkproblem_rdft2)(const tensor sz, const tensor vecsz,
problem *X(mkproblem_rdft2)(const tensor *sz, const tensor *vecsz,
R *r, R *rio, R *iio, rdft_kind kind);
problem *X(mkproblem_rdft2_d)(tensor sz, tensor vecsz,
R *r, R *rio, R *iio, rdft_kind kind);
Expand Down
4 changes: 2 additions & 2 deletions reodft/redft00e-r2hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: redft00e-r2hc.c,v 1.9 2002-09-21 21:47:35 athena Exp $ */
/* $Id: redft00e-r2hc.c,v 1.10 2002-09-21 22:04:05 athena Exp $ */

/* Do a REDFT00 problem via an R2HC problem, with some pre/post-processing. */

Expand Down Expand Up @@ -156,7 +156,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)

{
tensor sz = X(mktensor_1d)(n, 1, 1);
cldp = X(mkproblem_rdft_1)(sz, p->vecsz, buf, buf, R2HC);
cldp = X(mkproblem_rdft_1)(&sz, &p->vecsz, buf, buf, R2HC);
X(tensor_destroy)(&sz);
}

Expand Down
4 changes: 2 additions & 2 deletions reodft/reodft010e-r2hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: reodft010e-r2hc.c,v 1.11 2002-09-21 21:47:35 athena Exp $ */
/* $Id: reodft010e-r2hc.c,v 1.12 2002-09-21 22:04:05 athena Exp $ */

/* Do an R{E,O}DFT{01,10} problem via an R2HC problem, with some
pre/post-processing ala FFTPACK. */
Expand Down Expand Up @@ -335,7 +335,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)

{
tensor sz = X(mktensor_1d)(n, 1, 1);
cldp = X(mkproblem_rdft_1)(sz, p->vecsz, buf, buf, R2HC);
cldp = X(mkproblem_rdft_1)(&sz, &p->vecsz, buf, buf, R2HC);
X(tensor_destroy)(&sz);
}

Expand Down
4 changes: 2 additions & 2 deletions reodft/reodft11e-r2hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: reodft11e-r2hc.c,v 1.9 2002-09-21 21:47:35 athena Exp $ */
/* $Id: reodft11e-r2hc.c,v 1.10 2002-09-21 22:04:05 athena Exp $ */

/* Do an R{E,O}DFT11 problem via an R2HC problem, with some
pre/post-processing ala FFTPACK. Use a trick from:
Expand Down Expand Up @@ -238,7 +238,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)

{
tensor sz = X(mktensor_1d)(n, 1, 1);
cldp = X(mkproblem_rdft_1)(sz, p->vecsz, buf, buf, R2HC);
cldp = X(mkproblem_rdft_1)(&sz, &p->vecsz, buf, buf, R2HC);
X(tensor_destroy)(&sz);
}

Expand Down
4 changes: 2 additions & 2 deletions reodft/rodft00e-r2hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: rodft00e-r2hc.c,v 1.9 2002-09-21 21:47:35 athena Exp $ */
/* $Id: rodft00e-r2hc.c,v 1.10 2002-09-21 22:04:05 athena Exp $ */

/* Do a RODFT00 problem via an R2HC problem, with some pre/post-processing. */

Expand Down Expand Up @@ -152,7 +152,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)

{
tensor sz = X(mktensor_1d)(n, 1, 1);
cldp = X(mkproblem_rdft_1)(sz, p->vecsz, buf, buf, R2HC);
cldp = X(mkproblem_rdft_1)(&sz, &p->vecsz, buf, buf, R2HC);
X(tensor_destroy)(&sz);
}

Expand Down
Loading

0 comments on commit a49b921

Please sign in to comment.