2022-05-18 14:49:53 +00:00
|
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, useCoefficients ? false
|
|
|
|
|
, indicateProgress ? false
|
|
|
|
|
, useGoogleHashmap ? false, sparsehash ? null
|
|
|
|
|
, fileFormat ? "lowerTriangularCsv"
|
|
|
|
|
}:
|
|
|
|
|
|
2021-01-17 00:15:33 +00:00
|
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
assert assertOneOf "fileFormat" fileFormat
|
|
|
|
|
["lowerTriangularCsv" "upperTriangularCsv" "dipha"];
|
|
|
|
|
assert useGoogleHashmap -> sparsehash != null;
|
|
|
|
|
|
|
|
|
|
let
|
2021-01-17 00:15:33 +00:00
|
|
|
|
inherit (lib) optional;
|
2022-05-18 14:49:53 +00:00
|
|
|
|
version = "1.2.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
in
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
pname = "ripser";
|
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "Ripser";
|
|
|
|
|
repo = "ripser";
|
2022-05-18 14:49:53 +00:00
|
|
|
|
rev = "v${version}";
|
|
|
|
|
sha256 = "sha256-BxmkPQ/nl5cF+xwQMTjXnLgkLgdmT/39y7Kzl2wDfpE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
buildInputs = optional useGoogleHashmap sparsehash;
|
|
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
|
"-std=c++11"
|
2022-05-18 14:49:53 +00:00
|
|
|
|
"-O3"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"-D NDEBUG"
|
|
|
|
|
]
|
|
|
|
|
++ optional useCoefficients "-D USE_COEFFICIENTS"
|
|
|
|
|
++ optional indicateProgress "-D INDICATE_PROGRESS"
|
|
|
|
|
++ optional useGoogleHashmap "-D USE_GOOGLE_HASHMAP"
|
|
|
|
|
++ optional (fileFormat == "lowerTriangularCsv") "-D FILE_FORMAT_LOWER_TRIANGULAR_CSV"
|
|
|
|
|
++ optional (fileFormat == "upperTriangularCsv") "-D FILE_FORMAT_UPPER_TRIANGULAR_CSV"
|
|
|
|
|
++ optional (fileFormat == "dipha") "-D FILE_FORMAT_DIPHA"
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
buildPhase = "c++ ripser.cpp -o ripser $buildFlags";
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
cp ripser $out/bin
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
|
description = "A lean C++ code for the computation of Vietoris–Rips persistence barcodes";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
mainProgram = "ripser";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
homepage = "https://github.com/Ripser/ripser";
|
2021-01-17 00:15:33 +00:00
|
|
|
|
license = lib.licenses.lgpl3;
|
|
|
|
|
maintainers = with lib.maintainers; [erikryb];
|
|
|
|
|
platforms = lib.platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
}
|