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_length_interval_countmatrix — Method
cycspace_length_interval_countmatrix(result::RandomSubsegmentResult, k;
n_subspaces=nothing, sort_by_tp_with_rmax=nothing,
filter_shorter_than=0, filter_shorter_r_max=Inf)Return (sig, M) where M[i,j] is the number of segments of length segment_lengths[j] whose k-dimensional cycling subspace equals sig[i], counting only intervals with length at least filter_shorter_than (with interval endpoints clipped at filter_shorter_r_max). Ordering matches the old signaturesLengthToIntervalCount behavior.
CyclingSignatures.cycspace_radius_frequency_functions — Method
cycspace_radius_frequency_functions(result::RandomSubsegmentResult, k;
r_max_for_sorting=nothing, filter_shorter_as=0, max_n_sig=nothing)Return (sig, fs) where sig are k-dimensional cycling subspaces ordered as in the old allSignatureRadiusFunctions pipeline and fs[i] is the total radius-frequency step function for sig[i] (summed over all segment lengths).
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.cycspace_total_distribution — Method
cycspace_total_distribution(result::RandomSubsegmentResult, V)Return a step function f(r) giving the total number of segments (summed over all segment lengths) whose k = size(V,2)-dimensional cycling space equals V at radius r.
CyclingSignatures.cycspace_total_distributions — Method
cycspace_total_distributions(result::RandomSubsegmentResult, k; n_subspaces=nothing)Compute total radius-distributions for the most frequent k-dimensional cycling spaces. Returns (sig, fs) where sig is a vector of subspace matrices and fs[i] is the corresponding total distribution step function.
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.rank_distribution — Method
rank_distribution(result::RandomSubsegmentResult, k)Compute the rank distribution for dimension k from the given RandomSubsegmentResult.
CyclingSignatures.resample_to_consistent — Method
resample_to_consistent(ds, Y, r, dt; kwargs...)Refines the time series Y so consecutive points are adjacent boxes in quantized space, with optional sphere-bundle consistency.
CyclingSignatures.resample_to_distance — Method
resample_to_distance(ds, dt, Y, r; metric=euclidean, kwargs...)Refines the time series Y so consecutive points are close according to a distance or adjacency criterion. Returns the refined trajectory and t_vec indexing refined points by original step.
CyclingSignatures.resample_to_distance — Method
resample_to_distance(sol, dt, r; kwargs...)Refines a solution object sol by evaluating it at refined times.