CyclingSignatures.curve_cycle — Method
curve_cycle(i,j;F=DEFAULT_FIELD)Returns the curve cycle corresponding to i and j where i<j.
Returns
edges: vector of edges[i,i+1], [i+1,i+2], ..., [j-1,j], [i,j].coeffs: coefficients[1,...,1,-1].
CyclingSignatures.dm_components_explicit — Method
dm_components_explicit(points, metric, flt_threshold)Computes a filtration-minimal vertex of each connected component of the distance complex up to the filtration threshold flt_threshold. The distance complex is specified by points and metric.
This is implmented using a two pass annotation algorithm for images, the image being the upper right part of the distance matrix. In this implementation, the distance matrix is computed explicitly.
CyclingSignatures.dm_components_first_pass_explicit — Method
dm_components_first_pass_explicit(points, metric, threshold)Given a matrix with trajectory points, a metric and a filtrationThreshold, computes the connected components of the graph defined by the matrix pairwise(metric,points) .<= threshold where
- vertices are matrix entries,
- edges are nearest 4.
Returns a disjoint set with labels, the label of each entry and the distance matrix. Note: entries with different labels may be in the same component (iff their labels are in the same set in cc)
CyclingSignatures.dm_components_first_pass_implicit — Method
dm_components_first_pass_explicit(points, metric, threshold)Given a matrix with trajectory points, a metric and a filtration threshold, computes the connected components of the graph defined by the matrix pairwise(metric,points) .<= threshold where
- vertices are matrix entries,
- edges are nearest 4.
Returns a disjoint set with label and the label of each entry. Note: entries with different labels may be in the same component (iff their labels are in the same set in cc)
CyclingSignatures.dm_components_implicit — Method
filtration_min_vertices_implicit_dm(points, metric, flt_threshold)Computes a filtration-minimal vertex of each connected component of the distance complex specified by points and metric up to the filtration threshold flt_threshold. This is implmented using a two pass annotation algorithm for images, the image being the upper right part of the distance matrix. In this implementation, the distance matrix is not computed explicitly.
CyclingSignatures.trajectory_barcode — Function
trajectory_barcode(::Val{:DistanceMatrix}, points, metric, fltThreshold, field=DEFAULT_FIELD)Computes a trajectory barcode using the distance matrix method, for arguments see trajectory_barcode. This assumes (and formall makes use of) a curve hypothesis.
The distance complex of a the points in points with respect to the metric is the filtered complex where
- vertices are pairs
(i, j)withi < j, filtered bymetric(points[:, i], points[:, j])and - edges are nearest 4, with filtration value of an edge being the max of its adjacent vertices.
Note:
In general, the returned collection of bars is not a persistence diagram for the point cloud.
CyclingSignatures.vertex_to_essential_bar — Method
vertex_to_essential_bar(node, points, metric; field=DEFAULT_FIELD)Given a node (i,j) in the distance matrix, returns an essential bar corresponding to the induced cycle in the Vietoris–Rips complex.
CyclingSignatures.basic_reduction! — Method
basic_reduction!(M::AbstractMatrix{T}) where TPerforms the basic persistence matrix reduction of M in place.
CyclingSignatures.colspace_normal_form — Method
colspace_normal_form!(M)Computes and returns the (nonzero part of the) reduced column echelon form of the matrix M.
Elementary column operations are performed to transform M into a form where:
- Each pivot value is 1 and is the only non-zero entry in its column.
- The leading entry of each non-zero column is below the leading entry of the previous row.
- columns without leading entries are removed from the matrix.
CyclingSignatures.AbstractComparisonSpace — Type
Abstract base type for comparison spaces.
Subtypes must implement:
map_cycle(cs, points, simplices, coeffs): Maps a cycle into the comparison spacebetti_1(cs)
CyclingSignatures.AbstractCubicalAcyclicCarrier — Type
Abstract base type for cubical acyclic carriers. Subtypes represent an implementation of a cell complex representing a union of cubes which allows the construction of chains from acyclic subsets and the annotation of cycles using a cohomology basis.
Subtypes must implement:
induced_one_chain(carrier, edge_boxes): Given a vector of boxes covering an edge, computes the induced one-chain.annotate_chain(carrier, chain): Annotates a chain using a cohomology basis. For cycles, the result is independent of the representative.betti_1(carrier): Returns the first betti number of the carrier.
CyclingSignatures.AbstractCubicalComparisonSpace — Type
Abstract type for cubical-based comparison spaces. Inherits from AbstractComparisonSpace.
Subtypes must implement:
edge_boxes(comparison_space, p1, p2): Computes the boxes covering the edge between pointsp1andp2.carrier(comparison_space): Returns an associated cubical acyclic carrier.betti_1(comparison_space): Returns the first betti number of the comparison space.
CyclingSignatures.AbstractSampleableTrajectory — Type
Abstract base type for trajectories that can be used in cycling computations.
Subtypes must implement:
evaluate_interval(trajectory, a, b): Returns points that the trajectory visits between timeaandb.time_domain(trajectory): Returns time domain of the trajectory
CyclingSignatures.CubicalComparisonSpace — Type
Standard cubical comparison space.
Fields
boxsize::T: Size of cubical boxescarrier::C: Associated cubical acyclic carrier
CyclingSignatures.CubicalVRCarrier — Type
Fields
pts::Matrix{S}: Points in the carrier, whereSis an integer type. The columns are assumed to be sorted.cplx::CellComplex{Simplex}: The Nerve of the cubical cover, it is the $l_\infty$-distance VR-complex of the box centers.h1::V: The transpose of h1 is a basis for the first cohomology of the complex.
CyclingSignatures.CubicalVRCarrier — Method
CubicalVRCarrier(pts::Matrix{S}) where STODO: write docstring
CyclingSignatures.DynamicDistance — Type
DynamicDistance{C} <: MetricCalculates the distance between points in the tangent bundle according to the formula
$d_{dyn}((p,v),(q,w)) = \max(\|p - q\|, C \|v - w\|)$
where C is a constant.
Fields
dim::Int: The dimension of the space (i.e. half the tangent space dimension).c::C: The constant used in the distance calculation.
CyclingSignatures.FF — Type
FF{M} <: IntegerFF{M} is the default field used in CyclingSignatures. It is a representation of a finite field $\mathbb{Z}_M$, integers modulo small, prime M. Supports field arithmetic and can be converted to integer with Int.
Example
julia> FF{3}(5)
2 mod 3
julia> FF{3}(5) + 1
0 mod 3Copyright
Copyright (c) 2020 mtsch
CyclingSignatures.RefinedEquidistantTrajectory — Type
struct RefinedEquidistantTrajectoryModels a refinement of a trajectory on an equidistant grid.
More precisely, the points [trajectory[:, i] for i in t_vec[1:end-1]] are assumed to be the sample points, and the other points are the refined points.
It holds for all i in 1:length(t_vec)-1 that the points in the i-th interval are given by the indices in t_vec[i]:t_vec[i+1]-1.
CyclingSignatures.SBCubicalComparisonSpace — Type
Sphere bundle cubical comparison space.
Fields
boxsize::T: Size of cubical boxessb_radius::TT: Sub-block radius parametercarrier::C: Associated cubical acyclic carrier
CyclingSignatures.betti_1 — Method
betti_1(cs::AbstractComparisonSpace)Returns the first betti number of the comparison space.
CyclingSignatures.betti_1 — Method
betti_1(carrier)Returns the first betti number of the carrier.
CyclingSignatures.boxes_bfs_shortest_path — Method
grid_bfs_shortest_path(points, p1, p2)Given a sorted matrix of points points on an integer grid and two points p1 and p2, finds a shortest path between them using BFS.
CyclingSignatures.cycling_signature — Function
cycling_signature([alg::Val, ]trajectory_space::TrajectorySpace, range; r_max, field=DEFAULT_FIELD)Computes the cycling signature of the segment specified by range inside of trajectory_space for filtration values $[0,r_{max}]$. Optionally, a field and an algorithm can be specified.
Arguments
alg: currently only :DistanceMatrix workstrajectory_space: the trajectory spacerange: currently, this evaluates the cycling signature on the interval[first(range):last(range)]r_max: if unspecified, the default intrajectory_spaceis usedfield: coefficient field for homology computation
Returns
TODO
CyclingSignatures.cycspace_inclusion_matrix — Method
cycspace_inclusion_matrix(V, W)For a list of matrices V and W, compute the inclusion matrix where entry (i,j) is 1 if the image of V[i] is included in the image of W[j], and 0 otherwise.
CyclingSignatures.cycspace_segments — Method
cycspace_segments(result::RandomSubsegmentResult, V)Get the segments from the result that generate the cycling space V for some radius.
CyclingSignatures.cycspace_segments_at_r — Method
cycspace_segments_at_r(result::RandomSubsegmentResult, V, r)Get the segments from the result have cycling space V at radius r.
CyclingSignatures.dynamicIndices — Method
function dynamicIndices(dataq::Matrix)Returns a vector v and a matrix M s.t. the columns of M are pairwise distinct and M[:,v[t]] = dataq[:,t] for all t. In other words, M contains the unique boxes and v[t] the index of the box at time step t.
CyclingSignatures.edge_boxes — Method
edge_boxes(p1, p2)Computes the centers of all integer grid boxes which intersect the edge [p1;p2].
CyclingSignatures.fix_edge — Method
fix_edge(carrier::CubicalVRCarrier, box1, box2)Searches for a (short) shortest path between the boxes. Note that current implementation is not well-defined since it may be random which way a missing box is bypassed.
CyclingSignatures.induced_one_chain — Method
induced_one_chain(carrier::AbstractCubicalAcyclicCarrier, edge_boxes)Implements the conversion of an acyclic cubical cover to an induced chain.
Arguments
carrier::AbstractCubicalAcyclicCarrier: The cubical acyclcic carrieredge_boxes: Boxes that cover an one chain
Returns
A representation of an induced chain
CyclingSignatures.intersect_lines — Method
intersect_lines(a,b)Computes the intersection of the lines (1-l)*a[i]+l*b[i]
CyclingSignatures.lenght_countdict_to_countmatrix — Method
lenght_countdict_to_countmatrix(ct_dict; n_relevant = nothing)Convert a length count dictionary (i.e. key maps to a vector of counts per segment length) to a count matrix for the n_relevant most appearing keys.
CyclingSignatures.map_cycle — Method
map_cycle(cs::AbstractComparisonSpace, points, simplices, coeffs)Annotates the cycle specified by points, simplices and coeffs into a comparison space using the given comparison space.
Arguments
cs::AbstractComparisonSpace: The comparison spacepoints: Points defining the cyclesimplices: Simplices in the cyclecoeffs: Coefficients for the cycle
Returns
Mapped cycle representation (implementation-dependent)
CyclingSignatures.mod_prime — Method
mod_prime(i, ::Val{M})Like mod, but with prime M.
CyclingSignatures.projection_max_switches — Method
projection_max_switches(v1, v2)Computes a vector of times T which partition the interval [0,1] such that λ \mapsto (1-λ)v_1 + λ v_2 has the same maximal component in each interval [T[0];T[1]].
CyclingSignatures.quantize — Method
quantizes each column of x to a grid of size r.
If r is an integer, boxes have size r in each dimension, if r is a vector, it has to contain a length for every dimension.
CyclingSignatures.quantize_subset — Method
Quantizes with s giving the box size per dimension, then maps points outside [q_min,q-max] to nearest box
CyclingSignatures.rank_distribution — Method
rank_distribution(result::RandomSubsegmentResult, k)Compute the rank distribution for dimension k from the given RandomSubsegmentResult.
CyclingSignatures.resampleToConsistent — Method
function resampleToConsistent(ds, Y, r, dt)Adds additional sample points to a time series Y from a dynamical system ds at time step dt such that the resulting time series quantized at r is consistent.
Instead of the actual trajectory points, one can also make pp(Y) dynamically consistent, where pp is a postprocessing applied to the data (for example a rescaling).
Furthermore, it is possible to specify a sbradius and a sbfct which ensures consistency in the sphere bundle. Note: this works as follows: the output of the integrator is applied to sbfct, this will be scaled to sbRadius (in lInf norm) and then checked for consistency
CyclingSignatures.resampleToConsistent — Method
function resampleToConsistent(ds, ic, ec, r, dt; pp=identity, verbose=false, max_depth=16)Returns a matrix M such that [M ec] is dynamically consistent and M[:,1] = ic. Note that M[:,end] != ec.
CyclingSignatures.resampleToDistance — Function
function resampleToDistance(ds, Y, r, dt; kwargs...)Adds additional sample points to a time series Y from a dynamical system ds at time step dt such that the resulting time series satisfies the specified distance requirements
Instead of the actual trajectory points, one can also require pp(Y) to satisfy the requirement, where pp is a postprocessing applied to the data (for example a rescaling).
Furthermore, it is possible to specify a sbradius and a sbfct which ensures consistency in the sphere bundle. Note: this works as follows: the output of the integrator is applied to sbfct, this will be scaled to sbRadius (in lInf norm) and then checked for consistency