GithubHelp home page GithubHelp logo

bgrimstad / splinter Goto Github PK

View Code? Open in Web Editor NEW
407.0 27.0 115.0 5.43 MB

Library for multivariate function approximation with splines (B-spline, P-spline, and more) with interfaces to C++, C, Python and MATLAB

License: Mozilla Public License 2.0

CMake 3.10% C++ 73.24% C 3.52% MATLAB 6.46% Python 9.91% Shell 3.77%
b-splines splines function-approximation interpolation p-spline python c-plus-plus smoothing

splinter's People

Contributors

bgrimstad avatar gablank avatar hxdnshx avatar jkhoogland avatar novacrazy avatar sdrdis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

splinter's Issues

Test use of sparse solvers

All current BSpline tests have to few sample points to trigger the use of a sparse linear solver. Thus, this use case is not being tested. I suggest that we increase the number of sample points in a few of the tests so that it triggers this use case.

Update to latest Eigen version

SPLINTER's Eigen should be updated to the latest stable version (currently Eigen 3.2.7). SPLINTER must compile on all supported platform for the change to be accepted.

Note: It seems like Eigen 3.3 is on the way and it may make sense to wait for the release of this version.

Make interface use standard C++11 types

Currently SPLINTER uses Eigen types (typedefs DenseVector and DenseMatrix) all over the interface. This requires the user to investigate what those types actually are, and also requires the user to have Eigen installed to use the library. Replacing these with std::vector and std::vector < std::vector < double > > will resolve these issues.

Remove builder header file

/include/cinterface/builder.h should be merged into cinterface.h since the old Builder base class has been removed.

Add test case for testing hessian accuracy of BSpline

Add test case testing the accuracy of the hessian of Approximants. Should use same methodology as the test cases testing the jacobians of Approximants currently do, but with second order central difference instead of first order.

Shuffling and subdivision

Add random shuffling and subdivision to Sample using operator overloading. This will be useful when doing cross validation.

Doxygen

Write Doxygen, prioritize classes and methods that are visible to the end user.

compiler error in psplineapproximant.cpp when building with asserts enabled

I am seeing a compiler error when building SPLINTER in a debug configuration. The problem seems to be caused by the assert() on line 154 of psplineapproximant.cpp

for (unsigned int i=0; i < numVariables; i++)
{
    // Need at least three coefficients in each variable
    assert(basis.getNumBasisFunctions(i) >= 3);
}

The compiler reports that it cannot find the symbol basis

splinter/src/psplineapproximant.cpp:154:16: error: use of undeclared identifier 'basis'
        assert(basis.getNumBasisFunctions(i) >= 3);

and indeed I cannot see that PSplineApproximant or any of the classes it inherits from have such a member.

This seems to happen in both the master and development branches. Building with asserts disabled fixes the problem.

Python examples

Add some examples and documentation for the Python interface.

Automatic knot vector selection

The current moving average filter for automatic knot vector selection does not work well when the number of knots is much less than the number of samples. The resulting knot vector will in this case be very skewed; it will have almost all knots close to the left-most samples.

Question about closest point

Hey Guys,

Love this library, and I'm still feeling my way around it. But what do you think would be the best way to find the closest point on the spline from an arbitrary point? Are there some specific functions that would help?

If this is something that I could implement, I would gladly PR it back in if y'all find it useful.

compiler warnings

when compiled with -Wall -Wextra -pedantic:
lots of warning of type "comparison between signed and unsigned integer expressions [-Wsign-compare]"
due to variable Basis1D::degree being declared as int. I guess that degree cannot be less than 0, and therefore can be declared as unsigned int.
Same thing goes for num_knots in Basis1D::knotSequenceFree and elsewhere.

In BSpline::computeControlPoints the line bspline.cpp:378, i.e.
bool successfulSolve = (s.solve(Ad,Bx,Cx) && s.solve(Ad,By,Cy));
triggers warning: unused variable ‘successfulSolve’ [-Wunused-variable]
Since the variable is used in assert fun below, one could write
assert(s.solve(Ad,Bx,Cx) && s.solve(Ad,By,Cy));
and many more similar warnings dealing with [-Wsign-compare] and [-Wunused-variable].

Add flexibility parameter to B-spline approximant

Add a flexibility parameter to the BSplineApproximant constructor. The parameter should be a number p so that 0<=p<=1, where p=1 means building a B-spline approximant with enough segments to interpolate all samples and p=0 means building a B-spline approximant with a minimum number of segments. In all cases, the resulting B-spline approximation should minimize the mean squared approximation error.

Test polynomial regression

Test PolynomialRegression on several problems of varying dimension using different polynomial degrees.

Tikhonov matrix

Implement Tikhonov regularization for general Tikhonov matrices. The current implementation uses an identity matrix. Note that the builder classes must be updated to allow the specification of a Tikhonov matrix.

MATLAB examples

Put MATLAB examples in a new folder: matlab/examples. Note: the build script may need an update after this change.

Expand BSpline interface

The following functions in BSpline should be made available in all interfaces:
std::vector< std::vector> getKnotVectors() const;
DenseMatrix getControlPoints() const;
DenseVector getCoefficients() const;

Flexible usage of DataTable class

Hi! Imagine I have multi-dimensional DataTable and I want to find it's maximal Y element in some X - slice (defined by, e.g. x(0), x(5) fixed). Is there a smart way to do this without scanning over all the Data?
Thanks,
Sergey

New class for B-spline interpolation

Simplify the B-spline classes by putting functionality for interpolation (computation of control points and selection of knot vectors) into a new class.

Description of Issues

Describe in the README how the issues are structured according to type of work and difficulty.

Implement NURBS

Create a new class for non-uniform rational basis splines (NURBS) that utilizes the existing B-spline implementation.

Python interface

Add Python interface for Python versions 2 and 3. Investigate if a single C interface may be used by both Python and MatLab.

Automatically run all tests after building release

After building all desired combinations of architectures and compilers we should run all tests. Return value of last command is stored in $? in bash. Catch seems to return 0 when all tests pass, 1 otherwise. Check if this assumption is true before implementing.

B-spline hessian

The Hessian of B-splines (BSpline) of all degrees seems to be wrong. It is not symmetrical over the diagonal. Test function: 4.5(x^4)-(x^3)+3(x^2)*y

Add more unit tests

Add more unit tests using the Catch testing framework. Unit tests should reside in the folder "test/unit/filename", where "filename" is the file containing the units being tested.

Add SPLINTER to PyPI

When the Python interface is done and working well (which is the case very soon), we should add SPLINTER to PyPI, the Python Package Index, so users can easily install and use it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.