Bijections.BijectionMethod

Construct a new Bijection.

  • Bijection{S,T}() creates an empty Bijection from objects of type S to objects of type T. If S and T are omitted, then we have Bijection{Any,Any}.
  • Bijection(x::S, y::T) creates a new Bijection initialized with x mapping to y.
  • Bijection(dict::Dict{S,T}) creates a new Bijection based on the mapping in dict.
  • Bijection(pair_list::Vector{Pair{S,T}}) creates a new Bijection using the key/value pairs in pair_list.
Base.:*Method
(*)(a::Bijection{A,B}, b::Bijection{B,C})::Bijection{A,C} where {A,B,C}

The result of a * b is a new Bijection c such that c[x] is a[b[x]] for x in the domain of b. This function throws an error is domain(a) is not the same as the image of b.

Base.delete!Method

delete!(b::Bijection,x) deletes the ordered pair (x,b[x]) from b.1==

Base.getMethod

get(b::Bijection, key, default) returns b[key] if it exists and returns default otherwise.

Base.getindexMethod

For a Bijection b and a value x in its domain, use b[x] to fetch the image value y associated with x.

Base.invMethod

inv(b::Bijection) creates a new Bijection that is the inverse of b. Subsequence changes to b will not affect inv(b).

See also active_inv.

Base.isemptyMethod

isempty(b::Bijection) returns true iff b has no pairs.

Base.lengthMethod

length(b::Bijection) gives the number of ordered pairs in b.

Base.setindex!Method

For a Bijection b use the syntax b[x]=y to add (x,y) to b.

Bijections.active_invMethod

active_inv(b::Bijection) creates a Bijection that is the inverse of b. The original b and the new Bijection returned are tied together so that changes to one immediately affect the other. In this way, the two Bijections remain inverses in perpetuity.

See also inv.

Bijections.domainMethod

domain(b::Bijection) returns the set of input values for b.

Bijections.imageMethod

image(b::Bijection) returns the set of output values of b.

Bijections.inverseMethod

inverse(b::Bijection,y) returns the value x such that b[x] == y (if it exists).