s     (c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNone-% Exclusive or.First element of a triple.Second element of a triple.Third element of a triple.Last two elements of a triple.$First and last elements of a triple.First two elements of a triple. Concatenate a vector of vectors.Multiply a vector by a scalar.Add two vectors together component-wise. WARNING: If one vector is longer than the other, the longer vector will simply be cut off. Subtract 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.! Dot product."Extended Euclidean algorithm. Finds the gcd of the two inputs plus the coefficients that multiply each input and sum to give the gcd.#BReturns whether or not the first number divides the second number.$9Switches the elements of the vector at the given indices.%HReturn all vectors missing exactly one element from the original vector.&=Returns whether or not every element satisfies the predicate.'AMap a function that takes into account the index of each element.(MMap a function that takes into account the index of each element in parallel.)GReturn the element satisfying the predicate and its index if it exists.*?Return the elements satisfying the predicate and their indices.+UGiven a relation and two vectors, find all pairs of elements satisfying the relation.,Return 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.-7Orders a list of vectors from greatest to least length..&Parallel map a function over a vector./RFilter a vector with a predicate that takes into account the index of the element.0,Generate a range of integers in vector form.1>Replace the element at the given index with the given element.2Quicksort 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.3&Takes the union of all of the vectors.4iThe element being searched for, the vector being searched, and the lower and upper bounds on the indices.5Intersection of SORTED vectors.6HReturns whether or not there is an element that satisfies the predicate.7dIf the relation were the "greater than" operator, this would find the minimum element of the vector.8Unsafe index finding.9BSpark 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.:dSimple instance of Num where True is 1 and False is 0, all operations work like arithmetic modulo 2.$ !"#$%&'()*+,-./0123456789(c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNone: ;RMatrix of integers modulo 2. Alternatively, matrix over the field wit h2 elements.<Matrix of integers.=:Take the transpose a matrix (no fancy optimizations, yet).>ATake the transpose of a matrix using parallel evaluation of rows.?Multiply two matrices@HMultiply matrices, evaluate rows in parallel if processors are availableAGet the diagonal elements.BBGet the absolute value of each of the diagonal elements in a list.CIFind the rank of a mod 2 matrix (number of linearly independent columns).D`Finds the basis of the kernel of a matrix, arranges the basis vectors into the rows of a matrix.EeCalculates the image of the second matrix represented in the basis of the kernel of the first matrix. ;=>?@ABCDE(c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNonec TThis represents the (symmetric) adjacency matrix of some 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.5The 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. The dimension starts at 1 because there is no need to store individual vertices. A simplex is represented as a pair: the vector of its vertices in the original data set from which the complex was constructed, and the vector of the indices of the faces in the next lowest dimension. Edges are the exception - they do not store reference to their faces because it would be redundant with their vertices.1Show all the information in a simplicial complex.EGet the dimension of the highest dimensional simplex (constant time).The 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.EMakes 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.'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.Constructs the Vietoris-Rips complex given a scale, metric, and data set. This utilizes any available processors in parallel because the construction is quite expensive.The 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. 0Calculates all of the Betti numbers in parallel.   (c) Eben Cowley, 2018 BSD 3 Clauseeben.cowley42@gmail.com experimentalNone1 (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. FThe 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. 'Shows all the information in a simplex. *Shows all the information in a filtration.tGets the simplicial complex specified by the filtration index. This is O(n) with respect to the number of simplices.The 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.ZReturn the dimension of the highest dimensional simplex in the filtration (constant time).Given 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. Really, this is 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.<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.The same as filterbyWeightsFast except it uses far less memory at the cost of speed. Note that the scales must be in decreasing order.Given 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.0Each 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.  F      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ&Persistence-1.0-KLUBX9pVHGbDckTSVW7JzjSimplicialComplex PersistenceUtilMatrixGraph sc2StringgetDimmakeNbrhdGraphmakeCliqueComplexmakeVRComplexFastmakeVRComplexLight bettiNumbersbettiNumbersParBarCode Filtration sim2String filtr2String getComplexgetNumSimplices getDimensionfilterByWeightsFastmakeVRFiltrationFastfilterByWeightsLightmakeVRFiltrationLightpersistentHomologyxoronetwothrnot1not2not3flattenmuladdsubtr dotProduct extEucAlgdivides switchElems getCombos forallVec mapWithIndexparMapWithIndex elemAndIndexelemAndIndices findBothElemsbiFiltersortVecs parMapVecfilterWithIndexrange replaceElem quicksortbigU binarySearch|^| existsVec foldRelationelemIndexUnsafeevalPar $fNumBoolBMatrixIMatrix transposeMat transposeParmultiply multiplyPar getDiagonalgetUnsignedDiagonalrankBool kernelBool imgInKerBool