22 <a href =" https://github.com/espdev/csaps-rs " ><img src =" https://user-images.githubusercontent.com/1299189/76691347-0a5ac780-665b-11ea-99fa-bf4a0aea04dc.png " alt =" csaps " width =" 400 " /></a ><br >
33</p >
44
5- [ ![ Build Status ] ( https://travis-ci.org/espdev/csaps-rs.svg?branch=master )] ( https://travis-ci.org/espdev/csaps-rs )
6- [ ![ Coverage Status ] ( https://coveralls.io/repos/github/ espdev/csaps-rs/badge.svg?branch=master )] ( https://coveralls.io/github/ espdev/csaps-rs?branch=master )
7-
8- : warning : : construction : ** experimental ** , ** work-in-progress ** : construction : : warning :
5+ < p align = " center " >
6+ < a href = " https://travis-ci.org/ espdev/csaps-rs " >< img src = " https://travis-ci.org/ espdev/csaps-rs.svg ?branch=master " alt = " Build status " /></ a >
7+ < a href = " https://coveralls.io/github/espdev/csaps-rs?branch=master " >< img src = " https://coveralls.io/repos/github/espdev/csaps-rs/badge.svg?branch=master " alt = " Coverage status " /></ a >
8+ </ p >
99
10+ <h4 align =" center " >
1011Cubic spline approximation (smoothing) algorithm written in Rust.
12+ </h4 >
13+
14+ ** csaps** is a crate for univariate, multivariate and n-dimensional grid data approximation using cubic smoothing splines.
15+ The package can be useful in practical engineering tasks for data approximation and smoothing.
1116
1217## Usage
1318
19+ Multivariate data smoothing
20+
1421``` rust
1522use ndarray :: {array, Array1 };
1623use csaps :: CubicSmoothingSpline ;
@@ -36,10 +43,52 @@ fn main() {
3643}
3744```
3845
46+ 2-d grid (surface) data smoothing
47+
48+ ``` rust
49+ use ndarray :: array;
50+ use csaps :: GridCubicSmoothingSpline ;
51+
52+
53+ fn main () {
54+ let x0 = array! [1.0 , 2.0 , 3.0 , 4.0 ];
55+ let x1 = array! [1.0 , 2.0 , 3.0 , 4.0 ];
56+ let x = vec! [x0 . view (), x1 . view ()];
57+
58+ let xi0 = array! [1.0 , 1.5 , 2.0 , 2.5 , 3.0 , 3.5 , 4.0 ];
59+ let xi1 = array! [1.0 , 1.5 , 2.0 , 2.5 , 3.0 , 3.5 , 4.0 ];
60+ let xi = vec! [xi0 . view (), xi1 . view ()];
61+
62+ let y = array! [
63+ [0.5 , 1.2 , 3.4 , 2.5 ],
64+ [1.5 , 2.2 , 4.4 , 3.5 ],
65+ [2.5 , 3.2 , 5.4 , 4.5 ],
66+ [3.5 , 4.2 , 6.4 , 5.5 ],
67+ ];
68+
69+ let yi = GridCubicSmoothingSpline :: new (& x , & y )
70+ . make (). unwrap ()
71+ . evaluate (& x ). unwrap ();
72+
73+ println! (" xi: {:?}" , xi );
74+ println! (" yi: {}" , yi );
75+ }
76+ ```
77+
78+ ## Algorithms and implementations
79+
80+ The crate implementation is based on [ ndaray] ( https://github.com/rust-ndarray/ndarray ) and
81+ [ sprs] ( https://github.com/vbarrielle/sprs ) crates and has been inspired by Fortran routine SMOOTH from [ PGS] ( http://pages.cs.wisc.edu/~deboor/pgs/ )
82+ (originally written by Carl de Boor).
83+
84+ The implementation of the algotithm in other languages:
85+
86+ - [ csaps in Python] ( https://github.com/espdev/csaps ) Python NumPy/SciPy based implementation
87+ - [ csaps in C++] ( https://github.com/espdev/csaps-cpp ) C++11 Eigen based implementation
88+
3989## References
4090
41- - [ csaps in Python] ( https://github.com/espdev/csaps )
42- - [ csaps in C++] ( https://github.com/espdev/csaps-cpp )
91+ - C. de Boor, A Practical Guide to Splines, Springer-Verlag, 1978.
4392
4493## License
4594
0 commit comments