Skip to content

Commit

Permalink
close #148 (#149)
Browse files Browse the repository at this point in the history
* close #148

* fix in other way
  • Loading branch information
baggepinnen authored Dec 9, 2024
1 parent 6048e91 commit ab91dd2
Show file tree
Hide file tree
Showing 2 changed files with 4 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 = "MonteCarloMeasurements"
uuid = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
authors = ["baggepinnen <[email protected]>"]
version = "1.2.1"
version = "1.2.2"

[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand Down
3 changes: 3 additions & 0 deletions src/particles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ for PT in ParticleSymbols
end

@eval Base.promote_rule(::Type{<:AbstractParticles}, ::Type{$PT{T,N}}) where {T,N} = Union{}

@eval Base.similar(a::Array, ::Type{$PT{T,N}}, dims::Dims{D}) where {D, T, N} = zeros($PT{T,N}, dims) # To handle https://github.com/baggepinnen/MonteCarloMeasurements.jl/issues/148 introduced in julia v1.11
end

# Base.length(p::AbstractParticles{T,N}) where {T,N} = N
Expand All @@ -441,6 +443,7 @@ function Base.Array(v::Array{<:AbstractParticles})
end
Base.Matrix(v::MvParticles) = Array(v)


# function Statistics.var(v::MvParticles,args...;kwargs...) # Not sure if it's a good idea to define this. Is needed for when var(v::AbstractArray) is used
# s2 = map(1:length(v[1])) do i
# var(getindex.(v,i))
Expand Down

0 comments on commit ab91dd2

Please sign in to comment.