Base.MatrixMethod

Matrix(f::DiscreteFunction) returns an n-by-n zero-one matrix in which there is a 1 in position i,j exactly when f(i)==j.

DiscreteFunctions.DiscreteFunctionType

DiscreteFunction is a function from {1,2,...,n} to itself. It can be created by DiscreteFunction(list) where list is a one-dimensional array of positive integers. Alternatively, it can be created using positive integer arguments.

The following are equivalent:

DiscreteFunction([1,4,2,3])
DiscreteFunction(1,4,2,3)
DiscreteFunctions.DiscreteFunctionMethod

DiscreteFunction(A) creates a new discrete function based on the square matrix A. It is required that each row of A have exactly one nonzero element. Note that if A=Matrix(f) then DiscreteFunction(A)==f.

Base.:+Method

If f and g are of type DiscreteFunction, then f+g is their disjoint sum.

Base.sqrtMethod

sqrt(g::DiscreteFunction) returns a function f such that f*f==g or throws an error if no such function exists. This method uses integer linear programming.

DiscreteFunctions.has_sqrtMethod

has_sqrt(f::DiscreteFunction) checks if there is a function g such that g*g==f. Returns true if so and false otherwise.

DiscreteFunctions.imageMethod

image("f::DiscreteFunction") returns a Set containing all the output values of f.

DiscreteFunctions.quick_sqrt_testMethod

quick_sqrt_test(f::DiscreteFunction) is a quick check of a necessary condition for f to have a square root. If this returns false then f does not have a square root. If it returns true, it might.

DiscreteFunctions.sourcesMethod

sources(f::DiscreteFunction) returns a list of all inputs to f that are not the output of f. That is, this is a list of the vertices with out-degree 0 in the graph of f.

Permutations.fixed_pointsMethod

fixed_points(f::DiscreteFunction) returns a list of fixed points of the function, i.e., those values x such that f(x)==x.