Skip to content

Commit

Permalink
reduce dependencies (#127)
Browse files Browse the repository at this point in the history
* reduce dependencies

* version bump

* InfiniteArrays => Infinities

* bugfix

* Revert to ∞ from InfiniteArrays
  • Loading branch information
cscherrer authored Aug 5, 2021
1 parent 8a8946e commit 8a2c551
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 36 deletions.
14 changes: 2 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name = "MeasureTheory"
uuid = "eadaa1a4-d27c-401d-8699-e962e1bbc33b"
authors = ["Chad Scherrer <[email protected]> and contributors"]
version = "0.9.3"
version = "0.10.0"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand All @@ -17,43 +16,34 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
MappedArrays = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
NamedTupleTools = "d9ec5142-1e00-5aa0-9d6a-321866360f50"
NestedTuples = "a734d2a7-8d68-409b-9419-626914d4061d"
PositiveFactorizations = "85a6dd25-e78a-55b7-8502-1745935b8125"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
TransformVariables = "84d833dd-6860-57f9-a1a7-6da5db126cff"
Tricks = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"
Tullio = "bc48ee85-29a4-5162-ae0b-a64e1601d4bc"

[compat]
Accessors = "0.1"
ArrayInterface = "2,3"
ConcreteStructs = "0.2"
ConstructionBase = "1.3"
Distributions = "0.23, 0.24, 0.25"
DynamicIterators = "0.4.2"
FillArrays = "0.11, 0.12"
InfiniteArrays = "0.9, 0.10, 0.11"
InfiniteArrays = "0.11"
KeywordCalls = "0.1, 0.2"
MLStyle = "0.4"
MacroTools = "0.5"
MappedArrays = "0.3, 0.4"
MonteCarloMeasurements = "0.10"
NamedTupleTools = "0.13"
NestedTuples = "0.3"
PositiveFactorizations = "0.2"
SimpleTraits = "0.9"
SpecialFunctions = "0.10, 1"
StaticArrays = "0.12, 1"
StatsFuns = "0.9"
TransformVariables = "0.4"
Tricks = "0.1.4"
Tullio = "0.2, 0.3"
julia = "1.5"

[extras]
Expand Down
3 changes: 2 additions & 1 deletion src/MeasureTheory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ using Accessors
const= InfiniteArrays.∞

export
export basemeasure

export as

Expand All @@ -48,7 +49,7 @@ include("const.jl")
include("exp.jl")
include("domains.jl")
include("utils.jl")
include("traits.jl")
# include("traits.jl")
include("absolutecontinuity.jl")
include("parameterized.jl")
include("macros.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/combinators/power.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Base

using FillArrays: Fill
# """
# A power measure is a product of a measure with itself. The number of elements in
# the product determines the dimensionality of the resulting support.
Expand Down
1 change: 0 additions & 1 deletion src/combinators/product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ end
end


using Tullio



Expand Down
10 changes: 5 additions & 5 deletions src/distproxy.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export distproxy
function distproxy end

import MonteCarloMeasurements
# import MonteCarloMeasurements

PROXIES = Dict(
:Distributions => [
Expand All @@ -10,9 +10,9 @@ PROXIES = Dict(
:entropy
:cdf
],
:MonteCarloMeasurements => [
:Particles
]
# :MonteCarloMeasurements => [
# :Particles
# ]
)

for m in keys(PROXIES)
Expand All @@ -25,7 +25,7 @@ for m in keys(PROXIES)
end
end

MonteCarloMeasurements.Particles(N::Int, d::AbstractMeasure) = MonteCarloMeasurements.Particles(N, distproxy(d))
# MonteCarloMeasurements.Particles(N::Int, d::AbstractMeasure) = MonteCarloMeasurements.Particles(N, distproxy(d))

# using MonteCaroMeasurements

Expand Down
11 changes: 8 additions & 3 deletions src/parameterized/lkj-cholesky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ asparams(::Type{<:LKJCholesky}, ::Val{:logη}) = asℝ


using LinearAlgebra
using Tullio

logdensity(d::LKJCholesky, C::Cholesky) = logdensity(d, C.UL)

Expand All @@ -59,13 +58,19 @@ function logdensity(d::LKJCholesky{(:k, :η,)}, L::Union{LinearAlgebra.AbstractT

# Note: https://github.com/cscherrer/MeasureTheory.jl/issues/100#issuecomment-852428192
c = d.k + 2- 1)
@tullio s = (c - i) * log(L[i,i])
n = size(L,1)
s = sum(1:n) do i
(c - i) * @inbounds log(L[i,i])
end
return s
end

function logdensity(d::LKJCholesky{(:k, :logη)}, L::Union{LinearAlgebra.AbstractTriangular, Diagonal})
c = d.k + 2 * expm1(d.logη)
@tullio s = (c - i) * log(L[i,i])
n = size(L,1)
s = sum(1:n) do i
(c - i) * @inbounds log(L[i,i])
end
return s
end

Expand Down
9 changes: 4 additions & 5 deletions src/parameterized/mvnormal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ using LinearAlgebra
export MvNormal
using Random
import Base
using Tullio


struct MvNormal{N, T, I, J} <: ParameterizedMeasure{N}
Expand Down Expand Up @@ -55,9 +54,9 @@ end

(::MvNormal, ::Lebesgue{ℝ}) = true

function logdensity(d::MvNormal{(:Σ⁻¹,)}, x)
@tullio= -0.5 * x[i] * d.Σ⁻¹[i,j] * x[j]
return
end
# function logdensity(d::MvNormal{(:Σ⁻¹,)}, x)
# @tullio ℓ = -0.5 * x[i] * d.Σ⁻¹[i,j] * x[j]
# return ℓ
# end

mvnormaldims(nt::NamedTuple{(:Σ⁻¹,)}) = size(nt.Σ⁻¹)
2 changes: 0 additions & 2 deletions src/primitives/counting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ export CountingMeasure

struct CountingMeasure{X} <: PrimitiveMeasure end

@primitive CountingMeasure

function Base.show(io::IO, ::MIME"text/plain", μ::CountingMeasure{X}) where {X}
io = IOContext(io, :compact => true)
print(io, "CountingMeasure(", X, ")")
Expand Down
2 changes: 0 additions & 2 deletions src/primitives/dirac.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ struct Dirac{X} <: PrimitiveMeasure
x::X
end

@primitive Dirac

sampletype::Dirac{X}) where {X} = X

function::Dirac{X})(s) where {X}
Expand Down
2 changes: 0 additions & 2 deletions src/primitives/lebesgue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ export Lebesgue

struct Lebesgue{X} <: PrimitiveMeasure end

@primitive Lebesgue

function Base.show(io::IO, ::MIME"text/plain", μ::Lebesgue{X}) where X
io = IOContext(io, :compact => true)
print(io, "Lebesgue(", X, ")")
Expand Down
2 changes: 0 additions & 2 deletions src/primitives/trivial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ export TrivialMeasure

struct TrivialMeasure <: PrimitiveMeasure end

@primitive TrivialMeasure

sampletype(::TrivialMeasure) = Nothing

2 comments on commit 8a2c551

@cscherrer
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@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/42204

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 v0.10.0 -m "<description of version>" 8a2c5511f0ba6d1e11282b319d8db040cd627d50
git push origin v0.10.0

Please sign in to comment.