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

In matrix_exp_pade, rename return variable pade_approximation, and de… #457

Merged
merged 1 commit into from
Nov 30, 2016

Conversation

charlesm93
Copy link
Contributor

@charlesm93 charlesm93 commented Nov 28, 2016

Submisison Checklist

  • Run unit tests: ./runTests.py test/unit (Ran 9 tests for matrix exponential).
  • Run cpplint: make cpplint
  • Declare copyright holder and open-source license: see below

Summary:

In stan/math/prim/mat/fun/matrix_exp_pade.hpp, rename return variable pade_approximation, and declare variable right before it gets used, as oppose to at the top of the function.

See issue #456

Intended Effect:

  • Code readability
  • Memory isn't allocated for a variable that only get's used later
  • Aesthetics

How to Verify:

The first two intended effects are trivial. Code doesn't break.
The question of aesthetics is considerably more complicated and profound. What is beauty, and more importantly what is it in the framework of Stan, where only computer scientists seem to grasp it?

Side Effects:

None.

Documentation:

None.

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Metrum Research Group LLC

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

…clare variable before it is being used, as oppose to at the top of the function.
@syclik syclik added this to the v2.13.0++ milestone Nov 30, 2016
Copy link
Member

@syclik syclik left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@syclik
Copy link
Member

syclik commented Nov 30, 2016

The question of aesthetics is considerably more complicated and profound. What is beauty, and more importantly what is it in the framework of Stan, where only computer scientists seem to grasp it?

For aesthetics, we've gone with Google's style guide with a few modifications:

I can't directly answer your deeper question, but I think the concept you're missing is that code is read more often than written. Thought and care needs to be put into constructing it so it can be revisited in the future. Imagine yourself having to read and understand your code in the future: not only what it does (code never lies), but the intent. It's not necessarily about beauty, but about function. It's a lot easier to practice by reviewing code that's not written by you. If you have time, review the open pull requests.

@charlesm93
Copy link
Contributor Author

I didn't mean to undermine the importance of abiding to coding standards. I've actually spent a lot of hours last week cleaning up Torsten to make it more readable for future coders and easier to edit. I'll definately look through the links you posted and some open pull-requests.

@syclik
Copy link
Member

syclik commented Nov 30, 2016

:). It wasn't interpreted that way.

I was just trying to get to someplace where I could help answer your question. It's tough writing things for public consumption. You have to be in a different mindset.

@syclik syclik merged commit ebd7665 into develop Nov 30, 2016
@syclik syclik deleted the cleanup/issue-456-matrix_exp_pade branch November 30, 2016 17:18
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.

None yet

2 participants