-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rgsl-nlinear library to rust-GSL. #159
base: master
Are you sure you want to change the base?
Conversation
rgsl-nlinear/Cargo.toml
Outdated
@@ -0,0 +1,15 @@ | |||
[package] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you create this new crate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if you wanted rust-GSL to be pure Rust or not. It could easily be combined with the Rust-GSL crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want it to remain pure Rust indeed. But then, why do you need this C code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm posting a link to an issue comment that I submitted a few weeks ago:
I had trouble setting the default parameters in Rust using just the GSL-sys library. All the function does is return a struct, but the struct, written in C, returns other substructs, some of which contain references to C functions. I think this is what is causing Bus errors and Segmentation faults when setting the default parameters.
I haven't been able to find a resolution to this, but if I can get past this, it takes me a little closer to fully implementing it in Rust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to fix the issue rather than trying to rewrite some code in C.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. However, I only have about a month of Rust under my belt. I just got the rgsl-nlinear crate to work how I would expect it to work, and I have the feeling that this issue is beyond my current level of expertise, but I have some ideas on a way forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out a workaround to the issue that I was experiencing and have rewritten the crate in Rust. Please let me know if I can resolve this conversation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks much better. But I'm still not sure why it's creating a new crate.
gslsys-mfnlin/src/lib.rs
Outdated
@@ -0,0 +1,361 @@ | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not making this part of the main sys
crate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it into a separate create because you have gsl-* in .gitignore. I went ahead and removed gslsys-mfnlin from the repo.
examples/multifit_nlinear.rs
Outdated
use rgsl::types::rng::RngType; | ||
|
||
|
||
#[no_mangle] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need or no_mangle
in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been removed.
Added rgsl::multifit_nlinear::gsl_multifit_nlinear_basic and rgsl::multifit_nlinear::gsl_multifit_nlinear_basic_df functions to rgsl library.