API
The following methods constitute the public API of the Bijections package.
Index
Bijections.BijectionBase.:*Base.delete!Base.getBase.getindexBase.haskeyBase.invBase.isemptyBase.lengthBase.setindex!Bijections.active_invBijections.domainBijections.hasvalueBijections.imageBijections.inverseBijections.inverse_dict_type
Reference
Bijections.Bijection — MethodBijection()Construct a new Bijection.
Bijection{S,T}()creates an emptyBijectionfrom objects of typeSto objects of typeT. IfSandTare omitted, then we haveBijection{Any,Any}.Bijection(x::S, y::T)creates a newBijectioninitialized withxmapping toy.Bijection(dict::Dict{S,T})creates a newBijectionbased on the mapping indict.Bijection(pair_list::Vector{Pair{S,T}})creates a newBijectionusing the key/value pairs inpair_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! — Methoddelete!(b::Bijection, x)Deletes the ordered pair (x,b[x]) from b.
Base.get — Methodget(b::Bijection, key, default)Returns b[key] if it exists and returns default otherwise.
Base.getindex — Methodgetindex(b::Bijection, x)For a Bijection b and a value x in its domain, use b[x] to fetch the image value y associated with x.
Base.haskey — MethodBase.haskey(b::Bijection, x)Checks if x is in the domain of the Bijection b.`
Base.inv — Methodinv(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.isempty — Methodisempty(b::Bijection)Returns true iff b has no pairs.
Base.length — Methodlength(b::Bijection)Gives the number of ordered pairs in b.
Base.setindex! — Methodsetindex!(b::Bijection, y, x)For a Bijection b use the syntax b[x]=y to add (x,y) to b.
Bijections.active_inv — Methodactive_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.domain — Methoddomain(b::Bijection)Returns an iterator for the keys for b.
Bijections.hasvalue — Methodhasvalue(b::Bijection, y)Checks if y is in the image of the Bijection b. It is equivalent to checking if the inverse mapping b.finv has y as a key, so it should as fast as haskey.
Bijections.image — Methodimage(b::Bijection)Returns an iterator for the values of b.
Bijections.inverse — Methodinverse(b::Bijection, y)Returns the value x such that b[x] == y (if it exists).
Bijections.inverse_dict_type — Methodinverse_dict_type(D::Type{<:AbstractDict})Returns the type of the inverse dictionary for a given AbstractDict type D. This is used internally to create the inverse mapping in a Bijection.