ifstype.graph

This module implements the ifstype.graph.TransitionGraph class which implements the transition graph of an IFS and related computations which depend only on the transition graph.

This module also implements some related transition graph classes.

Public module attributes:

class ifstype.graph.LocalDim(spr: numbers.Real, ln: numbers.Real)[source]

Represent local dimensions for easy printing and visualization of what the values are.

Special methods:

__init__(spr: numbers.Real, ln: numbers.Real) → None[source]

Initialize the local dimension with two parameters.

Parameters
  • spr – the spectral radius of the transition matrix of the path

  • ln – the length of the path

__float__() → float[source]

Return the actual float approximation.

Returns

float approximation

__str__() → str[source]

Return a human-readable string representation

Returns

string representation

class ifstype.graph.EdgeInfo[source]

Represent the information intrinsic to a fixed edge (other than the source and the target.

class ifstype.graph.SAdjacencyMatrix(mat_values: List[List[Tuple[numbers.Real, ...]]])[source]

Represent s-adjacency matrices, which are symbolic adjacency matrices where the entries are sums of elements of the form r^s, where r is fixed and s can vary.

The matrix is stored symbolically, but particular numpy.ndarray instances can be generated automatically.

>>> s_adj = SAdjacencyMatrix([[(1,),(2,3)],[(),(2,)]])
>>> print(s_adj)
[[1, (2)^s + (3)^s],
 [0, (2)^s        ]]
>>> s_adj.set_s_val(0.5)
>>> s_adj.spectral_radius()
1.4142135623730951
>>> s_adj.compute_s_val()
(0.99993896484375, 1)

Initialization:

Methods:

__init__(mat_values: List[List[Tuple[numbers.Real, ...]]]) → None[source]

Initialize the s-adjacency matrix. The only parameter mat_values is a double-nested list of tuples. A tuple (r1,…,rn) in position (i,j) represents the entry r1^s + … + rn^s in position (i,j) of the s-adjacency matrix. Empty tuples are treated as 0.

Parameters

mat_values – the matrix values

Raises

ValueError – if mat_values is not a square matrix

set_s_val(s: numbers.Real) → None[source]

Set the current evaluation value of s to be a fixed real number strictly greater than 0

Parameters

s – evaluation strictly greater than 0

Raises

ValueError – if s <= 0

spectral_radius() → numbers.Real[source]

Compute the spectral radius at the current fixed s value.

Warning

The s value must be set using set_s_val() before calling this function.

compute_s_val(tol: numbers.Real = 0.0001) → numbers.Real[source]

Compute a value s (within :param tol:) such that the spectral radius of the s-adjacency matrix is 1. If all entries have value between 0 and 1, this value is unique. Returns a lower bound and upper bound on s.

Parameters

tol – error tolerance

Returns

pair (lower s, upper s)