diff options
-rw-r--r-- | debian/changelog | 11 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 21 | ||||
-rw-r--r-- | debian/copyright | 33 | ||||
-rw-r--r-- | debian/patches/0001-Support-for-running-on-big-endian-architectures.patch | 102 | ||||
-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 | 29 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/watch | 3 |
13 files changed, 284 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..48c61ea --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +ripser (1.1-2) UNRELEASED; urgency=medium + + * Add patch to support running on big endian architectures. + + -- Gard Spreemann <gspr@nonempty.org> Mon, 02 Dec 2019 12:48:05 +0100 + +ripser (1.1-1) unstable; urgency=medium + + * Initial release. (Closes: #943817) + + -- Gard Spreemann <gspr@nonempty.org> Wed, 30 Oct 2019 16:19:29 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +12 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..9d129d2 --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: ripser +Section: math +Priority: optional +Maintainer: Gard Spreemann <gspr@nonempty.org> +Build-Depends: + debhelper (>= 12) +Standards-Version: 4.4.0 +Rules-Requires-Root: no +Homepage: http://ripser.org +Vcs-Browser: https://git.nonempty.org/debian-ripser +Vcs-Git: https://git.nonempty.org/debian-ripser -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..67f7327 --- /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-2019 Ulrich Bauer +License: MIT + +Files: debian/* +Copyright: 2019 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-Support-for-running-on-big-endian-architectures.patch b/debian/patches/0001-Support-for-running-on-big-endian-architectures.patch new file mode 100644 index 0000000..b759dad --- /dev/null +++ b/debian/patches/0001-Support-for-running-on-big-endian-architectures.patch @@ -0,0 +1,102 @@ +From: Gard Spreemann <gspr@nonempty.org> +Date: Mon, 2 Dec 2019 11:52:42 +0100 +Subject: Support for running on big endian architectures. + +--- + README.md | 3 ++- + ripser.cpp | 33 +++++++++++++++++++++++++-------- + 2 files changed, 27 insertions(+), 9 deletions(-) + +diff --git a/README.md b/README.md +index 2ce826f..ca98030 100644 +--- a/README.md ++++ b/README.md +@@ -62,6 +62,7 @@ Ripser supports several compile-time options. They are switched on by defining t + - `INDICATE_PROGRESS`: indicate the current progress in the console + - `PRINT_PERSISTENCE_PAIRS`: output the computed persistence pairs (enabled by default in the code; comment out to disable) + - `USE_GOOGLE_HASHMAP`: enable support for Google's [sparsehash] data structure; may further reduce memory footprint ++ - `BIGENDIAN`: build for running on a big endian architecture + + For example, to build Ripser with support for Google's hashmap: + +@@ -128,4 +129,4 @@ Ripser is licensed under the [MIT] license (`COPYING.txt`), with an extra clause + [Perseus]: <http://www.sas.upenn.edu/~vnanda/perseus/> + [GUDHI]: <http://gudhi.gforge.inria.fr> + [sparsehash]: <https://github.com/sparsehash/sparsehash> +-[MIT]: <https://opensource.org/licenses/mit-license.php> +\ No newline at end of file ++[MIT]: <https://opensource.org/licenses/mit-license.php> +diff --git a/ripser.cpp b/ripser.cpp +index 1ae62e1..f420f2a 100644 +--- a/ripser.cpp ++++ b/ripser.cpp +@@ -830,10 +830,27 @@ enum file_format { + BINARY + }; + +-template <typename T> T read(std::istream& input_stream) { ++template <typename T> inline void reverse_endianness(T& x) { ++ uint8_t* p = reinterpret_cast<uint8_t *>(&x); ++ std::reverse(p, p + sizeof(T)); ++} ++ ++template <typename T> T read_le(std::istream& input_stream) { ++ T result; ++ input_stream.read(reinterpret_cast<char*>(&result), sizeof(T)); ++ #ifdef BIGENDIAN ++ reverse_endianness(result); ++ #endif ++ return result; ++} ++ ++template <typename T> T read_be(std::istream& input_stream) { + T result; + input_stream.read(reinterpret_cast<char*>(&result), sizeof(T)); +- return result; // on little endian: boost::endian::little_to_native(result); ++ #ifndef BIGENDIAN ++ reverse_endianness(result); ++ #endif ++ return result; + } + + compressed_lower_distance_matrix read_point_cloud(std::istream& input_stream) { +@@ -929,33 +946,33 @@ compressed_lower_distance_matrix read_distance_matrix(std::istream& input_stream + } + + compressed_lower_distance_matrix read_dipha(std::istream& input_stream) { +- if (read<int64_t>(input_stream) != 8067171840) { ++ if (read_le<int64_t>(input_stream) != 8067171840) { + std::cerr << "input is not a Dipha file (magic number: 8067171840)" << std::endl; + exit(-1); + } + +- if (read<int64_t>(input_stream) != 7) { ++ if (read_le<int64_t>(input_stream) != 7) { + std::cerr << "input is not a Dipha distance matrix (file type: 7)" << std::endl; + exit(-1); + } + +- index_t n = read<int64_t>(input_stream); ++ index_t n = read_le<int64_t>(input_stream); + + std::vector<value_t> distances; + + for (int i = 0; i < n; ++i) + for (int j = 0; j < n; ++j) + if (i > j) +- distances.push_back(read<double>(input_stream)); ++ distances.push_back(read_le<double>(input_stream)); + else +- read<double>(input_stream); ++ read_le<double>(input_stream); + + return compressed_lower_distance_matrix(std::move(distances)); + } + + compressed_lower_distance_matrix read_binary(std::istream& input_stream) { + std::vector<value_t> distances; +- while (!input_stream.eof()) distances.push_back(read<value_t>(input_stream)); ++ while (!input_stream.eof()) distances.push_back(read_le<value_t>(input_stream)); + return compressed_lower_distance_matrix(std::move(distances)); + } + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..3b1501f --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Support-for-running-on-big-endian-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..f87a3b9 --- /dev/null +++ b/debian/rules @@ -0,0 +1,29 @@ +#!/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) + +ENDIANNESS:=$(shell dpkg-architecture -qDEB_TARGET_ARCH_ENDIAN) + +ifeq (big, $(ENDIANNESS)) + CPPFLAGS+=-DBIGENDIAN +endif + +%: + dh $@ + +override_dh_auto_configure: + mkdir -p build + +override_dh_auto_build: ripser ripser-coeff + +override_dh_auto_clean: + rm -rf build + +ripser: + c++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o build/ripser ripser.cpp + +ripser-coeff: + c++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -DUSE_COEFFICIENTS -o build/ripser-coeff ripser.cpp 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/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 |