Debian Codegraph @

libs/image/3rdparty/einspline/nubasis.h

raw symbols SCIP
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 //
19 /////////////////////////////////////////////////////////////////////////////
20
21 #ifndef NUBASIS_H
22 #define NUBASIS_H
23
24 #include "nugrid.h"
25 //#include "config.h"
26
27 typedef struct
28 {
29 NUgrid* restrict grid;
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;
36 bool periodic;
37 } NUBasis;
38
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /////////////////
45 // Constructor //
46 /////////////////
47 NUBasis*
48 create_NUBasis (NUgrid *grid, bool periodic);
49
50 ////////////////
51 // Destructor //
52 ////////////////
53 void
54 destroy_NUBasis (NUBasis *basis);
55
56
57 ////////////////////////////////////////////////
58 // Single-precision basis function evaluation //
59 ////////////////////////////////////////////////
60 int
61 get_NUBasis_funcs_s (NUBasis* restrict basis, double x,
62 float bfuncs[4]);
63 void
64 get_NUBasis_funcs_si (NUBasis* restrict basis, int i,
65 float bfuncs[4]);
66
67 int
68 get_NUBasis_dfuncs_s (NUBasis* restrict basis, double x,
69 float bfuncs[4], float dbfuncs[4]);
70 void
71 get_NUBasis_dfuncs_si (NUBasis* restrict basis, int i,
72 float bfuncs[4], float dbfuncs[4]);
73
74 int
75 get_NUBasis_d2funcs_s (NUBasis* restrict basis, double x,
76 float bfuncs[4], float dbfuncs[4], float d2bfuncs[4]);
77 void
78 get_NUBasis_d2funcs_si (NUBasis* restrict basis, int i,
79 float bfuncs[4], float dbfuncs[4], float d2bfuncs[4]);
80
81 ////////////////////////////////////////////////
82 // Double-precision basis function evaluation //
83 ////////////////////////////////////////////////
84 int
85 get_NUBasis_funcs_d (NUBasis* restrict basis, double x,
86 double bfuncs[4]);
87 void
88 get_NUBasis_funcs_di (NUBasis* restrict basis, int i,
89 double bfuncs[4]);
90 int
91 get_NUBasis_dfuncs_d (NUBasis* restrict basis, double x,
92 double bfuncs[4], double dbfuncs[4]);
93 void
94 get_NUBasis_dfuncs_di (NUBasis* restrict basis, int i,
95 double bfuncs[4], double dbfuncs[4]);
96 int
97 get_NUBasis_d2funcs_d (NUBasis* restrict basis, double x,
98 double bfuncs[4], double dbfuncs[4],
99 double d2bfuncs[4]);
100 void
101 get_NUBasis_d2funcs_di (NUBasis* restrict basis, int i,
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
113 extern "C" {
114 #endif
115 int
116 get_NUBasis_funcs_sse_s (NUBasis* restrict basis, double x,
117 __m128 *restrict funcs);
118 int
119 get_NUBasis_dfuncs_sse_s (NUBasis* restrict basis, double x,
120 __m128 *restrict funcs, __m128 *restrict dfuncs);
121 int
122 get_NUBasis_d2funcs_sse_s (NUBasis* restrict basis, double x,
123 __m128 *restrict funcs,
124 __m128 *restrict dfuncs,
125 __m128 *restrict d2funcs);
126
127 int
128 get_NUBasis_funcs_sse_d (NUBasis* restrict basis, double x,
129 __m128d *restrict f01, __m128d *restrict f23);
130 int
131 get_NUBasis_dfuncs_sse_d (NUBasis* restrict basis, double x,
132 __m128d *restrict f01, __m128d *restrict f23,
133 __m128d *restrict df01, __m128d *restrict df23);
134 int
135 get_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