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

Check lengths of RegularInTime arguments? #119

Open
simsurace opened this issue Oct 4, 2023 · 3 comments
Open

Check lengths of RegularInTime arguments? #119

simsurace opened this issue Oct 4, 2023 · 3 comments

Comments

@simsurace
Copy link
Member

I wonder whether the RegularInTime constructor should error if the lengths of its arguments don't match:

struct RegularInTime{
Tt, Tv, Tts<:AbstractVector{Tt}, Tvs<:AbstractVector{<:AbstractVector{Tv}},
} <: AbstractVector{Tuple{Tt, Tv}}
ts::Tts
vs::Tvs
end

@willtebbutt
Copy link
Member

Good catch -- that would be ideal.

This kind of check should be shoved inside another function that is marked @non_differentiable so that it doesn't hit AD performance.

@simsurace
Copy link
Member Author

Interesting... is the constructor function ever AD'd through? I would have thought that once the object has been constructed, the AD wouldn't be able to see the function that was called during constuction.

@willtebbutt
Copy link
Member

willtebbutt commented Oct 4, 2023

That's true if you construct before passing the RegularInTime to the function being differentiated. I was thinking about what happens if you construct the RegularInTime inside the function that you're differentiating though.

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

No branches or pull requests

2 participants