{"id":19305097,"url":"https://github.com/erikerlandson/snowball","last_synced_at":"2025-04-22T12:34:17.501Z","repository":{"id":48629440,"uuid":"128278046","full_name":"erikerlandson/snowball","owner":"erikerlandson","description":"Monotonic smoothing splines for the JVM","archived":false,"fork":false,"pushed_at":"2021-07-16T23:31:24.000Z","size":1214,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-01T17:32:48.034Z","etag":null,"topics":["java","monotone","monotone-splines","monotonic","monotonic-splines","scala","spline","spline-interpolation"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erikerlandson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-06T00:06:34.000Z","updated_at":"2023-10-06T12:55:06.000Z","dependencies_parsed_at":"2022-09-05T15:40:52.589Z","dependency_job_id":null,"html_url":"https://github.com/erikerlandson/snowball","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fsnowball","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fsnowball/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fsnowball/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fsnowball/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikerlandson","download_url":"https://codeload.github.com/erikerlandson/snowball/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223896566,"owners_count":17221448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","monotone","monotone-splines","monotonic","monotonic-splines","scala","spline","spline-interpolation"],"created_at":"2024-11-09T23:33:36.100Z","updated_at":"2024-11-09T23:33:36.560Z","avatar_url":"https://github.com/erikerlandson.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# snowball\nMonotonic smoothing splines for the JVM ecosystem and Apache Commons Math.\n\n### Documentation\n\nAPI javadoc is available at:\n[https://erikerlandson.github.io/snowball/java/api/](https://erikerlandson.github.io/snowball/java/api/)\n\nA few examples are below.\n\n### Features\n\n* Fit monotonic interpolating splines to data, including data that has noise or is otherwise non-monotonic.\n* Enforce equality constraints of the form s(x) = y, where s is the spline function\n* Enforce gradient constraints of the form ds(x)/dx = g\n* Enforce inequality constraints of the form s(x) \u003c y and s(x) \u003e y\n\n### How to use `snowball` in your project\nThe `snowball` package is implemented in java, and so it can be used in both java and scala. It is built on, and designed to work with, Apache Commons Math 3.6.\n\n#### using SBT\n```scala\nlibraryDependencies ++= Seq(\n  \"com.manyangled\" % \"snowball\" % \"0.3.0\"\n  )\n```\n\n#### using maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.manyangled\u003c/groupId\u003e\n  \u003cartifactId\u003esnowball\u003c/artifactId\u003e\n  \u003cversion\u003e0.3.0\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.manyangled\u003c/groupId\u003e\n  \u003cartifactId\u003egibbous\u003c/artifactId\u003e\n  \u003cversion\u003e0.3.0\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n### Examples\n\n#### Java\n```java\nimport org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;\nimport com.manyangled.snowball.analysis.interpolation.MonotonicSplineInterpolator;\n\ndouble[] x = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };\ndouble[] y = { 0.0, 0.05, 0.02, 0.3, 0.5, 0.7, 0.99, 0.95, 1.0 };\nMonotonicSplineInterpolator interpolator = new MonotonicSplineInterpolator();\nPolynomialSplineFunction s = interpolator.interpolate(x, y);\n```\n\n#### Scala REPL\n```sh\n$ sbt test:console\n```\n\n```scala\nscala\u003e import com.manyangled.snowball.analysis.interpolation._, com.manyangled.gnuplot4s._\nimport com.manyangled.snowball.analysis.interpolation._\nimport com.manyangled.gnuplot4s._\n\nscala\u003e val interpolator = new MonotonicSplineInterpolator()\ninterpolator: com.manyangled.snowball.analysis.interpolation.MonotonicSplineInterpolator = com.manyangled.snowball.analysis.interpolation.MonotonicSplineInterpolator@6834fd1b\n\nscala\u003e val xdata = Array(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0)\nxdata: Array[Double] = Array(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0)\n\nscala\u003e val ydata = Array(0.0, 0.2, 0.05, 0.3, 0.5, 0.7, 0.95, 0.8, 1.0)\nydata: Array[Double] = Array(0.0, 0.2, 0.05, 0.3, 0.5, 0.7, 0.95, 0.8, 1.0)\n\nscala\u003e val s = interpolator.interpolate(xdata, ydata)\ns: org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction = org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction@5852d898\n\nscala\u003e Session().block(\"data\", xdata.zip(ydata)).block(\"spline\", (1.0 to 9.0 by 0.1).map { x =\u003e (x, s.value(x)) }).plot(Plot().block(\"data\").using(1,2).style(PlotStyle.Points)).plot(Plot().block(\"spline\").using(1,2).style(PlotStyle.Lines)).term(Dumb().size(80,40)).render\n\nscala\u003e \n                                                                                       \n                                                                                \n    1 +-+------+--------+-------+--------+--------+--------+-------+------+-A   \n      +        +        +       +        +        +        +       +     ####   \n      |                                             $data uAing 1:2   #A#   |   \n      |                                           $spline using 1:######### |   \n      |                                                        ###          |   \n      |                                                     ###             |   \n      |                                                   ##                |   \n  0.8 +-+                                                ##        A      +-+   \n      |                                               ###                   |   \n      |                                             ##                      |   \n      |                                           A#                        |   \n      |                                           #                         |   \n      |                                         ##                          |   \n      |                                       ##                            |   \n  0.6 +-+                                    #                            +-+   \n      |                                     #                               |   \n      |                                    #                                |   \n      |                                  A#                                 |   \n      |                                 ##                                  |   \n      |                                #                                    |   \n      |                               #                                     |   \n  0.4 +-+                            #                                    +-+   \n      |                            ##                                       |   \n      |                          ##                                         |   \n      |                         A                                           |   \n      |                        #                                            |   \n      |                      ##                                             |   \n      |                   ###                                               |   \n  0.2 +-+      A        ##                                                +-+   \n      |                ##                                                   |   \n      |             ###                                                     |   \n      |          ###                                                        |   \n      |      ####                                                           |   \n      |   ###           A                                                   |   \n      ####     +        +       +        +        +        +       +        +   \n    0 A-+------+--------+-------+--------+--------+--------+-------+------+-+   \n      1        2        3       4        5        6        7       8        9   \n                                                                                \n```\n\n### References:\n1. H. Fujioka and H. Kano: [Monotone smoothing spline curves using normalized uniform cubic B-splines](/monotone-cubic-B-splines-2013.pdf), Trans. Institute of Systems, Control and Information Engineers, Vol. 26, No. 11, pp. 389–397, 2013\n\n1. Hiroyuki KANO, Hiroyuki FUJIOKA, and Clyde F. MARTIN, [Optimal Smoothing Spline with Constraints on Its Derivatives](https://www.jstage.jst.go.jp/article/jcmsi/7/2/7_104/_pdf), SICE Journal of Control, Measurement, and System Integration, Vol.7, No. 2, pp. 104–111, March 2014\n\n1. M. Nagahara, Y. Yamamoto, C. Martin, [Quadratic Programming for Monotone Control Theoretic Splines](https://www.researchgate.net/profile/Clyde_Martin/publication/224182849_Quadratic_programming_for_monotone_control_theoretic_splines/links/00b7d52da8b1e52d6c000000/Quadratic-programming-for-monotone-control-theoretic-splines.pdf), SICE, 2010.\n\n1. M. Egerstedt and C. Martin. [Monotone Smoothing Splines](http://magnus.ece.gatech.edu/Papers/MonoSplines.pdf). Mathematical Theory of Networks and Systems. Perpignan, France, June 2000.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikerlandson%2Fsnowball","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikerlandson%2Fsnowball","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikerlandson%2Fsnowball/lists"}