separate out pocketfft
This commit is contained in:
parent
540e7e44f8
commit
bf43082182
7 changed files with 22 additions and 2272 deletions
|
@ -7,8 +7,6 @@ libsharp_la_SOURCES = \
|
|||
c_utils/c_utils.h \
|
||||
c_utils/walltime_c.c \
|
||||
c_utils/walltime_c.h \
|
||||
pocketfft/pocketfft.c \
|
||||
pocketfft/pocketfft.h \
|
||||
libsharp/sharp.c \
|
||||
libsharp/sharp_almhelpers.c \
|
||||
libsharp/sharp_core.c \
|
||||
|
@ -51,11 +49,11 @@ EXTRA_DIST = \
|
|||
|
||||
check_PROGRAMS = sharp_testsuite
|
||||
sharp_testsuite_SOURCES = libsharp/sharp_testsuite.c c_utils/memusage.c c_utils/memusage.h
|
||||
sharp_testsuite_LDADD = libsharp.la
|
||||
sharp_testsuite_LDADD = libsharp.la @POCKETFFT_LIBS@
|
||||
|
||||
TESTS = runtest.sh
|
||||
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_CFLAGS = @AM_CFLAGS@ @POCKETFFT_CFLAGS@
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
nodist_pkgconfig_DATA = @PACKAGE_NAME@.pc
|
||||
|
|
|
@ -22,11 +22,10 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|||
|
||||
AC_PROG_CC_C99
|
||||
|
||||
# adding the lib to the files to link
|
||||
LIBS="-lm"
|
||||
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
PKG_CHECK_MODULES([POCKETFFT], [pocketfft], , [POCKETFFT_LIBS="-lpocketfft -lm"])
|
||||
|
||||
tmpval=`echo $CFLAGS | grep -c '\-DMULTIARCH'`
|
||||
AM_CONDITIONAL([HAVE_MULTIARCH], [test $tmpval -gt 0])
|
||||
|
||||
|
@ -39,6 +38,8 @@ AX_CREATE_PKGCONFIG_INFO(,,,,[])
|
|||
AC_SUBST([LIBS])
|
||||
AC_SUBST([AM_CFLAGS])
|
||||
AC_SUBST([AM_LDFLAGS])
|
||||
AC_SUBST([POCKETFFT_CFLAGS])
|
||||
AC_SUBST([POCKETFFT_LIBS])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -77,7 +77,7 @@ typedef struct
|
|||
double phi0_;
|
||||
dcmplx *shiftarr;
|
||||
int s_shift;
|
||||
rfft_plan plan;
|
||||
pocketfft_plan_r plan;
|
||||
int length;
|
||||
int norot;
|
||||
} ringhelper;
|
||||
|
@ -90,7 +90,7 @@ static void ringhelper_init (ringhelper *self)
|
|||
|
||||
static void ringhelper_destroy (ringhelper *self)
|
||||
{
|
||||
if (self->plan) destroy_rfft_plan(self->plan);
|
||||
if (self->plan) pocketfft_delete_plan_r(self->plan);
|
||||
DEALLOC(self->shiftarr);
|
||||
ringhelper_init(self);
|
||||
}
|
||||
|
@ -110,11 +110,11 @@ NOINLINE static void ringhelper_update (ringhelper *self, int nph, int mmax, dou
|
|||
// double *tmp=(double *) self->shiftarr;
|
||||
// sincos_multi (mmax+1, phi0, &tmp[1], &tmp[0], 2);
|
||||
}
|
||||
// if (!self->plan) self->plan=make_rfft_plan(nph);
|
||||
// if (!self->plan) self->plan=pocketfft_make_plan_r(nph);
|
||||
if (nph!=(int)self->length)
|
||||
{
|
||||
if (self->plan) destroy_rfft_plan(self->plan);
|
||||
self->plan=make_rfft_plan(nph);
|
||||
if (self->plan) pocketfft_delete_plan_r(self->plan);
|
||||
self->plan=pocketfft_make_plan_r(nph);
|
||||
self->length=nph;
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ NOINLINE static void ringhelper_phase2ring (ringhelper *self,
|
|||
}
|
||||
}
|
||||
data[1]=data[0];
|
||||
rfft_backward (self->plan, &(data[1]), 1.);
|
||||
pocketfft_backward_r (self->plan, &(data[1]), 1.);
|
||||
}
|
||||
|
||||
NOINLINE static void ringhelper_ring2phase (ringhelper *self,
|
||||
|
@ -350,7 +350,7 @@ NOINLINE static void ringhelper_ring2phase (ringhelper *self,
|
|||
if (flags&SHARP_REAL_HARMONICS)
|
||||
wgt *= sqrt_two;
|
||||
|
||||
rfft_forward (self->plan, &(data[1]), 1.);
|
||||
pocketfft_forward_r (self->plan, &(data[1]), 1.);
|
||||
data[0]=data[1];
|
||||
data[1]=data[nph+1]=0.;
|
||||
|
||||
|
|
|
@ -155,9 +155,9 @@ void sharp_make_fejer1_geom_info (int nrings, int ppring, double phi0,
|
|||
weight[2*k ]=2./(1.-4.*k*k)*sin((k*pi)/nrings);
|
||||
}
|
||||
if ((nrings&1)==0) weight[nrings-1]=0.;
|
||||
rfft_plan plan = make_rfft_plan(nrings);
|
||||
rfft_backward(plan,weight,1.);
|
||||
destroy_rfft_plan(plan);
|
||||
pocketfft_plan_r plan = pocketfft_make_plan_r(nrings);
|
||||
pocketfft_backward_r(plan,weight,1.);
|
||||
pocketfft_delete_plan_r(plan);
|
||||
|
||||
for (int m=0; m<(nrings+1)/2; ++m)
|
||||
{
|
||||
|
@ -202,9 +202,9 @@ void sharp_make_cc_geom_info (int nrings, int ppring, double phi0,
|
|||
for (int k=1; k<=(n/2-1); ++k)
|
||||
weight[2*k-1]=2./(1.-4.*k*k) + dw;
|
||||
weight[2*(n/2)-1]=(n-3.)/(2*(n/2)-1) -1. -dw*((2-(n&1))*n-1);
|
||||
rfft_plan plan = make_rfft_plan(n);
|
||||
rfft_backward(plan,weight,1.);
|
||||
destroy_rfft_plan(plan);
|
||||
pocketfft_plan_r plan = pocketfft_make_plan_r(n);
|
||||
pocketfft_backward_r(plan,weight,1.);
|
||||
pocketfft_delete_plan_r(plan);
|
||||
weight[n]=weight[0];
|
||||
|
||||
for (int m=0; m<(nrings+1)/2; ++m)
|
||||
|
@ -250,9 +250,9 @@ void sharp_make_fejer2_geom_info (int nrings, int ppring, double phi0,
|
|||
for (int k=1; k<=(n/2-1); ++k)
|
||||
weight[2*k-1]=2./(1.-4.*k*k);
|
||||
weight[2*(n/2)-1]=(n-3.)/(2*(n/2)-1) -1.;
|
||||
rfft_plan plan = make_rfft_plan(n);
|
||||
rfft_backward(plan,weight,1.);
|
||||
destroy_rfft_plan(plan);
|
||||
pocketfft_plan_r plan = pocketfft_make_plan_r(n);
|
||||
pocketfft_backward_r(plan,weight,1.);
|
||||
pocketfft_delete_plan_r(plan);
|
||||
for (int m=0; m<nrings; ++m)
|
||||
weight[m]=weight[m+1];
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
Copyright (C) 2010-2019 Max-Planck-Society
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
* Neither the name of the Astropy Team nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
File diff suppressed because it is too large
Load diff
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* This file is part of pocketfft.
|
||||
* Licensed under a 3-clause BSD style license - see LICENSE.md
|
||||
*/
|
||||
|
||||
/*! \file pocketfft.h
|
||||
* Public interface of the pocketfft library
|
||||
*
|
||||
* Copyright (C) 2008-2019 Max-Planck-Society
|
||||
* \author Martin Reinecke
|
||||
*/
|
||||
|
||||
#ifndef POCKETFFT_H
|
||||
#define POCKETFFT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct cfft_plan_i;
|
||||
typedef struct cfft_plan_i * cfft_plan;
|
||||
cfft_plan make_cfft_plan (size_t length);
|
||||
void destroy_cfft_plan (cfft_plan plan);
|
||||
int cfft_backward(cfft_plan plan, double c[], double fct);
|
||||
int cfft_forward(cfft_plan plan, double c[], double fct);
|
||||
size_t cfft_length(cfft_plan plan);
|
||||
|
||||
struct rfft_plan_i;
|
||||
typedef struct rfft_plan_i * rfft_plan;
|
||||
rfft_plan make_rfft_plan (size_t length);
|
||||
void destroy_rfft_plan (rfft_plan plan);
|
||||
int rfft_backward(rfft_plan plan, double c[], double fct);
|
||||
int rfft_forward(rfft_plan plan, double c[], double fct);
|
||||
size_t rfft_length(rfft_plan plan);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue