Closed Iddingsite closed 8 months ago
Test failure seems unrelated to the PR.
Looks good to me - thanks! you would have to update the readme as well in that case. And it would be good to sort out why the test failed
Errors in testing in Ubuntu randomly occur on all versions due to Segfault errors. I guess it is related to #17? Otherwise, seems good to merge to me!
a looked a bit more carefully at this and you are right that the segmentation faults occur randomly. It is curious, though, that they all seem to appear in the test with @view
that is being added with this PR.
mmh ok that's strange. I guess there is a weird interaction with the view and MAGEMin with multithread on Ubuntu. I guess I could delete the test. The implementation in itself is just multiple dispatch, so it doesn't change anything if the user uses classical arrays.
having the test in itself is good. Nico just released a new version of MAGEMin, which also solves several memory leaks. It may resolve these issues.
This PR is already in the new version of Nico so I will close this one. We will see if the tests pass or not. Sorry for the noise
Hi,
When working on my projects, I often create arrays containing vectors of composition. In this case, I like to use
@view
array to prevent allocations when I am calling a single point minimisation. Currently, this is not supported bysingle_point_minimization
because it only accepts Vector{Float64}.This PR adds support for AbstractVector{Float64} to be able to use view arrays but also other type of arrays (I didn't go too wild on the multiple dispatch because I don't know how the C code works behind the hood).
So now, this kind of code is working:
The only drawback is that it is a breaking PR because I had to change the argument X to be from a keyword argument to a position argument to use multiple dispatch.
So the function
single_point_minimization
is now called:Compared to
before. EDIT Same for
multi_point_minimization
.I've also added a test for testing view.
Tell me what you think about it.