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

Outsource common NSTEPS code to function #858

Merged
merged 3 commits into from
Sep 21, 2024
Merged

Outsource common NSTEPS code to function #858

merged 3 commits into from
Sep 21, 2024

Conversation

schillic
Copy link
Member

No description provided.

@schillic schillic marked this pull request as ready for review July 28, 2024 11:59
@mforets
Copy link
Member

mforets commented Aug 27, 2024

i think this was the purpose of #734

@@ -288,6 +288,17 @@ function _get_T(tspan::TimeInterval; check_zero::Bool=true, check_positive::Bool
return T
end

function _get_nsteps(kwargs, δ, tspan)
Copy link
Member

Choose a reason for hiding this comment

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

we could do it similar to #860 (review) in the sense that on each algorithm we write

NSTEPS = get(kwargs, :NSTEPS, _get_nsteps(δ, tspan))

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, feel free to make the change and merge.

Copy link
Member

Choose a reason for hiding this comment

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

done

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, the new proposal is not equivalent: You always execute compute_nsteps (it is not done lazily), even if the user specified :NSTEPS. There are ways to store the function lazily and evaluate it only on demand, but maybe this is overkill and we just just use the previous version.

Copy link
Member

Choose a reason for hiding this comment

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

hmm i dont follow this argument-- even if the function compute_nsteps is always executed because function arguments are executed, it is not mutating, so if NSTEPS was specified by the user, the result of compute_nsteps is discarded.

Copy link
Member

Choose a reason for hiding this comment

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

ok, fair enough. it shoudn't fail :)

Copy link
Member Author

Choose a reason for hiding this comment

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

So what do we do? Do you want to fix the test?

Copy link
Member

Choose a reason for hiding this comment

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

i've proposed a change, but haven't tested it locally.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, let's see if that helps. I proposed a change because it should not return a float.

Copy link
Member Author

Choose a reason for hiding this comment

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

It did not seem to help 😞

@schillic
Copy link
Member Author

i think this was the purpose of #734

Does that mean there should be a separate module?

@mforets
Copy link
Member

mforets commented Aug 27, 2024

i focused too much on the "Refactor init constants" and forgot the "to their own module" part :)

unfortunately that issue doesn't have any associated description. we may as well just close it.

src/Continuous/solve.jl Outdated Show resolved Hide resolved
@mforets mforets merged commit 75a34c6 into master Sep 21, 2024
6 checks passed
@mforets mforets deleted the schillic/NSTEPS branch September 21, 2024 08:58
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.

2 participants