Skip to content

Add rust implementation of forward euler #182

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

Merged
merged 4 commits into from
Jul 3, 2018

Conversation

hsjoihs
Copy link
Contributor

@hsjoihs hsjoihs commented Jun 30, 2018

Naive translation of the C implementation. Correct me if there's anything wrong, since it's my first time contributing to this project.

}


fn solve_euler(timestep: f64, result: &mut [f64], n: usize) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to pass n, Rust slices already know their size. Also, I would pass a &[f64] and return an Option<Vec<f64>> which would be much more idiomatic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! Thanks

@Gathros Gathros added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Jun 30, 2018
@@ -0,0 +1,34 @@
fn main() {
let mut result = [0.0;100];
Copy link
Contributor

Choose a reason for hiding this comment

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

You should consider formatting your code with rustfmt so it conforms to the standard styleguide.

@zsparal zsparal merged commit 2a8bf4d into algorithm-archivists:master Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants