# Cubic spline interpolation in Fortran
A module for cubic spline interpolation in Fortran, based on:
* [spline.f](https://www.netlib.org/fmm/spline.f)
* [spline.f90](https://ww2.odu.edu/~agodunov/computing/programs/book2/Ch01/spline.f90),
a Fortran 90 translation of `spline.f`
## Requirements
A somewhat recent Fortran compiler (`gfortran` is the default compiler in the `Makefile`).
## Usage
Usage looks like this:
type(spline_t) :: spl
! Compute coefficients, n is size of input table
call spline_set_coeffs(x_table, y_table, n, spl)
! Evaluate at x_eval using the elemental function spline_evaluate
y = spline_evaluate(x_eval, spl)
## Example
See `test.f90`, which can be compiled with:
make
and executed with for example:
./test 100 1000000
which uses a table with 100 points of a cubic function as input, which is then evaluated at 1000000 points using cubic spline interpolation. Example of output:
Using n_table = 100 and n_eval = 1000000
Error (L1, L2, Linf): 0.91803402E-16 0.19963740E-15 0.17763568E-14
Evaluated points/second: 0.92936803E+08
Note that the error is so small here because a cubic spline can 'exactly' approximate a cubic function. For generic function interpolation, errors will be larger.
fortran-使用fortran实现的三线性插值算法.zip
需积分: 1 175 浏览量
2024-03-09
17:17:01
上传
评论
收藏 5KB ZIP 举报
Ddddddd_158
- 粉丝: 734
- 资源: 206
最新资源
- yolo目标检测项目实验
- downloadFile-1.hc
- Centos7.9环境下离线安装开源版Nginx(亲测版)
- C++课程设计:基于Qt的航班信息管理系统
- ADS7822UVerilog驱动,前面传的有点问题
- 基于python的高性能爬虫程序,使用了多线程+缓存+xpath实现的,这里以彼-岸图库为例,实现,仅用于学习交流
- 中分辨率成像光谱仪(MODIS)烧毁面积产品信息MODIS-C6-BA-User-Guide-1.2.pdf
- Screenshot_20240427_172613_com.huawei.browser.jpg
- 关于学习Python的相关资源网站链接及相关介绍.docx
- (HAL库)基于STM32F103C8T6的温控PID系统[Dht11、ESP8266、无线透传、L298N……]
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈