Skip to content

Commit

Permalink
Add autogenerated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RenatoGeh committed Dec 22, 2020
1 parent 9615133 commit 838cd5f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
16 changes: 16 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# BinaryDecisionDiagrams Documentation

```@contents
```

## API

```@autodocs
Modules = [BinaryDecisionDiagrams]
Order = [:type, :constant, :function, :macro, :module]
```

## Index

```@index
```
20 changes: 14 additions & 6 deletions src/BinaryDecisionDiagrams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ module BinaryDecisionDiagrams

nextid = 1

"""A Binary Decision Diagram.
- `index`: the vertex variable (-1 if terminal vertex
- `low`: low child vertex of BDD (undef if terminal vertex)
- `high`: high child vertex of BDD (undef if terminal vertex)
- `value`: terminal boolean value
- `id`: unique identifier
"""
mutable struct Diagram
"Root vertex variable index (-1 if terminal vertex)."
index::Int
Expand Down Expand Up @@ -157,10 +165,10 @@ export terminal
export variable

"Returns 0 if x is not a literal; else returns the literal's sign."
@inline Base.sign(x::Diagram) = !is_lit(x) ? 0 : x.low ==? 1 : -1
@inline Base.signbit(x::Diagram) = sign(x) == -1
@inline Base.sign(x::Diagram)::Int = !is_lit(x) ? 0 : x.low ==? 1 : -1
@inline Base.signbit(x::Diagram)::Bool = sign(x) == -1
"Returns 0 if x is not a literal; else returns an integer representation of x."
@inline to_int(x::Diagram) = !is_lit(x) ? 0 : x.low ==? x.index : -x.index
@inline to_int(x::Diagram)::Int = !is_lit(x) ? 0 : x.low ==? x.index : -x.index
export to_int

"Return string representation of Diagram α."
Expand Down Expand Up @@ -286,7 +294,7 @@ function Base.deepcopy(α::Diagram)::Diagram
end

"Returns a Diagram canonical representation of α ⊕ β, where ⊕ is some binary operator."
@inline apply::Diagram, β::Diagram, ) = reduce!(apply_step(α, β, , Dict{Tuple{Int, Int}, Diagram}()))
@inline apply::Diagram, β::Diagram, )::Diagram = reduce!(apply_step(α, β, , Dict{Tuple{Int, Int}, Diagram}()))
export apply

"""Recursively computes α ⊕ β. If the result was already computed as an intermediate result, return
Expand Down Expand Up @@ -334,7 +342,7 @@ export restrict
@inline Base.:|::Diagram, X::BitVector)::Diagram = restrict(α, X)
@inline Base.:|::Diagram, x::Int)::Diagram = restrict(α, Dict{Int, Bool}(x > 0 ? x => true : -x => false))
@inline Base.:|::Diagram, X::AbstractArray{Bool})::Diagram = restrict(α, X)
"Returns the evaluation of α given an instantiation X. Returns false if X is not a full instantiation."

@inline::Diagram)(X::Dict{Int, Bool})::Bool = is_⊤(restrict(α, X))
@inline::Diagram)(X::AbstractArray{Int})::Bool = is_⊤|X)
@inline::Diagram)(X::BitVector)::Bool = is_⊤|X)
Expand Down Expand Up @@ -457,7 +465,7 @@ struct ConvalPermutations
V::Vector{Int}
m::Int
end
@inline Base.length(P::ConvalPermutations) = P.m
@inline Base.length(P::ConvalPermutations)::Int = P.m

"Computes all possible valuations of scope V as both conjunctions and instantiation values."
@inline convals(V::Union{Set{Int}, Vector{Int}, UnitRange{Int}}) = ConvalPermutations(sort!(collect(V)), 2^length(V))
Expand Down

2 comments on commit 838cd5f

@RenatoGeh
Copy link
Owner 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/26762

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.1.4 -m "<description of version>" 838cd5f5d0933480246abdfd1f8d5da73e3badc2
git push origin v0.1.4

Please sign in to comment.