Skip to main content

slatec_sys/
lib.rs

1#![no_std]
2#![allow(unused_doc_comments)]
3
4//! Raw declarations generated from the selected, compiler-observed SLATEC corpus.
5//!
6//! The crate deliberately performs no download, native compilation, linking,
7//! or safe conversion in `build.rs`. Native provider selection and automatic
8//! hosted linking belong to `slatec-src`; an external-backend consumer can use
9//! these declarations without any hidden native build directive.
10//!
11//! # Stability policy
12//!
13//! Reviewed declarations are promoted directly to canonical mathematical
14//! modules. ABI-shaped declaration modules are private implementation details,
15//! not public API paths. The source-hash-guarded raw API inventory defines
16//! reviewed status, documentation, and validation coverage. An
17//! evidence-proven ABI correction may change an unsafe signature, because an
18//! incorrect FFI declaration is a safety bug. Generated implementation access
19//! is transitional and unstable unless a declaration is re-exported from its
20//! canonical mathematical module.
21//!
22//! Semantic documentation completion is evaluated on the rendered canonical
23//! item, not on a generated fragment. Its source-first direction evidence,
24//! argument-contamination checks, and applicable callback/status/workspace
25//! contracts are recorded under `generated/slatec-routines` in the workspace.
26
27/// GNU Fortran default `INTEGER` after the supported profile probe.
28#[cfg(feature = "ffi-profile-gnu-mingw-x86_64")]
29pub type FortranInteger = i32;
30
31/// GNU Fortran default `LOGICAL` after the supported profile probe. This is
32/// intentionally not Rust `bool`.
33#[cfg(feature = "ffi-profile-gnu-mingw-x86_64")]
34pub type FortranLogical = i32;
35
36/// GNU Fortran hidden CHARACTER length for the supported 64-bit profile.
37#[cfg(feature = "ffi-profile-gnu-mingw-x86_64")]
38pub type FortranCharacterLength = usize;
39
40/// GNU Fortran-compatible default `COMPLEX` storage used by the validated raw
41/// ABI profile. This is a layout record, not a safe numerical type.
42#[cfg(feature = "ffi-profile-gnu-mingw-x86_64")]
43#[repr(C)]
44#[derive(Clone, Copy, Debug, Default, PartialEq)]
45pub struct Complex32 {
46    pub re: f32,
47    pub im: f32,
48}
49
50/// GNU Fortran-compatible default `DOUBLE COMPLEX` storage used by the
51/// validated raw ABI profile. This is a layout record, not a safe numerical
52/// type.
53#[cfg(feature = "ffi-profile-gnu-mingw-x86_64")]
54#[repr(C)]
55#[derive(Clone, Copy, Debug, Default, PartialEq)]
56pub struct Complex64 {
57    pub re: f64,
58    pub im: f64,
59}
60
61#[allow(unused_macros)]
62macro_rules! public_binding_module {
63    ($binding:ident, $public:ident, $path:literal, $description:literal) => {
64        #[path = $path]
65        mod $binding;
66
67        #[doc = $description]
68        pub mod $public {
69            #[doc(inline)]
70            pub use crate::$binding::*;
71        }
72    };
73}
74
75#[path = "generated/mod.rs"]
76mod generated_ffi;
77
78/// Private ABI-shaped declaration re-exports used while generating and
79/// validating canonical mathematical modules.
80#[path = "generated_compat.rs"]
81mod generated;
82
83/// Canonical reviewed raw BLAS namespace.
84///
85/// Enable `blas-level1`, `blas-level2`, `blas-level3`, or the aggregate
86/// `blas` feature.
87#[cfg(any(
88    feature = "blas-level1",
89    feature = "blas-level2",
90    feature = "blas-level3",
91    feature = "raw-family-blas-level1",
92    feature = "raw-family-blas-level2",
93    feature = "raw-family-blas-level3",
94    feature = "raw-family-blas-complex"
95))]
96pub mod blas;
97
98/// Canonical reviewed raw scalar special-function namespaces.
99///
100/// Enable one of `special-elementary`, `special-gamma`, `special-beta`,
101/// `special-error`, or `special-airy`, or the aggregate `special`. The
102/// remaining public special subfamilies use their canonical mathematical paths.
103#[cfg(any(
104    feature = "special-elementary",
105    feature = "special-gamma",
106    feature = "special-beta",
107    feature = "special-error",
108    feature = "special-airy",
109    feature = "special-real",
110    feature = "raw-family-special-elementary",
111    feature = "raw-family-special-gamma",
112    feature = "raw-family-special-beta",
113    feature = "raw-family-special-error",
114    feature = "raw-family-special-airy",
115    feature = "raw-family-special-real",
116    feature = "raw-family-special-complex"
117))]
118public_binding_module!(
119    special_bindings,
120    special,
121    "special.rs",
122    "Canonical raw special-function bindings organized by mathematical subfamily."
123);
124
125/// Canonical generated linear-algebra declarations.
126#[cfg(any(
127    feature = "linear-algebra-real",
128    feature = "linear-algebra-iterative",
129    feature = "linear-algebra-eigen",
130    feature = "raw-family-linear-algebra-real",
131    feature = "raw-family-linear-algebra-eigen",
132    feature = "raw-family-linear-algebra-iterative",
133    feature = "raw-family-linear-algebra-complex"
134))]
135public_binding_module!(
136    linear_algebra_bindings,
137    linear_algebra,
138    "linear_algebra.rs",
139    "Canonical raw linear-algebra bindings organized by storage and eigenproblem class."
140);
141
142#[cfg(any(
143    feature = "raw-family-blas-complex",
144    feature = "raw-family-linear-algebra-complex",
145    feature = "raw-family-special-complex",
146    feature = "raw-family-nonlinear-complex",
147    feature = "raw-family-fishpack-complex"
148))]
149#[path = "batch_c/mod.rs"]
150mod abi_bindings;
151
152#[cfg(feature = "approximation-core")]
153public_binding_module!(
154    approximation_bindings,
155    approximation,
156    "batch_a/approximation.rs",
157    "Canonical raw approximation bindings."
158);
159
160#[cfg(feature = "interpolation-general")]
161public_binding_module!(
162    interpolation_bindings,
163    interpolation,
164    "batch_a/interpolation.rs",
165    "Canonical raw interpolation bindings."
166);
167
168#[cfg(feature = "statistics-core")]
169public_binding_module!(
170    statistics_bindings,
171    statistics,
172    "batch_a/statistics.rs",
173    "Canonical raw probability and statistics bindings."
174);
175
176/// Private raw declaration groupings used by canonical family modules.
177#[cfg(any(
178    feature = "raw-family-blas-level1",
179    feature = "raw-family-blas-level2",
180    feature = "raw-family-blas-level3",
181    feature = "raw-family-special-elementary",
182    feature = "raw-family-special-gamma",
183    feature = "raw-family-special-beta",
184    feature = "raw-family-special-error",
185    feature = "raw-family-special-airy",
186    feature = "raw-family-special-bessel",
187    feature = "raw-family-special-integrals",
188    feature = "raw-family-special-polynomials",
189    feature = "raw-family-fftpack-real",
190    feature = "raw-family-pchip",
191    feature = "raw-family-bspline",
192    feature = "raw-family-piecewise-polynomial"
193))]
194#[path = "families.rs"]
195mod families;
196
197/// Private declaration owner for expanded scalar special functions.
198#[cfg(feature = "raw-family-special-scalar-expanded")]
199#[path = "special_scalar_expanded.rs"]
200mod special_scalar_expanded;
201
202/// Hand-reviewed real FFTPACK declarations for the plan-based safe API.
203#[cfg(any(
204    feature = "raw-family-fftpack-real",
205    feature = "raw-family-fftpack-extended-real",
206    feature = "raw-family-fftpack-complex"
207))]
208public_binding_module!(
209    fftpack_bindings,
210    fftpack,
211    "fftpack.rs",
212    "Canonical raw FFTPACK bindings."
213);
214
215/// Private declaration owner for complex FFTPACK routines; canonical paths are
216/// nested under [`fftpack`].
217#[cfg(feature = "raw-family-fftpack-complex")]
218#[path = "fftpack_complex.rs"]
219mod fftpack_complex;
220
221/// Private declaration owner for the focused Cartesian FISHPACK driver.
222#[cfg(feature = "raw-family-fishpack-cartesian-2d")]
223#[path = "fishpack_cartesian_2d.rs"]
224mod fishpack_cartesian_2d;
225
226/// Private declaration owner for the focused structured FISHPACK `POIS3D`
227/// driver.
228#[cfg(feature = "raw-family-fishpack-pois3d")]
229#[path = "fishpack_pois3d.rs"]
230mod fishpack_pois3d;
231
232/// Canonical raw PDE namespace.
233///
234/// Only reviewed FISHPACK drivers are re-exported here from their private
235/// declaration owners.
236/// Private declaration owner for canonical general FISHPACK bindings.
237///
238/// This is kept at the crate root so the `#[path]` is valid on filesystems
239/// that require each intermediate directory in a relative path to exist.
240#[cfg(feature = "raw-family-fishpack-general")]
241#[path = "batch_a/pde_fishpack.rs"]
242mod fishpack_general_bindings;
243
244#[cfg(any(
245    feature = "raw-family-fishpack-cartesian-2d",
246    feature = "raw-family-fishpack-pois3d",
247    feature = "raw-family-fishpack-general",
248    feature = "raw-family-fishpack-complex"
249))]
250pub mod pde {
251    /// Canonical reviewed FISHPACK driver namespace.
252    pub mod fishpack {
253        #[cfg(feature = "raw-family-fishpack-cartesian-2d")]
254        #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/generated_docs/hwscrt.md"))]
255        pub use crate::fishpack_cartesian_2d::hwscrt;
256        #[cfg(feature = "raw-family-fishpack-general")]
257        pub use crate::fishpack_general_bindings::*;
258        #[cfg(feature = "raw-family-fishpack-pois3d")]
259        #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/generated_docs/pois3d.md"))]
260        pub use crate::fishpack_pois3d::pois3d;
261        #[cfg(feature = "raw-family-fishpack-complex")]
262        pub mod complex {
263            pub use crate::abi_bindings::fishpack::*;
264        }
265    }
266}
267
268/// Private declaration owner for general-band factorization and solve routines.
269#[cfg(any(
270    feature = "raw-family-banded-linear-systems",
271    feature = "raw-family-linear-algebra-real"
272))]
273#[path = "banded.rs"]
274mod banded;
275
276/// Private declaration owner for PCHIP routines.
277#[cfg(any(
278    feature = "raw-family-pchip",
279    feature = "raw-family-interpolation-general"
280))]
281#[path = "pchip.rs"]
282mod pchip;
283
284/// Canonical raw B-spline declarations used by the reviewed safe
285/// representation API.
286///
287/// Enable the `bspline` feature. These declarations are provider-neutral;
288/// select a provider separately through `slatec-src` or an external native
289/// configuration.
290#[cfg(any(
291    feature = "raw-family-bspline",
292    feature = "raw-family-interpolation-general"
293))]
294#[path = "bspline.rs"]
295pub mod bspline;
296
297/// Private declaration owner for PP-form evaluation, integration, and B-spline
298/// conversion.
299#[cfg(any(
300    feature = "raw-family-piecewise-polynomial",
301    feature = "raw-family-interpolation-general"
302))]
303#[path = "piecewise_polynomial.rs"]
304/// Canonical raw PP-form evaluation, integration, and conversion declarations.
305pub mod piecewise_polynomial;
306
307/// Hand-reviewed callback declarations for the focused safe QUADPACK surface.
308///
309/// These declarations remain separate from the ABI-shaped callback layer:
310/// only the eight routines whose callback and workspace contracts are tested
311/// by `slatec::quadrature` are available here.
312#[cfg(any(
313    feature = "raw-ffi-quadrature",
314    feature = "raw-family-quadrature-basic",
315    feature = "raw-family-quadrature-breakpoints",
316    feature = "raw-family-quadrature-weighted",
317    feature = "raw-family-quadrature-oscillatory",
318    feature = "raw-family-quadrature-fourier",
319    feature = "raw-family-quadrature-nonadaptive",
320    feature = "raw-family-quadrature-direct",
321    feature = "raw-family-quadrature-callbacks"
322))]
323public_binding_module!(
324    quadrature_bindings,
325    quadrature,
326    "quadrature.rs",
327    "Canonical raw numerical quadrature bindings."
328);
329
330/// Hand-reviewed scalar callback declarations for the focused FZERO family.
331///
332/// This narrow module remains separate from the general callback declaration layer.
333#[cfg(any(
334    feature = "raw-ffi-roots",
335    feature = "raw-family-roots-scalar",
336    feature = "raw-family-nonlinear-complex"
337))]
338public_binding_module!(
339    roots_bindings,
340    roots,
341    "roots.rs",
342    "Canonical raw scalar root-finding bindings."
343);
344
345/// Hand-reviewed nonlinear callback and Jacobian-check declarations.
346///
347/// This narrow module exposes `SNSQE`, `DNSQE`, `SNSQ`, `DNSQ`, `CHKDER`, and
348/// `DCKDER` for the validated GNU MinGW ABI profile. The declarations remain
349/// unsafe because the caller owns callback lifetime, vector and matrix
350/// storage, workspace, and runtime serialization.
351#[cfg(any(
352    feature = "raw-ffi-nonlinear",
353    feature = "raw-family-nonlinear-easy",
354    feature = "raw-family-nonlinear-expert",
355    feature = "raw-family-nonlinear-jacobian-check",
356    feature = "raw-family-nonlinear-jacobian",
357    feature = "raw-family-nonlinear-systems",
358    feature = "raw-family-nonlinear-complex"
359))]
360public_binding_module!(
361    nonlinear_bindings,
362    nonlinear,
363    "nonlinear.rs",
364    "Canonical raw nonlinear-system bindings."
365);
366
367/// Hand-reviewed `SDRIV3`/`DDRIV3` declarations for the safe RHS-only ODE
368/// session feature.
369#[cfg(any(
370    feature = "raw-ffi-ode",
371    feature = "raw-family-ode-sdrive-expert",
372    feature = "raw-family-ode-integration",
373    feature = "raw-family-ode-callbacks"
374))]
375public_binding_module!(
376    ode_bindings,
377    ode,
378    "ode.rs",
379    "Canonical raw ordinary-differential-equation bindings."
380);
381
382/// Hand-reviewed `SDASSL`/`DDASSL` declarations for the restricted safe
383/// residual-only DAE session feature.
384#[cfg(feature = "raw-family-dassl")]
385public_binding_module!(
386    dassl_bindings,
387    dassl,
388    "dassl.rs",
389    "Canonical raw differential-algebraic-equation bindings."
390);
391
392/// Hand-reviewed `SPLP`/`DSPLP` declarations for the in-memory-only safe
393/// linear-programming feature.
394#[cfg(feature = "raw-family-optimization-linear-programming-in-memory")]
395public_binding_module!(
396    linear_programming_bindings,
397    linear_programming,
398    "linear_programming.rs",
399    "Canonical raw linear-programming bindings."
400);
401
402/// Hand-reviewed declarations for nonlinear least-squares easy and expert
403/// drivers.
404///
405/// This narrow module contains `SNLS1E`, `DNLS1E`, `SNLS1`, `DNLS1`, `SCOV`,
406/// and `DCOV`.
407/// It remains separate from the broad callback declaration layer: safe callers must still
408/// uphold callback lifetime, rectangular Jacobian, workspace, and process-wide
409/// runtime invariants.
410#[cfg(any(
411    feature = "raw-ffi-least-squares",
412    feature = "raw-family-least-squares-nonlinear-easy",
413    feature = "raw-family-least-squares-nonlinear-expert",
414    feature = "raw-family-least-squares-covariance"
415))]
416public_binding_module!(
417    least_squares_bindings,
418    least_squares,
419    "least_squares.rs",
420    "Canonical raw nonlinear least-squares bindings."
421);
422
423/// Hand-reviewed declarations for constrained linear least squares.
424///
425/// This narrow module exposes `WNNLS`/`DWNNLS`, `SBOLS`/`DBOLS`,
426/// `LSEI`/`DLSEI`, and `SBOCLS`/`DBOCLS`. The
427/// routines mutate their augmented matrix and work arrays, so the declarations
428/// remain unsafe.
429#[cfg(any(
430    feature = "raw-ffi-linear-least-squares",
431    feature = "raw-family-least-squares-linear-nonnegative",
432    feature = "raw-family-least-squares-linear-bounded",
433    feature = "raw-family-least-squares-linear-constrained",
434    feature = "raw-family-least-squares-linear-bounded-constrained",
435    feature = "raw-family-approximation-core"
436))]
437public_binding_module!(
438    linear_least_squares_bindings,
439    linear_least_squares,
440    "linear_least_squares.rs",
441    "Canonical raw constrained linear least-squares bindings."
442);
443
444/// Minimal internal-facing legacy-error controls required by reviewed native
445/// families with recoverable status messages.
446///
447/// `DNLS1`/`SNLS1` and `SDRIV3`/`DDRIV3` report selected meaningful completion
448/// states through `XERMSG`. Safe wrappers use these declarations privately to
449/// make documented recoverable messages return through their native status
450/// values while preserving and restoring the process-global control flag.
451#[cfg(any(
452    feature = "raw-family-least-squares-nonlinear-easy",
453    feature = "raw-family-least-squares-nonlinear-expert",
454    feature = "raw-family-least-squares-covariance",
455    feature = "raw-family-least-squares-linear-bounded",
456    feature = "raw-family-least-squares-linear-constrained",
457    feature = "raw-family-least-squares-linear-bounded-constrained",
458    feature = "raw-family-ode-sdrive-expert",
459    feature = "raw-family-dassl",
460    feature = "raw-family-optimization-linear-programming-in-memory",
461    feature = "raw-family-pchip",
462    feature = "raw-family-bspline",
463    feature = "raw-family-piecewise-polynomial",
464    feature = "raw-family-special-scalar-expanded"
465))]
466public_binding_module!(
467    legacy_error_bindings,
468    legacy_error,
469    "legacy_error.rs",
470    "Low-level legacy error-control bindings used by reviewed numerical families."
471);