diff --git a/src/problems/basic_problems.jl b/src/problems/basic_problems.jl index f794b0e16..b2caeabe9 100644 --- a/src/problems/basic_problems.jl +++ b/src/problems/basic_problems.jl @@ -434,6 +434,7 @@ struct DataIntegralProblem{Y, X, D, K} <: AbstractIntegralProblem{false} @add_kwonly function DataIntegralProblem(y::AbstractArray, x::AbstractVector; dim = 1, kwargs...) + @assert dim <= ndims(y) "The integration dimension `dim` is larger than the number of dimensions of the integrand `y`" @assert length(x)==size(y, dim) "The integrand `y` must have the same length as the sampling points `x` along the integrated dimension." @assert axes(x, 1)==axes(y, dim) "The integrand `y` must obey the same indexing as the sampling points `x` along the integrated dimension." new{typeof(y), typeof(x), Val{dim}, typeof(kwargs)}(y, x, Val(dim), kwargs)