Skip to content

Commit

Permalink
fix pparam broadcasting for numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jun 13, 2023
1 parent 70b65ce commit 422e598
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JUDI"
uuid = "f3b833dc-6b2e-5b9c-b940-873ed6319979"
authors = ["Philipp Witte, Mathias Louboutin"]
version = "3.3.3"
version = "3.3.4"

This comment has been minimized.

Copy link
@mloubout

mloubout Jun 28, 2023

Author Member

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
4 changes: 4 additions & 0 deletions src/TimeModeling/Types/ModelStructure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ for op in [:+, :-, :*, :/]
throw(PhysicalParameterException("Incompatible grids: ($(A.d), $(B.d))"))
end
end
@eval $(op)(A::PhysicalParameter{T, N}, B::T2) where {T<:AbstractFloat, T2<:Number, N} = PhysicalParameter(broadcast($(op), A.data, T(B)), A)
@eval $(op)(A::T2, B::PhysicalParameter{T, N}) where {T<:AbstractFloat, T2<:Number, N} = PhysicalParameter(broadcast($(op), T(A), B.data), B)
end

function *(A::Union{joMatrix, joLinearFunction, joLinearOperator, joCoreBlock}, p::PhysicalParameter{RDT, N}) where {RDT<:AbstractFloat, N}
Expand Down Expand Up @@ -252,6 +254,8 @@ for op in [:+, :-, :*, :/, :\]
broadcasted(::typeof($op), A::PhysicalParameter{T, N}, B::DenseArray{T, N}) where {T<:AbstractFloat, N} = PhysicalParameter(A.n, A.d, A.o, materialize(broadcasted($(op), A.data, B)))
broadcasted(::typeof($op), B::DenseArray{T, N}, A::PhysicalParameter{T, N}) where {T<:AbstractFloat, N} = PhysicalParameter(A.n, A.d, A.o, materialize(broadcasted($(op), B, A.data)))
broadcasted(::typeof($op), A::PhysicalParameter{T, N}, B::PhysicalParameter{T, N}) where {T<:AbstractFloat, N} = $(op)(A, B)
broadcasted(::typeof($op), A::PhysicalParameter{T, N}, B::T2) where {T<:AbstractFloat, T2<:Number, N} = PhysicalParameter(broadcast($(op), A.data, T(B)), A)
broadcasted(::typeof($op), A::T2, B::PhysicalParameter{T, N}) where {T<:AbstractFloat, T2<:Number, N} = PhysicalParameter(broadcast($(op), T(A), B.data), B)
end
end

Expand Down

1 comment on commit 422e598

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/86454

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.3.4 -m "<description of version>" 422e598c1029d94445f7d6bc8297c997bf450a66
git push origin v3.3.4

Please sign in to comment.