Skip to content

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

Merged
merged 6 commits into from
Jul 4, 2018

Conversation

Gathros
Copy link
Contributor

@Gathros Gathros commented Jul 1, 2018

No description provided.

@Gathros Gathros added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Jul 1, 2018
@Gathros Gathros changed the title Adding Gausian elimination and Thomas algorithm in C. Adding Gaussian Elimination and Thomas Algorithm in C. Jul 1, 2018
x[i] = (x[i] - a[i] * x[i - 1]) * scale;
}

for (int i = size - 2; i > -1; --i) {
Copy link
Contributor

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.

Copy link
Contributor

@zsparal zsparal Jul 2, 2018

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.

Copy link
Contributor

@zsparal zsparal left a 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

Copy link
Contributor

@zsparal zsparal left a 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

@zsparal zsparal merged commit 507da09 into algorithm-archivists:master Jul 4, 2018
@Gathros Gathros deleted the gauss_thomas_c branch July 4, 2018 11:56
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