Giter Site home page Giter Site logo

ncar / bspline Goto Github PK

View Code? Open in Web Editor NEW
91.0 25.0 21.0 2.52 MB

Cubic B-Spline implementation in C++ templates

License: Other

C++ 15.90% Python 0.51% Fortran 82.80% Makefile 0.02% R 0.21% Raku 0.02% C 0.16% MATLAB 0.38%
cubic-splines atmospheric-science c-plus-plus interpolation library splines

bspline's Issues

Copying/moving splines is dangerous

BSpline and BSplineBase have destructors defined, but do not have all copy/move/assignment operators defined.
Putting splines into a container that may choose to copy them therefore is dangerous, as copying a BSpline will leave the copy with a deleted spline if the original spline object goes out of scope.

Refer to this:
https://en.cppreference.com/w/cpp/language/rule_of_three

I suggest replacing the use of raw pointers for BSplineBase::base and BSpline::s with std::unique_ptr, and then defining copy and move constructors and assignment operators. Any operator not explicitly defined would then be implicitly deleted as a result of holding a std::unique_ptr, so a compile time error would be generated for unsupported copy/move/assignment operations instead of a runtime segfault/access violation.

g++ compile error

Hi There,
I try to test the bspline algorithm from this project.
I tested with visual studio 2013, it works.
Now I try to compline it with g++ (g++ (GCC) 6.1.1 20160501) in linux OS. It did compile.
Please help. Appreciate it very much.
Sam

Hereby the error msg from the compiler.
**>
**> g++ -c -Wall -march=armv7-a -O2 -DNDEBUG -MMD -I Src -I Src/bspline Src/bspline/BSplineLib.cpp -o obj/Src/bspline/BSplineLib.o

mkdir -p obj/Src/bspline/
g++ -c -Wall -march=armv7-a -O2 -DNDEBUG -MMD -I Src -I Src/bspline Src/bspline/BSpline.cpp -o obj/Src/bspline/BSpline.o
Src/bspline/BSpline.cpp: In member function 'bool BSpline::solve(const T*)':
Src/bspline/BSpline.cpp:110:18: error: 'my' has not been declared
for (m = my::max(0, mx-1); m <= my::min(mx+2, M); ++m) {
^~
Src/bspline/BSpline.cpp:110:41: error: 'my' has not been declared
for (m = my::max(0, mx-1); m <= my::min(mx+2, M); ++m) {
^~****

Cutoff wavelength not working


float* x = new float[8] {   0.f, 5.f, 10.f, 15.f, 20.f, 25.f, 30.f, 35.f};
float* y = new float[8]{    2.f, 4.f, 6.f,  8.f,  0.f,  6.f,  9.f,  4.f};
BSpline<float> bSpline(x, 8, y, 30.0);
bool ok = bSpline.ok();
float rez = bSpline.evaluate(2.f);

ok is false whenever I put anything other then 0 for wl and whenever ok is false, rez is 0.

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.