Krita Source Code Documentation
Loading...
Searching...
No Matches
nubasis.h
Go to the documentation of this file.
1
2// einspline: a library for creating and evaluating B-splines //
3// Copyright (C) 2007 Kenneth P. Esler, Jr. //
4// //
5// This program is free software; you can redistribute it and/or modify //
6// it under the terms of the GNU General Public License as published by //
7// the Free Software Foundation; either version 2 of the License, or //
8// (at your option) any later version. //
9// //
10// This program is distributed in the hope that it will be useful, //
11// but WITHOUT ANY WARRANTY; without even the implied warranty of //
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13// GNU General Public License for more details. //
14// //
15// You should have received a copy of the GNU General Public License //
16// along with this program; if not, write to the Free Software //
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, //
18// Boston, MA 02110-1301 USA //
20
21#ifndef NUBASIS_H
22#define NUBASIS_H
23
24#include "nugrid.h"
25//#include "config.h"
26
27typedef struct
28{
30 // xVals is just the grid points, augmented by two extra points on
31 // either side. These are necessary to generate enough basis
32 // functions.
33 double* restrict xVals;
34 // dxInv[3*i+j] = 1.0/(grid(i+j-1)-grid(i-2))
35 double* restrict dxInv;
37} NUBasis;
38
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
45// Constructor //
48create_NUBasis (NUgrid *grid, bool periodic);
49
51// Destructor //
53void
55
56
58// Single-precision basis function evaluation //
60int
61get_NUBasis_funcs_s (NUBasis* restrict basis, double x,
62 float bfuncs[4]);
63void
65 float bfuncs[4]);
66
67int
68get_NUBasis_dfuncs_s (NUBasis* restrict basis, double x,
69 float bfuncs[4], float dbfuncs[4]);
70void
72 float bfuncs[4], float dbfuncs[4]);
73
74int
75get_NUBasis_d2funcs_s (NUBasis* restrict basis, double x,
76 float bfuncs[4], float dbfuncs[4], float d2bfuncs[4]);
77void
79 float bfuncs[4], float dbfuncs[4], float d2bfuncs[4]);
80
82// Double-precision basis function evaluation //
84int
85get_NUBasis_funcs_d (NUBasis* restrict basis, double x,
86 double bfuncs[4]);
87void
89 double bfuncs[4]);
90int
91get_NUBasis_dfuncs_d (NUBasis* restrict basis, double x,
92 double bfuncs[4], double dbfuncs[4]);
93void
95 double bfuncs[4], double dbfuncs[4]);
96int
97get_NUBasis_d2funcs_d (NUBasis* restrict basis, double x,
98 double bfuncs[4], double dbfuncs[4],
99 double d2bfuncs[4]);
100void
102 double bfuncs[4], double dbfuncs[4],
103 double d2bfuncs[4]);
104#ifdef __cplusplus
105}
106#endif
107
108#ifdef HAVE_SSE2
109#include <xmmintrin.h>
110#include <emmintrin.h>
111
112#ifdef __cplusplus
113extern "C" {
114#endif
115int
116get_NUBasis_funcs_sse_s (NUBasis* restrict basis, double x,
117 __m128 *restrict funcs);
118int
119get_NUBasis_dfuncs_sse_s (NUBasis* restrict basis, double x,
120 __m128 *restrict funcs, __m128 *restrict dfuncs);
121int
122get_NUBasis_d2funcs_sse_s (NUBasis* restrict basis, double x,
123 __m128 *restrict funcs,
124 __m128 *restrict dfuncs,
125 __m128 *restrict d2funcs);
126
127int
128get_NUBasis_funcs_sse_d (NUBasis* restrict basis, double x,
129 __m128d *restrict f01, __m128d *restrict f23);
130int
131get_NUBasis_dfuncs_sse_d (NUBasis* restrict basis, double x,
132 __m128d *restrict f01, __m128d *restrict f23,
133 __m128d *restrict df01, __m128d *restrict df23);
134int
135get_NUBasis_d2funcs_sse_d (NUBasis* restrict basis, double x,
136 __m128d *restrict f01, __m128d *restrict f23,
137 __m128d *restrict df01, __m128d *restrict df23,
138 __m128d *restrict d2f01, __m128d *restrict d2f23);
139#ifdef __cplusplus
140}
141#endif
142#endif // #ifdef HAVE_SSE2
143
144#endif // #ifdef NUBASIS_H
#define restrict
void get_NUBasis_funcs_si(NUBasis *restrict basis, int i, float bfuncs[4])
Definition nubasis.cpp:97
void get_NUBasis_dfuncs_si(NUBasis *restrict basis, int i, float bfuncs[4], float dbfuncs[4])
Definition nubasis.cpp:153
void destroy_NUBasis(NUBasis *basis)
Definition nubasis.cpp:62
NUBasis * create_NUBasis(NUgrid *grid, bool periodic)
Definition nubasis.cpp:27
void get_NUBasis_d2funcs_di(NUBasis *restrict basis, int i, double bfuncs[4], double dbfuncs[4], double d2bfuncs[4])
Definition nubasis.cpp:413
void get_NUBasis_dfuncs_di(NUBasis *restrict basis, int i, double bfuncs[4], double dbfuncs[4])
Definition nubasis.cpp:344
int get_NUBasis_d2funcs_d(NUBasis *restrict basis, double x, double bfuncs[4], double dbfuncs[4], double d2bfuncs[4])
Definition nubasis.cpp:374
int get_NUBasis_dfuncs_d(NUBasis *restrict basis, double x, double bfuncs[4], double dbfuncs[4])
Definition nubasis.cpp:312
int get_NUBasis_dfuncs_s(NUBasis *restrict basis, double x, float bfuncs[4], float dbfuncs[4])
Definition nubasis.cpp:121
int get_NUBasis_funcs_d(NUBasis *restrict basis, double x, double bfuncs[4])
Definition nubasis.cpp:262
int get_NUBasis_funcs_s(NUBasis *restrict basis, double x, float bfuncs[4])
Definition nubasis.cpp:71
void get_NUBasis_funcs_di(NUBasis *restrict basis, int i, double bfuncs[4])
Definition nubasis.cpp:288
void get_NUBasis_d2funcs_si(NUBasis *restrict basis, int i, float bfuncs[4], float dbfuncs[4], float d2bfuncs[4])
Definition nubasis.cpp:222
int get_NUBasis_d2funcs_s(NUBasis *restrict basis, double x, float bfuncs[4], float dbfuncs[4], float d2bfuncs[4])
Definition nubasis.cpp:183
double *restrict xVals
Definition nubasis.h:33
bool periodic
Definition nubasis.h:36
double *restrict dxInv
Definition nubasis.h:35
NUgrid *restrict grid
Definition nubasis.h:29