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

Either: PartialDerivative{k}(<:Basis) or Inclusion(::Basis) should err (or both) #88

Open
MikaelSlevinsky opened this issue Jun 4, 2021 · 5 comments

Comments

@MikaelSlevinsky
Copy link
Member

MikaelSlevinsky commented Jun 4, 2021

julia> P = JacobiTriangle()
JacobiTriangle(0, 0, 0)

julia> Q = JacobiTriangle(2, 2, 2)
JacobiTriangle(2, 2, 2)

julia> ∂x = PartialDerivative{1}(P)
PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}

julia> Q \ (∂x^2 * P)
ERROR: DimensionMismatch("Second axis of A, Inclusion(JacobiTriangle(0, 0, 0)), and first axis of B, Inclusion(DomainSets.FixedUnitSimplex{SVector{2, Float64}, :closed}()) must match")
Stacktrace:
 [1] _check_mul_axes(A::PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, B::ApplyQuasiMatrix{Float64, typeof(*), Tuple{JacobiTriangle{Float64, Int64}, BandedBlockBandedMatrix{Float64, Adjoint{Float64, LazyBandedMatrices.BlockBroadcastArray{Float64, 2, typeof(hcat), Tuple{LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{LazyArrays.BroadcastVector{Int64, typeof(*), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Type{Fill}, Tuple{InfiniteArrays.OneToInf{Int64}, InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{StepRange{Int64, Int64}, typeof(*), Tuple{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{LazyArrays.BroadcastVector{Int64, typeof(*), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Type{Fill}, Tuple{InfiniteArrays.OneToInf{Int64}, InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}}}, Int64}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{StepRange{Int64, Int64}, typeof(*), Tuple{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}}}}, BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}})
   @ ArrayLayouts ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:87
 [2] check_mul_axes(::PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, ::ApplyQuasiMatrix{Float64, typeof(*), Tuple{JacobiTriangle{Float64, Int64}, BandedBlockBandedMatrix{Float64, Adjoint{Float64, LazyBandedMatrices.BlockBroadcastArray{Float64, 2, typeof(hcat), Tuple{LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{LazyArrays.BroadcastVector{Int64, typeof(*), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Type{Fill}, Tuple{InfiniteArrays.OneToInf{Int64}, InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{StepRange{Int64, Int64}, typeof(*), Tuple{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{LazyArrays.BroadcastVector{Int64, typeof(*), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Type{Fill}, Tuple{InfiniteArrays.OneToInf{Int64}, InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}}}, Int64}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{StepRange{Int64, Int64}, typeof(*), Tuple{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}}}}, BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}})
   @ ArrayLayouts ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:89
 [3] instantiate
   @ ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:101 [inlined]
 [4] materialize
   @ ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:105 [inlined]
 [5] mul
   @ ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:106 [inlined]
 [6] *(A::PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, B::ApplyQuasiMatrix{Float64, typeof(*), Tuple{JacobiTriangle{Float64, Int64}, BandedBlockBandedMatrix{Float64, Adjoint{Float64, LazyBandedMatrices.BlockBroadcastArray{Float64, 2, typeof(hcat), Tuple{LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{LazyArrays.BroadcastVector{Int64, typeof(*), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Type{Fill}, Tuple{InfiniteArrays.OneToInf{Int64}, InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{StepRange{Int64, Int64}, typeof(*), Tuple{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{LazyArrays.BroadcastVector{Int64, typeof(*), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, Type{Fill}, Tuple{InfiniteArrays.OneToInf{Int64}, InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}}}, Int64}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}, LazyArrays.BroadcastVector{Int64, typeof(+), Tuple{BlockVector{Int64, LazyArrays.BroadcastVector{StepRange{Int64, Int64}, typeof(*), Tuple{Int64, LazyArrays.BroadcastVector{Base.OneTo{Int64}, Type{Base.OneTo}, Tuple{InfiniteArrays.OneToInf{Int64}}}}}, Tuple{BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}, Int64}}}}}}}, BlockedUnitRange{RangeCumsum{Int64, InfiniteArrays.OneToInf{Int64}}}}}})
   @ QuasiArrays ~/.julia/packages/QuasiArrays/bxqu9/src/matmul.jl:23
 [7] *(App::ApplyQuasiMatrix{Float64, typeof(^), Tuple{PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, Int64}}, b::JacobiTriangle{Float64, Int64})
   @ QuasiArrays ~/.julia/packages/QuasiArrays/bxqu9/src/lazyquasiarrays.jl:231
 [8] top-level scope
   @ REPL[72]:1

julia> Q \ (∂x.^2 * P)
ERROR: DimensionMismatch("Second axis of A, Inclusion(JacobiTriangle(0, 0, 0)), and first axis of B, Inclusion(DomainSets.FixedUnitSimplex{SVector{2, Float64}, :closed}()) must match")
Stacktrace:
 [1] _check_mul_axes(A::BroadcastQuasiMatrix{Float64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, Base.RefValue{Val{2}}}}, B::JacobiTriangle{Float64, Int64})
   @ ArrayLayouts ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:87
 [2] check_mul_axes(::BroadcastQuasiMatrix{Float64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, Base.RefValue{Val{2}}}}, ::JacobiTriangle{Float64, Int64})
   @ ArrayLayouts ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:89
 [3] instantiate
   @ ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:101 [inlined]
 [4] materialize(M::ArrayLayouts.Mul{LazyArrays.BroadcastLayout{typeof(Base.literal_pow)}, ContinuumArrays.BasisLayout, BroadcastQuasiMatrix{Float64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, Base.RefValue{Val{2}}}}, JacobiTriangle{Float64, Int64}})
   @ ArrayLayouts ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:105
 [5] mul
   @ ~/.julia/packages/ArrayLayouts/mTQvg/src/mul.jl:106 [inlined]
 [6] *(A::BroadcastQuasiMatrix{Float64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, PartialDerivative{1, Float64, Inclusion{Float64, JacobiTriangle{Float64, Int64}}}, Base.RefValue{Val{2}}}}, B::JacobiTriangle{Float64, Int64})
   @ QuasiArrays ~/.julia/packages/QuasiArrays/bxqu9/src/matmul.jl:23
 [7] top-level scope
   @ REPL[73]:1

julia> 
@dlfivefifty
Copy link
Member

Should be PartialDerivative{1}(axes(P,1))

@MikaelSlevinsky
Copy link
Member Author

Ok, so the real issue is that the user isn't being prevented from constructing junk.

@dlfivefifty
Copy link
Member

Correct: it should at minimum only allow taking in a AbstractQuasiVector

@dlfivefifty
Copy link
Member

TBF up until now I was the only user and I never passed in junk. So perhaps the real issue is that the user base has doubled and is now too big 😂

@MikaelSlevinsky
Copy link
Member Author

@MikaelSlevinsky MikaelSlevinsky changed the title ApplyQuasiArray(^, ::PartialDerivative, k) doesn't work Either: PartialDerivative{k}(<:Basis) or Inclusion(::Basis) should err Jun 4, 2021
@MikaelSlevinsky MikaelSlevinsky changed the title Either: PartialDerivative{k}(<:Basis) or Inclusion(::Basis) should err Either: PartialDerivative{k}(<:Basis) or Inclusion(::Basis) should err (or both) Jun 4, 2021
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