Skip to content
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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

lmandres
Copy link

Added rgsl::multifit_nlinear::gsl_multifit_nlinear_basic and rgsl::multifit_nlinear::gsl_multifit_nlinear_basic_df functions to rgsl library.

@@ -0,0 +1,15 @@
[package]
Copy link
Owner

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?

Copy link
Author

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.

Copy link
Owner

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?

Copy link
Author

@lmandres lmandres Oct 28, 2024

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:

#68 (comment)

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.

Copy link
Owner

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.

Copy link
Author

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.

Copy link
Author

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.

Copy link
Owner

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.

@@ -0,0 +1,361 @@
//
Copy link
Owner

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?

Copy link
Author

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.

use rgsl::types::rng::RngType;


#[no_mangle]
Copy link
Owner

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants