Skip to content

basic distmatrix support #81

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

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f9d9f85
basic distmatrix support
guyvdbroeck Oct 27, 2022
caef7f9
fix compile cache updates
rtjoa Oct 28, 2022
73c99f2
remove unnecessary compile method
rtjoa Oct 28, 2022
3140363
fix CG parent over-counting to increase cudd derefs
rtjoa Oct 28, 2022
9cb1bb7
CompatHelper: bump compat for CUDD to 0.3, (keep existing compat)
Nov 1, 2022
5c90902
Add DistChar
rtjoa Oct 26, 2022
eb6e52f
Add DistString
rtjoa Oct 27, 2022
8e6472a
Add Caesar Cipher example
rtjoa Oct 27, 2022
0626908
use Test package for char/string tests
rtjoa Nov 8, 2022
6ba6b69
change isless implementation and test
williamxcao Jan 17, 2023
e451a6d
support different bit assignments corresponding to the same value
rtjoa Nov 13, 2022
db6b69b
add probabilistic tuple ite
rtjoa Nov 13, 2022
a2cfe89
state machine example
rtjoa Nov 13, 2022
ab9ecf3
test tuple ite
rtjoa Nov 13, 2022
0fb804b
add vector and enum
rtjoa Nov 13, 2022
a78fca2
vector: use prob_getindex instead of Base.getindex
rtjoa Nov 15, 2022
744103b
consistent comparison operators
rtjoa Nov 15, 2022
541bd15
use >= in vector
rtjoa Dec 7, 2022
7c636c7
fix bdd node counting
rtjoa Dec 7, 2022
b3edf27
grammar/parser wip
rtjoa Dec 11, 2022
d30c78b
DistVector: add prob_contains
rtjoa Jan 11, 2023
78800c9
Allow inference on Vector{i<:Dist}
rtjoa Jan 11, 2023
33d091a
Add examples of non-deterministic programs
rtjoa Jan 12, 2023
369b34d
nodet tests
rtjoa Jan 20, 2023
7581a78
Add DistVector sorting
rtjoa Jan 26, 2023
b78dc46
Fix DistVector tests
rtjoa Jan 26, 2023
3c6e62c
error check defaults
guyvdbroeck Mar 22, 2023
927c3ff
fix issues switching between dynamo and no-dynamo evaluation
guyvdbroeck Mar 22, 2023
98abd92
support `expectation` and `variance` of Booleans
guyvdbroeck Mar 22, 2023
b14bfd3
simplify `uniform_arith`
guyvdbroeck Mar 23, 2023
91f9a5f
simplify `uniform`
guyvdbroeck Mar 23, 2023
53369ad
clean up `discrete` and fix argument order of `convert`
guyvdbroeck Mar 23, 2023
93e8590
simplified `DistUInt`
guyvdbroeck Mar 24, 2023
98b5340
simplify mod
guyvdbroeck Mar 24, 2023
a7dbe91
fix reduced bitwdith conversions
guyvdbroeck Mar 26, 2023
6a2e96c
simplify expectation and variance
guyvdbroeck Mar 26, 2023
9af8c98
simplify `DistInt`
guyvdbroeck Mar 26, 2023
32e2ae7
simplified DistInt multiplication
guyvdbroeck Mar 26, 2023
ce8b617
simplify DistInt division
guyvdbroeck Mar 27, 2023
a0dab50
simplified DistInt mod
guyvdbroeck Mar 27, 2023
c116474
basic distmatrix support
guyvdbroeck Oct 27, 2022
cbf5cdb
cleanup
PoorvaGarg Apr 21, 2023
005ab79
Merge branch 'main' into matrix
PoorvaGarg Apr 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/dist/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ tobits(x::Tuple) =
frombits(x::Tuple, world) =
map(v -> frombits(v, world), x)

tobits(x::Matrix) =
mapreduce(tobits, vcat, x)

frombits(x::Matrix, world) =
map(v -> frombits(v, world), x)

Base.ifelse(cond::Dist{Bool}, then::Tuple, elze::Tuple) =
Tuple(ifelse(cond, x, y) for (x, y) in zip(then,elze))

Expand Down
15 changes: 15 additions & 0 deletions test/tuple_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,18 @@ using Distributions
end
@test pr(cg)[(false, false, 3)] ≈ 0.5 + 0.5 * 0.8/2^3
end

@testset "Probabilistic Matrix" begin

x = [DistUInt{3}([false,false,flip(1.0/(i+j))]) for i=1:2, j=1:2]
@test getindex.(pr.(x), 1) ≈ [0.5 0.3333333333333333; 0.3333333333333333 0.25]

# TODO next test is too slow, speed up dynamo
# y = @dice begin
# x*x
# end

# pr(y)[[0 0; 0 0]] ≈ 0.333333

end