-
-
Notifications
You must be signed in to change notification settings - Fork 360
Adding Gaussian Elimination and Thomas Algorithm in C. #195
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
Conversation
x[i] = (x[i] - a[i] * x[i - 1]) * scale; | ||
} | ||
|
||
for (int i = size - 2; i > -1; --i) { |
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.
My favorite way of writing reversed for loops in C is
for(int i=size-2; i-->0; ) {
Becuase it looks like it reads "i goes to zero". It is functional identical to your implementation though.
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 strongly disagree. The whole "goes to" thing is cute, but it's just obfuscating the fact that it's two separate operators. I like the concept but I'd much rather see something like:
for (int i = size - 2; i >= 0; --i) {
}
Since we're not dealing with unsigned numbers this'll just work and it's a lot more clear.
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.
Please address #201 first, otherwise it looks good
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.
Sorry for the misunderstanding, looks good
No description provided.