Skip to content

Commit

Permalink
add root finding
Browse files Browse the repository at this point in the history
  • Loading branch information
tk committed Apr 9, 2021
1 parent 039c845 commit a1bca04
Show file tree
Hide file tree
Showing 6 changed files with 1,010 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## C++ cubic spline interpolation

![cubic C2 spline](https://kluge.in-chemnitz.de/opensource/spline/cubic_c2_spline_git.png)

This is a lightweight implementation of **cubic splines**
to interpolate points f(x<sub>i</sub>) = y<sub>i</sub> with
the following features.
Expand Down Expand Up @@ -27,6 +29,7 @@ be used like this:
tk::spline s(X,Y); // X needs to be strictly increasing
double value=s(1.3); // interpolated value at 1.3
double deriv=s.deriv(1,1.3); // 1st order derivative at 1.3
std::vector<double> solutions = s.solve(0.0); // solves s(x)=0.0
...
```
Expand All @@ -47,7 +50,6 @@ This is identical to (must be called in that order):
s.make_monotonic();
```

![cubic C2 spline](https://kluge.in-chemnitz.de/opensource/spline/cubic_c2_spline_git.png)

### Spline types
Splines are piecewise polynomial functions to interpolate points
Expand Down
4 changes: 3 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CFLAGS += -DHAVE_SSTREAM # whether compiler has <sstream>
LFLAGS=


PROGS=simple_demo plot plot_avg_preserv plot_parametric plot_bspline
PROGS=simple_demo plot plot_avg_preserv plot_parametric plot_bspline cubic_root
PROGS_ALGLIB=plot_alglib bench
PROGS_TESTS=tests/unit_tests tests/compile_units tests/simple_demo_c98

Expand All @@ -34,6 +34,8 @@ plot_parametric: plot_parametric.o
${CC} $< -o $@
plot_bspline: plot_bspline.o
${CC} $< -o $@
cubic_root: cubic_root.o gsl_solve_cubic.o
${CC} $^ -o $@

tests/compile_units: tests/compile_units.o tests/myfunc1.o tests/myfunc2.o
${CC} $? -o $@
Expand Down
Loading

0 comments on commit a1bca04

Please sign in to comment.