Skip to content

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