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

cleanup and using std::vector #70

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

cleanup and using std::vector #70

wants to merge 4 commits into from

Conversation

ngc92
Copy link

@ngc92 ngc92 commented Oct 30, 2020

The first commit performs some cleanup, in that it reduces the scope of some local variables for the newton step.
The second commit replaces manually allocated/deallocated buffers with std::vector for automatic memory management. This does not change any interfaces, as we can simply pass vector.data() as the pointer to the allocated buffer. It has the advantage that functions can return early safely, without having to worry about memory leaks.

I have also removed the short-lived allocation of the w_0 vector, because we have multiple double arrays of appropriate size that are unused at the moment. If you allow C++11 this could be written somewhat cleaner using a std::move, for now I have added an explanatory comment.

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.

1 participant