diff options
-rw-r--r-- | debian/changelog | 22 | ||||
-rw-r--r-- | debian/control | 21 | ||||
-rw-r--r-- | debian/copyright | 33 | ||||
-rw-r--r-- | debian/patches/0001-Prevent-overflow-on-32-bit-architectures.patch | 21 | ||||
-rw-r--r-- | debian/patches/series | 1 | ||||
-rw-r--r-- | debian/ripser-coeff.1 | 42 | ||||
-rw-r--r-- | debian/ripser.1 | 37 | ||||
-rw-r--r-- | debian/ripser.install | 1 | ||||
-rw-r--r-- | debian/ripser.manpages | 2 | ||||
-rwxr-xr-x | debian/rules | 19 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/tests/control | 2 | ||||
-rwxr-xr-x | debian/tests/examples.py | 76 | ||||
-rw-r--r-- | debian/tests/reference/projective_plane.csv.txt | 20 | ||||
-rw-r--r-- | debian/tests/reference/projective_plane.dipha.txt | 20 | ||||
-rw-r--r-- | debian/tests/reference/projective_plane.lower_distance_matrix.txt | 20 | ||||
-rw-r--r-- | debian/tests/reference/sphere_3_192.lower_distance_matrix.txt | 251 | ||||
-rw-r--r-- | debian/upstream/metadata | 9 | ||||
-rw-r--r-- | debian/watch | 3 |
19 files changed, 601 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..871ca5a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,22 @@ +ripser (1.1.20200206.286d36-3) unstable; urgency=medium + + * Add upstream/metadafile file. + * Standards-version 4.5.1. No changes needed. + * DH compat 13. + * Move git to Salsa. + + -- Gard Spreemann <gspr@nonempty.org> Sat, 23 Jan 2021 18:37:46 +0100 + +ripser (1.1.20200206.286d36-2) unstable; urgency=medium + + * Add patch to prevent overflow on 32 bit architectures. + * Standards-version 4.5.0. No changes needed. + * Add tests. + + -- Gard Spreemann <gspr@nonempty.org> Mon, 09 Mar 2020 11:16:50 +0100 + +ripser (1.1.20200206.286d36-1) unstable; urgency=medium + + * Initial release. (Closes: #943817) + + -- Gard Spreemann <gspr@nonempty.org> Thu, 06 Feb 2020 11:16:53 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..9333691 --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: ripser +Section: math +Priority: optional +Maintainer: Gard Spreemann <gspr@nonempty.org> +Build-Depends: + debhelper-compat (= 13) +Standards-Version: 4.5.1 +Rules-Requires-Root: no +Homepage: http://ripser.org +Vcs-Browser: https://salsa.debian.org/gspr/ripser +Vcs-Git: https://salsa.debian.org/gspr/ripser.git -b debian/sid + +Package: ripser +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Fast computation of persistent homology of flag complexes + Ripser computes persistent homology of flag complexes (such as + Vietoris-Rips complexes) only, allowing significant gains in + computation time and memory usage over the general situation. + . + See https://arxiv.org/abs/1908.02518. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..6a73fe7 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,33 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ripser +Source: http://ripser.org +License: MIT + +Files: * +Copyright: 2015-2021 Ulrich Bauer +License: MIT + +Files: debian/* +Copyright: 2020-2021 Gard Spreemann <gspr@nonempty.org> +License: MIT + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/debian/patches/0001-Prevent-overflow-on-32-bit-architectures.patch b/debian/patches/0001-Prevent-overflow-on-32-bit-architectures.patch new file mode 100644 index 0000000..01142f6 --- /dev/null +++ b/debian/patches/0001-Prevent-overflow-on-32-bit-architectures.patch @@ -0,0 +1,21 @@ +From: Gard Spreemann <gspr@nonempty.org> +Date: Sun, 8 Mar 2020 15:14:54 +0100 +Subject: Prevent overflow on 32 bit architectures. + +--- + ripser.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ripser.cpp b/ripser.cpp +index cd546e8..79e5c89 100644 +--- a/ripser.cpp ++++ b/ripser.cpp +@@ -80,7 +80,7 @@ static const std::string clear_line("\r\033[K"); + static const size_t num_coefficient_bits = 8; + + static const index_t max_simplex_index = +- (1l << (8 * sizeof(index_t) - 1 - num_coefficient_bits)) - 1; ++ ((index_t)1 << (8 * sizeof(index_t) - 1 - num_coefficient_bits)) - 1; + + void check_overflow(index_t i) { + if diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..99f050b --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Prevent-overflow-on-32-bit-architectures.patch diff --git a/debian/ripser-coeff.1 b/debian/ripser-coeff.1 new file mode 100644 index 0000000..3d94831 --- /dev/null +++ b/debian/ripser-coeff.1 @@ -0,0 +1,42 @@ +.TH RIPSER-COEFF 1 +.SH NAME +ripser-coeff \- fast computation of persistent homology of flag complexes +.SH SYNOPSIS +.B ripser-coeff +[\fB\-\-help\fR] +[\fB\-\-format\fR \fIformat\fR] +[\fB\-\-dim \fIk\fR] +[\fB\-\-threshold \fIt\fR] +[\fB\-\-ratio \fIr\fR] +[\fB\-\-modulus \fIp\fR] +[\fIfilename\fR] +.SH DESCRIPTION +.B ripser-coeff +computes persistent homology of flag complexes (such as Vietoris-Rips +complexes) only, allowing significant gains in computation time and +memory usage over the general situation. Unlike \fBripser\fR, it +computes over an arbitrary finite field. + +See https://arxiv.org/abs/1908.02518 for details. +.SH OPTIONS +.TP +\fB\-\-help\fR +Display help. +.TP +\fB\-\-format\fR \fIformat\fR +Specify input format. See \fB\-\-help\fR for a full list. +.TP +\fB\-\-dim \fIk\fR +Compute persistent homology up to dimension \fIk\fR. +.TP +\fB\-\-threshold \fIt\fR +Compute Rips complexes up to diameter \fIt\fR. +.TP +\fB\-\-ratio \fIr\fR +Only show persistence pairs with death/birth ratio > \fIr\fR. +.TP +\fB\-\-modulus \fIp\fR +Compute homology with coefficients in the prime field Z/\fIp\fRZ. +.TP +\fIfilename\fR +Read input from this file. Uses stdin if not present. diff --git a/debian/ripser.1 b/debian/ripser.1 new file mode 100644 index 0000000..9caafee --- /dev/null +++ b/debian/ripser.1 @@ -0,0 +1,37 @@ +.TH RIPSER 1 +.SH NAME +ripser \- fast computation of persistent homology of flag complexes +.SH SYNOPSIS +.B ripser +[\fB\-\-help\fR] +[\fB\-\-format\fR \fIformat\fR] +[\fB\-\-dim \fIk\fR] +[\fB\-\-threshold \fIt\fR] +[\fB\-\-ratio \fIr\fR] +[\fIfilename\fR] +.SH DESCRIPTION +.B ripser +computes persistent homology of flag complexes (such as Vietoris-Rips +complexes) only, allowing significant gains in computation time and +memory usage over the general situation. + +See https://arxiv.org/abs/1908.02518 for details. +.SH OPTIONS +.TP +\fB\-\-help\fR +Display help. +.TP +\fB\-\-format\fR \fIformat\fR +Specify input format. See \fB\-\-help\fR for a full list. +.TP +\fB\-\-dim \fIk\fR +Compute persistent homology up to dimension \fIk\fR. +.TP +\fB\-\-threshold \fIt\fR +Compute Rips complexes up to diameter \fIt\fR. +.TP +\fB\-\-ratio \fIr\fR +Only show persistence pairs with death/birth ratio > \fIr\fR. +.TP +\fIfilename\fR +Read input from this file. Uses stdin if not present. diff --git a/debian/ripser.install b/debian/ripser.install new file mode 100644 index 0000000..8dd1c67 --- /dev/null +++ b/debian/ripser.install @@ -0,0 +1 @@ +build/* usr/bin/ diff --git a/debian/ripser.manpages b/debian/ripser.manpages new file mode 100644 index 0000000..6c82f0f --- /dev/null +++ b/debian/ripser.manpages @@ -0,0 +1,2 @@ +debian/ripser.1 +debian/ripser-coeff.1 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..f7ab00f --- /dev/null +++ b/debian/rules @@ -0,0 +1,19 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) +CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) +LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) + +%: + dh $@ + +override_dh_auto_configure: + mkdir -p build + +override_dh_auto_build: + c++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o build/ripser ripser.cpp + c++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -DUSE_COEFFICIENTS -o build/ripser-coeff ripser.cpp + +override_dh_auto_clean: + rm -rf build diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..a948b2f --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,2 @@ +Tests: examples.py +Depends: python3, python3-numpy, ripser diff --git a/debian/tests/examples.py b/debian/tests/examples.py new file mode 100755 index 0000000..a5a4836 --- /dev/null +++ b/debian/tests/examples.py @@ -0,0 +1,76 @@ +#!/usr/bin/python3 + +import numpy as np +import subprocess + +def parse_output(s): + ret = [] + current_dim = None + for line in s.splitlines(): + if line.startswith("persistence intervals in dim"): + splitline = line.rstrip().rstrip(":").split(" ") + assert(len(splitline) == 5) + current_dim = int(splitline[-1]) + while len(ret) < current_dim + 1: + ret.append(([], [])) + elif line.startswith(" ["): + splitline = line.lstrip(" [").rstrip().rstrip(")").split(",") + assert(len(splitline) == 2) + if splitline[1].strip() == "": + ret[current_dim][1].append(float(splitline[0])) + else: + ret[current_dim][0].append((float(splitline[0]), float(splitline[1]))) + + return ret + +def main(): + tests = [(None, "lower-distance", 2, "sphere_3_192.lower_distance_matrix"), + (None, "distance", 2, "projective_plane.csv"), + (None, "dipha", 2, "projective_plane.dipha"), + (None, "lower-distance", 2, "projective_plane.lower_distance_matrix"), + (2, "lower-distance", 2, "sphere_3_192.lower_distance_matrix"), + (2, "distance", 2, "projective_plane.csv"), + (2, "dipha", 2, "projective_plane.dipha"), + (2, "lower-distance", 2, "projective_plane.lower_distance_matrix")] + + for (coeff, format, dim, prefix) in tests: + if coeff is None: + print("Running test %s." %(prefix)) + proc = subprocess.Popen(["/usr/bin/ripser", "--dim", str(dim), "--format", format, "examples/%s" %(prefix)], stdout=subprocess.PIPE) + else: + print("Running test %s with coefficients in Z/%dZ." %(prefix, coeff)) + proc = subprocess.Popen(["/usr/bin/ripser-coeff", "--modulus", str(coeff), "--dim", str(dim), "--format", format, "examples/%s" %(prefix)], stdout=subprocess.PIPE) + + output = proc.communicate()[0].decode("utf-8") + assert(proc.returncode == 0) + pd = parse_output(output) + + with open("debian/tests/reference/%s.txt" %(prefix), "r") as f: + pd_ref = parse_output(f.read()) + + assert(len(pd) == len(pd_ref)) + + for d in range(0, len(pd)): + fin = np.array(sorted(pd[d][0])) + inf = np.array(sorted(pd[d][1])) + print("Finite bars in dimension %d:" %(d)) + print(fin) + print("Infinite bars in dimension %d:" %(d)) + print(inf) + + fin_ref = np.array(sorted(pd_ref[d][0])) + inf_ref = np.array(sorted(pd_ref[d][1])) + + assert(fin.shape == fin_ref.shape) + assert(inf.shape == inf_ref.shape) + + np.testing.assert_allclose(fin, fin_ref) + np.testing.assert_allclose(inf, inf_ref) + + print("------") + + print("-------------------------------------------------") + + +if __name__ == "__main__": + main() diff --git a/debian/tests/reference/projective_plane.csv.txt b/debian/tests/reference/projective_plane.csv.txt new file mode 100644 index 0000000..c135026 --- /dev/null +++ b/debian/tests/reference/projective_plane.csv.txt @@ -0,0 +1,20 @@ +value range: [1,2] +distance matrix with 13 points +persistence intervals in dim 0: + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0, ) +persistence intervals in dim 1: + [1,2) +persistence intervals in dim 2: + [1,2) diff --git a/debian/tests/reference/projective_plane.dipha.txt b/debian/tests/reference/projective_plane.dipha.txt new file mode 100644 index 0000000..c135026 --- /dev/null +++ b/debian/tests/reference/projective_plane.dipha.txt @@ -0,0 +1,20 @@ +value range: [1,2] +distance matrix with 13 points +persistence intervals in dim 0: + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0, ) +persistence intervals in dim 1: + [1,2) +persistence intervals in dim 2: + [1,2) diff --git a/debian/tests/reference/projective_plane.lower_distance_matrix.txt b/debian/tests/reference/projective_plane.lower_distance_matrix.txt new file mode 100644 index 0000000..c135026 --- /dev/null +++ b/debian/tests/reference/projective_plane.lower_distance_matrix.txt @@ -0,0 +1,20 @@ +value range: [1,2] +distance matrix with 13 points +persistence intervals in dim 0: + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0,1) + [0, ) +persistence intervals in dim 1: + [1,2) +persistence intervals in dim 2: + [1,2) diff --git a/debian/tests/reference/sphere_3_192.lower_distance_matrix.txt b/debian/tests/reference/sphere_3_192.lower_distance_matrix.txt new file mode 100644 index 0000000..71f9b72 --- /dev/null +++ b/debian/tests/reference/sphere_3_192.lower_distance_matrix.txt @@ -0,0 +1,251 @@ +value range: [0.00367531,2] +sparse distance matrix with 192 points and 17857/18431 entries +persistence intervals in dim 0: + [0,0.00391946) + [0,0.00367531) + [0,0.0120098) + [0,0.0173134) + [0,0.0217315) + [0,0.0311057) + [0,0.037954) + [0,0.0387451) + [0,0.0433426) + [0,0.0471186) + [0,0.0487061) + [0,0.048826) + [0,0.0496187) + [0,0.0515157) + [0,0.0522132) + [0,0.0559886) + [0,0.0560443) + [0,0.057488) + [0,0.0593071) + [0,0.0623736) + [0,0.0633425) + [0,0.0637053) + [0,0.0651112) + [0,0.0672609) + [0,0.0692368) + [0,0.0702075) + [0,0.0714516) + [0,0.0728647) + [0,0.0741239) + [0,0.0743236) + [0,0.0746054) + [0,0.0753955) + [0,0.076909) + [0,0.0782455) + [0,0.0792212) + [0,0.0800348) + [0,0.0802451) + [0,0.0814685) + [0,0.0831358) + [0,0.0831521) + [0,0.084341) + [0,0.0857401) + [0,0.0870489) + [0,0.0884133) + [0,0.0959033) + [0,0.0970981) + [0,0.0988752) + [0,0.0994522) + [0,0.108768) + [0,0.109526) + [0,0.111131) + [0,0.111798) + [0,0.115939) + [0,0.119187) + [0,0.121955) + [0,0.122089) + [0,0.123527) + [0,0.124774) + [0,0.126595) + [0,0.127383) + [0,0.127864) + [0,0.129741) + [0,0.131438) + [0,0.131638) + [0,0.133033) + [0,0.133525) + [0,0.133722) + [0,0.134886) + [0,0.135402) + [0,0.138674) + [0,0.141823) + [0,0.142152) + [0,0.142537) + [0,0.142834) + [0,0.143085) + [0,0.143151) + [0,0.145018) + [0,0.145725) + [0,0.147203) + [0,0.147289) + [0,0.147427) + [0,0.148506) + [0,0.149017) + [0,0.149226) + [0,0.150747) + [0,0.151643) + [0,0.15244) + [0,0.154095) + [0,0.15587) + [0,0.1569) + [0,0.157251) + [0,0.157293) + [0,0.157373) + [0,0.158413) + [0,0.159282) + [0,0.162464) + [0,0.164809) + [0,0.164815) + [0,0.165202) + [0,0.165314) + [0,0.165494) + [0,0.165592) + [0,0.165907) + [0,0.167455) + [0,0.168587) + [0,0.173412) + [0,0.173586) + [0,0.173684) + [0,0.174172) + [0,0.17493) + [0,0.175016) + [0,0.176306) + [0,0.179609) + [0,0.18428) + [0,0.184757) + [0,0.189106) + [0,0.190642) + [0,0.191661) + [0,0.192356) + [0,0.192406) + [0,0.192733) + [0,0.193791) + [0,0.193804) + [0,0.195722) + [0,0.197377) + [0,0.199673) + [0,0.201961) + [0,0.202564) + [0,0.203812) + [0,0.204208) + [0,0.204544) + [0,0.205389) + [0,0.207016) + [0,0.207261) + [0,0.207714) + [0,0.208063) + [0,0.208851) + [0,0.210372) + [0,0.214018) + [0,0.215759) + [0,0.218526) + [0,0.218561) + [0,0.223232) + [0,0.227524) + [0,0.227933) + [0,0.2286) + [0,0.228917) + [0,0.231179) + [0,0.231675) + [0,0.234112) + [0,0.234969) + [0,0.237571) + [0,0.23879) + [0,0.240632) + [0,0.24348) + [0,0.24509) + [0,0.246491) + [0,0.247042) + [0,0.248879) + [0,0.249339) + [0,0.249345) + [0,0.253163) + [0,0.253227) + [0,0.25725) + [0,0.257997) + [0,0.264334) + [0,0.264483) + [0,0.266592) + [0,0.266635) + [0,0.268806) + [0,0.270996) + [0,0.274611) + [0,0.276431) + [0,0.277191) + [0,0.277582) + [0,0.280629) + [0,0.282169) + [0,0.283562) + [0,0.283881) + [0,0.285416) + [0,0.287316) + [0,0.288591) + [0,0.289189) + [0,0.293466) + [0,0.297053) + [0,0.297933) + [0,0.304062) + [0,0.316023) + [0,0.319493) + [0,0.323964) + [0,0.332695) + [0, ) +persistence intervals in dim 1: + [0.542696,0.558863) + [0.531636,0.578093) + [0.530723,0.576869) + [0.463389,0.505345) + [0.445398,0.448892) + [0.443911,0.54761) + [0.431628,0.477277) + [0.413789,0.487379) + [0.412572,0.46308) + [0.411549,0.471715) + [0.409968,0.478461) + [0.386278,0.4922) + [0.381084,0.421374) + [0.377729,0.514046) + [0.377147,0.414788) + [0.377019,0.434385) + [0.374531,0.477153) + [0.370051,0.483155) + [0.361715,0.403181) + [0.354747,0.454956) + [0.352356,0.541947) + [0.350913,0.369543) + [0.35058,0.580726) + [0.347806,0.638039) + [0.347388,0.559978) + [0.344005,0.387193) + [0.34298,0.65758) + [0.339394,0.463666) + [0.33836,0.350411) + [0.33392,0.35111) + [0.33364,0.3797) + [0.331259,0.356381) + [0.329066,0.386148) + [0.324571,0.343083) + [0.324159,0.399094) + [0.322683,0.482958) + [0.318032,0.417462) + [0.317521,0.349622) + [0.316534,0.682559) + [0.309419,0.37151) + [0.309336,0.310216) + [0.308779,0.346297) + [0.304761,0.647803) + [0.301986,0.478334) + [0.301045,0.303943) + [0.29997,0.311993) + [0.298341,0.360737) + [0.279016,0.301331) + [0.2576,0.373749) + [0.253337,0.292286) + [0.24546,0.248903) + [0.240869,0.288747) + [0.189652,0.197515) +persistence intervals in dim 2: + [0.720484,1.65562) diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..f809cf4 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,9 @@ +Bug-Database: https://github.com/Ripser/ripser/issues +Bug-Submit: https://github.com/Ripser/ripser/issues/new +Repository: https://github.com/Ripser/ripser.git +Repository-Browse: https://github.com/Ripser/ripser +Reference: + Title: "Ripser: efficient computation of Vietoris-Rips persistence barcodes" + Author: Ulrich Bauer + Eprint: 1908.02518 + Year: 2019 diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..be95e49 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/ripser-$1\.tar\.gz/,uversionmangle=s/-?(RC|rc)/~rc/ \ + https://github.com/Ripser/ripser/releases .*/archive/v(\d\S+)\.tar\.gz
\ No newline at end of file |