-
Notifications
You must be signed in to change notification settings - Fork 8
WIP: Use StridedDiscreteDomain with SplineBuilder #892
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
Draft
EmilyBourne
wants to merge
5
commits into
main
Choose a base branch
from
devel-issue886
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
120e471
Allow derivative layout to be different to values layout
EmilyBourne 799f757
Add missing strides() method. Allow conversion from DiscreteDomain to…
EmilyBourne 02fb8e2
Fix slice of ChunkSpan on StridedDiscreteDomain. Fixes #891
EmilyBourne f3f1cce
Start adding test
EmilyBourne a29eb51
Merge remote-tracking branch 'origin/main' into devel-issue886
EmilyBourne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a way to properly do this would be to do a cartesian product between a 1D strided domain and a 1D contiguous domain. Once you slice by a DiscreteElement in the strided dimension you would recover the contiguous domain over derivatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could allow strided domains in the spline operator but it feels artificial, the operator still requires all derivatives, so it would work only when the stride is unitary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I couldn't find a way to do this though. I guess it's not possible right now?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. If a cross product of strided and unstrided domains was possible then there would be no need to allow strides domains here.
However I wonder if it is worth considering keeping this in mind for the handling of ND splines. If I had to pass
derivs_strided
here instead ofderivs_strided[front]
andderivs_strided[back]
then it would be much easier to calculate the number of arguments required for the ND case(N!N(N+1)/2 derivatives+ 1 argument for the values)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No indeed, but this is something to work on to be able to release v1 in my opinion.
Do you claim that it is possible to pass all derivatives in one chunkspan ? Still we would need to check at runtime that the dimension of derivatives has unitary stride right ?
If we had this product feature, in 2D we could consider passing a single
ChunkSpan<double, Product<StridedDiscreteDomain<DDimI1>, DiscreteDomain<Deriv<I1>>>> derivs_dim1;
instead of two arrays
derivs_min1
andderivs_max1
. Do you think we can do better than this with only Chunk/ChunkSpan data structures ? This would also allow to check that the user passes derivatives at the correct location ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all derivatives, but all derivatives of the same type. So 3 chunks for 2D:
$\textbraceleft x_{1,0}, x_{1,N} \textbraceright \times [x_{2,0}, x_{2,N}]$ ), $[ x_{1,0}, x_{1,N} ] \times \textbraceleft x_{2,0}, x_{2,N}\textbraceright$ ), $\textbraceleft x_{1,0}, x_{1,N} \textbraceright \times \textbraceleft x_{2,0}, x_{2,N}\textbraceright$ )
derivs1
(domain =derivs2
(domain =cross_derivs
(domain =Yes probably. This could be in an assert I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formula for the number of derivatives required is:
$$\sum_{i=1}^{N} \binom{N}{i}$$
$$\sum_{i=1}^{N} 2^i \binom{N}{i}$$
if we pass all derivatives of the same type in one chunkspan.
If we pass explicitly as we have done up to now the formula is:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can but my point is to say that we need to develop this product feature. We cannot propagate too many unnecessary
StridedDiscreteDomain
, there could be a performance penalty.