Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
BasedOnStyle: LLVM

AccessModifierOffset: -4

AlignConsecutiveMacros: true
AlignConsecutiveBitFields: true
AlignEscapedNewlines: Right

AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty

AlwaysBreakTemplateDeclarations: Yes

BinPackParameters: false

BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom

ColumnLimit: 80

IndentWidth: 4
IndentWrappedFunctionNames: true

Standard: c++17
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@

# Add cython-lint to pre-commit config
5df98187dda56f6d340f0824570fe5080d0b4f05

# Move from clang-format-15 to clang-format-22
ffe413c18571422f4b974e780ea19f83f1f776bf
7 changes: 0 additions & 7 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,5 @@ jobs:
codespell
pylint

- name: Set up clang-format
run: |
sudo apt-get install -y clang-format-15
sudo unlink /usr/bin/clang-format
sudo ln -s /usr/bin/clang-format-15 /usr/bin/clang-format
clang-format --version

- name: Run pre-commit checks
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ repos:
- id: black
exclude: "_vendored/conv_template.py"

- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.0
hooks:
- id: clang-format
args: ["-i"]
Expand Down
181 changes: 119 additions & 62 deletions mkl_fft/src/mklfft.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,96 +27,153 @@
#include "mkl.h"
#include "numpy/arrayobject.h"

typedef struct DftiCache {
DFTI_DESCRIPTOR_HANDLE hand;
int initialized;
typedef struct DftiCache
{
DFTI_DESCRIPTOR_HANDLE hand;
int initialized;
} DftiCache;

extern int _free_dfti_cache(DftiCache *);

/* Complex input, in-place */
extern int cdouble_mkl_fft1d_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int cfloat_mkl_fft1d_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int cdouble_mkl_ifft1d_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int cfloat_mkl_ifft1d_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int
cdouble_mkl_fft1d_in(PyArrayObject *, npy_intp, int, double, DftiCache *);
extern int
cfloat_mkl_fft1d_in(PyArrayObject *, npy_intp, int, double, DftiCache *);
extern int
cdouble_mkl_ifft1d_in(PyArrayObject *, npy_intp, int, double, DftiCache *);
extern int
cfloat_mkl_ifft1d_in(PyArrayObject *, npy_intp, int, double, DftiCache *);

/* Complex input/output, out-of-place */
extern int cfloat_cfloat_mkl_fft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int cdouble_cdouble_mkl_fft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int cfloat_cfloat_mkl_ifft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int cdouble_cdouble_mkl_ifft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int cfloat_cfloat_mkl_fft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);
extern int cdouble_cdouble_mkl_fft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);
extern int cfloat_cfloat_mkl_ifft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);
extern int cdouble_cdouble_mkl_ifft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);

/* Real input, complex output, out-of-place */
extern int float_cfloat_mkl_fft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, int, double,
extern int float_cfloat_mkl_fft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
int,
double,
DftiCache *);
extern int double_cdouble_mkl_fft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, int, double,
extern int double_cdouble_mkl_fft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
int,
double,
DftiCache *);
extern int float_cfloat_mkl_ifft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, int, double,
extern int float_cfloat_mkl_ifft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
int,
double,
DftiCache *);
extern int double_cdouble_mkl_ifft1d_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, int, double,
extern int double_cdouble_mkl_ifft1d_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
int,
double,
DftiCache *);

/* Real input, real output, in-place */
extern int float_mkl_rfft_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int float_mkl_irfft_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int
float_mkl_rfft_in(PyArrayObject *, npy_intp, int, double, DftiCache *);
extern int
float_mkl_irfft_in(PyArrayObject *, npy_intp, int, double, DftiCache *);

extern int double_mkl_rfft_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int double_mkl_irfft_in(PyArrayObject *, npy_intp, int, double,
DftiCache *);
extern int
double_mkl_rfft_in(PyArrayObject *, npy_intp, int, double, DftiCache *);
extern int
double_mkl_irfft_in(PyArrayObject *, npy_intp, int, double, DftiCache *);

/* Real input, real output, out-of-place */
extern int float_float_mkl_rfft_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int float_float_mkl_irfft_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);

extern int double_double_mkl_rfft_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int double_double_mkl_irfft_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int float_float_mkl_rfft_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);
extern int float_float_mkl_irfft_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);

extern int double_double_mkl_rfft_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);
extern int double_double_mkl_irfft_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);

/* Complex input. real output, out-of-place */
extern int cdouble_double_mkl_irfft_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int cfloat_float_mkl_irfft_out(PyArrayObject *, npy_intp, int,
PyArrayObject *, double, DftiCache *);
extern int cdouble_double_mkl_irfft_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);
extern int cfloat_float_mkl_irfft_out(PyArrayObject *,
npy_intp,
int,
PyArrayObject *,
double,
DftiCache *);

/* Complex, ND, in-place */
extern int cdouble_cdouble_mkl_fftnd_in(PyArrayObject *, double);
extern int cdouble_cdouble_mkl_ifftnd_in(PyArrayObject *, double);
extern int cfloat_cfloat_mkl_fftnd_in(PyArrayObject *, double);
extern int cfloat_cfloat_mkl_ifftnd_in(PyArrayObject *, double);

extern int cdouble_cdouble_mkl_fftnd_out(PyArrayObject *, PyArrayObject *,
double);
extern int cdouble_cdouble_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *,
double);
extern int cfloat_cfloat_mkl_fftnd_out(PyArrayObject *, PyArrayObject *,
double);
extern int cfloat_cfloat_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *,
double);
extern int
cdouble_cdouble_mkl_fftnd_out(PyArrayObject *, PyArrayObject *, double);
extern int
cdouble_cdouble_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *, double);
extern int
cfloat_cfloat_mkl_fftnd_out(PyArrayObject *, PyArrayObject *, double);
extern int
cfloat_cfloat_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *, double);

extern int float_cfloat_mkl_fftnd_out(PyArrayObject *, PyArrayObject *, double);
extern int float_cfloat_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *,
double);
extern int double_cdouble_mkl_fftnd_out(PyArrayObject *, PyArrayObject *,
double);
extern int double_cdouble_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *,
double);
extern int
float_cfloat_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *, double);
extern int
double_cdouble_mkl_fftnd_out(PyArrayObject *, PyArrayObject *, double);
extern int
double_cdouble_mkl_ifftnd_out(PyArrayObject *, PyArrayObject *, double);

extern char *mkl_dfti_error(MKL_LONG);
Loading
Loading