!3$      !"#(c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNone6^&$ Persistence Exclusive or.% PersistenceFirst element of a triple.& PersistenceSecond element of a triple.' PersistenceThird element of a triple.( PersistenceLast two elements of a triple.) Persistence$First and last elements of a triple.* PersistenceFirst two elements of a triple.+ Persistence Concatenate a vector of vectors., PersistenceMultiply a vector by a scalar.- PersistenceAdd two vectors together component-wise. WARNING: If one vector is longer than the other, the longer vector will simply be cut off.. PersistenceSubtract the second vector from the first vector component-wise. WARNING: If one vector is longer than the other, the longer vector will simply be cut off./ Persistence Dot product.0 PersistenceExtended Euclidean algorithm. Finds the gcd of the two inputs plus the coefficients that multiply each input and sum to give the gcd.1 PersistenceBReturns whether or not the first number divides the second number.2 Persistence9Switches the elements of the vector at the given indices.3 PersistenceHReturn all vectors missing exactly one element from the original vector.4 Persistence=Returns whether or not every element satisfies the predicate.5 PersistenceAMap a function that takes into account the index of each element.6 PersistenceMMap a function that takes into account the index of each element in parallel.7 PersistenceGReturn the element satisfying the predicate and its index if it exists.8 Persistence?Return the elements satisfying the predicate and their indices.9 PersistenceUGiven a relation and two vectors, find all pairs of elements satisfying the relation.: PersistenceReturn the vector of elements that satisfy the predicate in the first component and the vector of elements that don't satisfy the predicate in the second component.; Persistence7Orders a list of vectors from greatest to least length.< Persistence&Parallel map a function over a vector.= PersistenceRFilter a vector with a predicate that takes into account the index of the element.> Persistence,Generate a range of integers in vector form.? Persistence>Replace the element at the given index with the given element.@ PersistenceQuicksort treating the given predicate as the < operator. Works like this because its more convenient to make a lambda instead of a complete instance of Ord.A Persistence&Takes the union of all of the vectors.B PersistenceiThe element being searched for, the vector being searched, and the lower and upper bounds on the indices.C PersistenceIntersection of SORTED vectors.D Persistence?snocs the element if an only if it isn't already in the vector.E PersistenceHReturns whether or not there is an element that satisfies the predicate.F PersistencedIf the relation were the "greater than" operator, this would find the minimum element of the vector.G PersistenceUnsafe index finding.H PersistenceBSpark the first argument for parallel evaluation and force evaluation of the second argument, then return the first argument concatenated to the second. This is useful especially if the second argument is a recursive call that calls evalPar again, so that every elemment of the list will be sparked for parallelism.I PersistencedSimple instance of Num where True is 1 and False is 0, all operations work like arithmetic modulo 2.%$%&'()*+,-./0123456789:;<=>?@ABCDEFGH(c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNoneF J PersistenceRMatrix of integers modulo 2. Alternatively, matrix over the field wit h2 elements.K PersistenceMatrix of integers.L PersistenceDisplay an integer matrix.M Persistence*Display a boolean matrix (as 1's and 0's).N Persistence:Take the transpose a matrix (no fancy optimizations, yet).O PersistenceATake the transpose of a matrix using parallel evaluation of rows.P PersistenceMultiply two matricesQ PersistenceHMultiply matrices, evaluate rows in parallel if processors are availableR PersistenceGet the diagonal elements.S PersistenceBGet the absolute value of each of the diagonal elements in a list.T PersistenceIFind the rank of a mod 2 matrix (number of linearly independent columns).U Persistence`Finds the basis of the kernel of a matrix, arranges the basis vectors into the rows of a matrix.V PersistenceeCalculates the image of the second matrix represented in the basis of the kernel of the first matrix. JMNOPQRSTUV(c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNoney)  Persistence]This represents the (symmetric) adjacency matrix of some weighted undirected graph. The type a is whatever distance is in your data analysis regime. The reason graphs are represented like this is because their main function is too speed up the construction of simplicial complexes and filtrations. If the clique complex of this graph were to be constructed, only the adjacencies would matter. But if a filtration is constructed all the distances will be required over and over again - this allows them to be accessed in constant time. PersistencePThe first component of the pair is the number of vertices. The second component is a vector whose entries are vectors of simplices of the same dimension. Index 0 of the vecor corresponds to dimension 1 because there is no need to store individual vertices. A simplex is represented as a pair: the vector of its vertices (represent by their index in the original data set), and the vector of the indices of the faces in the next lowest dimension. Edges are the exception to the last part - they do not store reference to their faces because it would be redundant with their vertices. Persistence1Show all the information in a simplicial complex. PersistenceEGet the dimension of the highest dimensional simplex (constant time). PersistenceTakes the number of vertices and each edge paired with its weight to output the graph encoded as a 2D vector. If only you have an unweighted graph, you can still encode your graph by simply letting the type aj be `()`. If you have a weighted graph but there isn't a distance between every vertex, you can use the Extendedh type (essentially the same as Maybe) from the Persistence module which is already an instance of Ord. PersistenceThe first argument is a scale, the second is a metric, and the third is the data. This function records the distance between every element of the data and whether or not it is smaller than the given scale. PersistenceEMakes a simplicial complex where the simplices are the complete subgraphs (cliques) of the given graph. Mainly a helper function for makeVRComplexFast, but it might be useful if you happen to have a graph you want to analyze. This utilizes any available processors in parallel because the construction is quite expensive. Persistence'Constructs the Vietoris-Rips complex given a scale, metric, and data set. Also uses O(n^2) memory (where n is the number of data points) for a graph storing all the distances between data points. This utilizes any available processors in parallel because the construction is quite expensive. PersistenceConstructs the Vietoris-Rips complex given a scale, metric, and data set. This utilizes any available processors in parallel because the construction is quite expensive.  PersistenceThe nth index of the output corresponds to the nth Betti number. The zeroth Betti number is the number of connected components, the 1st is the number of tunnels/punctures, the 2nd is the number of hollow volumes, and so on for higher-dimensional holes.  Persistence0Calculates all of the Betti numbers in parallel.   (c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNone  Persistence4Type for representing inifinite bottleneck distance.  Persistence(i, Just j) is a feature that appears at filtration index i and disappears at index j, (i, Nothing) begins at i and doesn't disappear.  PersistenceFThe first component is simply the number of vertices (all vertices are assumed to have filtration index 0). The second component is a vector with an entry for each dimension of simplices, starting at dimension 1 for edges. Each simplex is represented as a triple: its filtration index, the indices of its vertices in the original data, and the indices of its faces in the next lowest dimension. Edges do not have reference to their faces, as it would be redundant with their vertices. All simplices are sorted according to filtration index upon construction of the filtration. Persistence'Shows all the information in a simplex. Persistence*Shows all the information in a filtration. PersistencetGets the simplicial complex specified by the filtration index. This is O(n) with respect to the number of simplices. PersistenceThe first argument is a list of dimensions, the second argument is a list of filtration indices. The function returns the number of simplices in the filtration whose dimension and index exist in the respective lists. PersistenceZReturn the dimension of the highest dimensional simplex in the filtration (constant time). PersistenceGiven a list of scales, a simplicial complex, and a weighted graph (see SimplicialComplex) which encodes a metric on the vertices, this function creates a filtration out of a simplicial complex by removing simplices that contain edges that are too long for each scale in the list. This is really a helper function to be called by makeVRFiltrationFast, but I decided to expose it in case you have a simplicial complex and weighted graph lying around. The scales MUST be in decreasing order for this function. Persistence<Given a list of scales, a metric, and a data set, this function constructs a filtration of the Vietoris-Rips complexes associated with the scales. The scales MUST be in decreasing order. Note that this a fast function, meaning it uses O(n^2) memory to quickly access distances where n is the number of data points. PersistenceThe same as filterbyWeightsFast except it uses far less memory at the cost of speed. Note that the scales must be in decreasing order. PersistenceGiven a list of scales in decreasing order, a metric, and a data set, this constructs the filtration of Vietoris-Rips complexes corresponding to the scales. Persistence0Each index in the list is a list of barcodes whose dimension corresponds to the index. That is, the first list will represent clusters, the second list will represent tunnels or punctures, the third will represent hollow volumes, and the nth index list will represent n-dimensional holes in the data. PersistenceReturn the maximum of minimum distances bewteen the bar codes. It's important to note that the function isn't "unsafe" in the sense that it will throw an exception, it will just give you a distance regardless of whether or not there is the same number of barcodes is in each list. PersistenceoGet's all the bottle neck distances; a good way to determine the similarity of the topology of two filtrations. PersistenceIf the number of barcodes is the same, return the maximum of minimum distances bewteen the bar codes. Otherwise return nothing. PersistencetSafely get all the bottle neck distances; a good way to determine the similarity of the topology of two filtrations.  (c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNone PersistencepType representing an admissible Hasse diagram. Each entry in the vector represents a level in the Hasse diagram. PersistenceType representing a node in a Hasse diagram. Hasse diagrams are being used to represent simplicial complexes so each node represents a simplex Contents of the tuple in order: Vector of references to vertices of the underlying directed graph, vector of references to the simplices faes in the next lowest level of the Hasse diagram, vector of references to "parent" simplices (simplices who have this simplex as a face) in the next highest level of the Hasse diagram.  Persistence,Simple printing function for Hasse diagrams.! PersistenceGiven the number of vertices in a directed graph, and pairs representing the direction of each edge (initial, terminal), construct a Hasse diagram representing the graph." PersistenceGiven a Hasse diagram representing a directed graph, construct the diagram representing the directed clique/flag complex of the graph.# Persistence0Convert a Hasse diagram to a simplicial complex. !"# !"#W      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[(Persistence-1.1.2-JbA9w2XoNso20dGFc18QpoSimplicialComplex Persistence HasseDiagramUtilMatrixGraph sc2StringgetDimencodeWeightedGraphmakeNbrhdGraphmakeCliqueComplexmakeVRComplexFastmakeVRComplexLight bettiNumbersbettiNumbersParExtendedBarCode Filtration sim2String filtr2String getComplexgetNumSimplices getDimensionfilterByWeightsFastmakeVRFiltrationFastfilterByWeightsLightmakeVRFiltrationLightpersistentHomologybottelNeckDistancebottelNeckDistancessafeBottelNeckDistancesafeBottelNeckDistances $fOrdExtended $fEqExtendedNode hsd2StringencodeDirectedGraphdirectedFlagComplextoSimplicialComplexxoronetwothrnot1not2not3flattenmuladdsubtr dotProduct extEucAlgdivides switchElems getCombos forallVec mapWithIndexparMapWithIndex elemAndIndexelemAndIndices findBothElemsbiFiltersortVecs parMapVecfilterWithIndexrange replaceElem quicksortbigU binarySearch|^| smartSnoc existsVec foldRelationelemIndexUnsafeevalPar $fNumBoolBMatrixIMatrix iMat2String bMat2String transposeMat transposeParmultiply multiplyPar getDiagonalgetUnsignedDiagonalrankBool kernelBool imgInKerBool