Skip to content

Conversation

EmilyBourne
Copy link
Collaborator

No description provided.

@EmilyBourne EmilyBourne mentioned this pull request Jul 22, 2025
Comment on lines +279 to +280
std::optional(derivs_strided[interpolation_domain.front()].span_cview()),
std::optional(derivs_strided[interpolation_domain.back()].span_cview()));
Copy link
Member

@tpadioleau tpadioleau Jul 23, 2025

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.

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 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.

Copy link
Collaborator Author

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

I agree. I couldn't find a way to do this though. I guess it's not possible right now?

Copy link
Collaborator Author

@EmilyBourne EmilyBourne Jul 23, 2025

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.

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 of derivs_strided[front] and derivs_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)

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's not possible right now?

No indeed, but this is something to work on to be able to release v1 in my opinion.

it would be much easier to calculate the number of arguments required for the ND case (N! derivatives+ 1 argument for the values)

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 and derivs_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 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you claim that it is possible to pass all derivatives in one chunkspan ?

Not all derivatives, but all derivatives of the same type. So 3 chunks for 2D:
derivs1 (domain = $\textbraceleft x_{1,0}, x_{1,N} \textbraceright \times [x_{2,0}, x_{2,N}]$), derivs2 (domain = $[ x_{1,0}, x_{1,N} ] \times \textbraceleft x_{2,0}, x_{2,N}\textbraceright$), cross_derivs (domain = $\textbraceleft x_{1,0}, x_{1,N} \textbraceright \times \textbraceleft x_{2,0}, x_{2,N}\textbraceright$)

Still we would need to check at runtime that the dimension of derivatives has unitary stride right ?

Yes probably. This could be in an assert I guess?

Copy link
Collaborator Author

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}$$
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:
$$\sum_{i=1}^{N} 2^i \binom{N}{i}$$

N N derivs with strided N derivs without strided
1 1 2
2 3 8
3 7 26
4 15 80
5 31 242

Copy link
Member

Choose a reason for hiding this comment

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

Still we would need to check at runtime that the dimension of derivatives has unitary stride right ?

Yes probably. This could be in an assert I guess?

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.

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