Skip to content

Implementation of a 1D Interpolation Module #1138

@srinjoy933

Description

@srinjoy933

To implement a high-performance 1D interpolation module in fortran_stdlib, I propose a design centered on a unified stdlib_interpolation interface that leverages the fypp preprocessor to ensure type-safety across all supported real kinds (sp, dp, xdp, qp). The core architecture will utilize an $O(\log n)$ bisection-based interval hunting strategy to efficiently locate target coordinates within discretized datasets, preventing the performance degradation typical of linear scans in large-scale scientific simulations. This module will integrate two primary mathematical backends: a piecewise linear routine for rapid $f(x)$ lookups and a more sophisticated cubic spline implementation that ensures $C^2$ continuity across all knots.
The cubic spline implementation will require the internal integration of a robust tridiagonal matrix solver, specifically the Thomas Algorithm, to compute the second derivatives at each knot point under specified boundary conditions (e.g., natural or clamped). By embedding this numerical logic directly into stdlib, we provide a "Fortran-native" solution that maintains a clear separation of responsibilities while eliminating the overhead of linking against external libraries like LAPACK for common fitting tasks. This feature directly supports the stdlib mission by providing a scalable, preprocessed framework that can eventually be extended to bilinear and bicubic interpolation for multi-dimensional data arrays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaProposition of an idea and opening an issue to discuss it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions