# Fortran-fitpack: a modern Fortran library for curve fitting and surface interpolation

**URL:** <https://fortran-lang.discourse.group/t/fortran-fitpack-a-modern-fortran-library-for-curve-fitting-and-surface-interpolation/4588>\
**Category:** Announcements\
**Created:** [October 22, 2022, 7:34am UTC](https://fortran-lang.discourse.group/t/fortran-fitpack-a-modern-fortran-library-for-curve-fitting-and-surface-interpolation/4588 "2022-10-22T07:34:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FedericoPerini](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/federicoperini/32/1750_2.png) [@FedericoPerini](https://fortran-lang.discourse.group/u/FedericoPerini)\
**Post date:** [October 22, 2022, 7:34am UTC](https://fortran-lang.discourse.group/t/fortran-fitpack-a-modern-fortran-library-for-curve-fitting-and-surface-interpolation/4588/1 "2022-10-22T07:34:14Z")

</div>

I’ve mostly refactored the FITPACK library to modern Fortran standards, and added a simple object-oriented interface: I’m happy to share the code here:

> **[GitHub - perazz/fitpack: A Modern Fortran translation of the FITPACK package...](https://github.com/perazz/fitpack)**
>
> A Modern Fortran translation of the FITPACK package for curve and surface fitting - GitHub - perazz/fitpack: A Modern Fortran translation of the FITPACK package for curve and surface fitting

It seems like FITPACK is the library most scientific packages (scipy, Julia) still wrap against for curve fitting purposes. It’s very robust and very flexible, so hopefully even its modern Fortran interface will get better over time. So far:

- Code refactored to free-form
- Real precision generalised
- All variables and subroutines made explicit
- Removed all old-style same-continuation double loop constructs
- Some operations replaced with `matmul`, `dot_product` intrinsics
- A simple object oriented interface is made
- No external dependencies

---

<div class="post-metadata">

**Author:** ![jacobwilliams](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jacobwilliams/32/10_2.png) [@jacobwilliams](https://fortran-lang.discourse.group/u/jacobwilliams)\
**Post date:** [October 22, 2022, 2:18pm UTC](https://fortran-lang.discourse.group/t/fortran-fitpack-a-modern-fortran-library-for-curve-fitting-and-surface-interpolation/4588/2 "2022-10-22T14:18:15Z")

</div>

This is fantastic! Thanks for doing it.

What is the license for your modifications? Can you release it under a BSD type license? (I think the original code is in SciPy so it must have had a similar license).

Would you like some assistance in eliminating the gotos in the code?

---

<div class="post-metadata">

**Author:** ![FedericoPerini](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/federicoperini/32/1750_2.png) [@FedericoPerini](https://fortran-lang.discourse.group/u/FedericoPerini)\
**Post date:** [October 22, 2022, 3:02pm UTC](https://fortran-lang.discourse.group/t/fortran-fitpack-a-modern-fortran-library-for-curve-fitting-and-surface-interpolation/4588/3 "2022-10-22T15:02:16Z")

</div>

I’m no expert in licenses, but it seems like BSD-3 or MIT fit -

Yeah any contributions are welcome! I’ve also been doing some refactoring of the constants which I just pushed a few minutes ago, so let’s try to not overlap our efforts!
