Coder Social home page Coder Social logo

pseudomanifold / aleph Goto Github PK

View Code? Open in Web Editor NEW
98.0 8.0 17.0 1.74 MB

A library for exploring persistent homology

Home Page: https://pseudomanifold.github.io/Aleph/

License: MIT License

C++ 93.28% CMake 2.93% Python 3.56% Shell 0.08% Dockerfile 0.08% Hack 0.08%
persistent-homology topological-data-analysis c-plus-plus-11 persistence machine-learning

aleph's Introduction

Build Status CII Best Practices

Aleph logo

Aleph — A Library for Exploring Persistent Homology

Aleph is a C++ library for exploring and extending usages of persistent homology. Its main goal is to provide users with a versatile, simple-to-use implementation that quickly permits building prototype applications.

Aleph is inspired by DIPHA and PHAT. In particular, Aleph borrowed the idea of keeping the representation of a boundary matrix separate from the implementation.

For more information, please read the original paper describing PHAT.

Since its inception in late 2016, Aleph has been used to support the following papers:

Please refer to the list of publications in the documentation of Aleph for more details. The documentation covers how to reproduce a subset of the results reported in the papers above.

If you want to contribute, please see the contribution guidelines for more details.

Features

Aleph contains numerous algorithms and helper classes that simplify working with persistent homology. Here is a brief selection of the most important ones:

  • Easy-to-use and expressive simplex and simplicial complex class
  • Support for different input formats to read simplicial complexes from a variety of input files
    • 1D functions
    • Edge lists
    • GraphML
    • GML
    • HDF5
    • Lexicographic triangulations
    • Matrices
    • NET (Pajek graphs)
    • PLY
    • VTK
  • Standard algorithm and twisted reduction algorithm for calculating persistent homology
  • Support for dualized variants of both algorithms
  • Support for different boundary matrix representations
  • Persistence diagram class
  • Distance and kernel measures
    • Bottleneck distance
    • Multi-scale smoothing kernel
    • Wasserstein distance
  • Algorithms for computing intersection homology and persistent intersection homology
  • Basic support for Čech complexes
  • Support for Dowker complexes

Documentation

Documentation of the main features, including some tutorials, is available on GitHub. If you want to delve into the code, the examples subdirectory is a good starting point.

License

Aleph uses the MIT license. Please see the file LICENSE.md in the main directory of the repository for more details.

Requirements

  • A recent C++ compiler with support for C++11
  • CMake, preferably a recent version >= 3.2
  • Several Boost dependencies for some of the data structures:
    • Boost.Functional
    • Boost.Iterator
    • Boost.MultiIndex

Optional dependencies

  • Eigen3 for some auxiliary mathematical functions
  • FLANN for fast nearest-neighbour queries
  • HDF5 for parsing HDF5 input files
  • pybind11 for building the Python bindings
  • RapidJSON for parsing JSON input files
  • TinyXML2 for parsing GraphML input files

Building Aleph

Aleph is meant to be used as a header-only library on top of which you can develop your own projects based on persistent homology. However, Aleph ships with numerous unit tests, some example programs, and tools required for my current research. For building them, please clone the repository to some local directory on your computer. Running the following commands within this directory should be sufficient in most cases:

$ mkdir build
$ cd build
$ cmake ../
$ make

It is advisable to test that Aleph works correctly on your system, so you can run the unit tests with:

$ make test

Please submit any issues you may encounter.

For more information, including how to run tests, please refer to the detailed build instructions in the documentation.

Installing Aleph

If you want to install Aleph from source, simply issue

$ make install

from the compilation directory. In general, this will require root privileges, unless you change the CMAKE_INSTALL_PREFIX variable to a local directory.

It is easier to install Aleph as a package. Currently, only packages for Arch Linux are available. Use your favourite AUR helper tool for installing Aleph:

$ pacaur -S aleph-git # pacaur (deprecated)
$ trizen -S aleph-git # trizen
$ yaourt -S aleph-git # yaourt

If you want to volunteer and submit a package for your favourite Linux distribution, please take a look at issue #27 and add your comments.

Installing the Python bindings

If your build instructions are configured to build the Python bindings, i.e. BUILD_PYTHON_BINDINGS follow these instructions to install them:

$ cd build/bindings/python/aleph
$ python3 setup.py install

Note that this uses the old setuptools approach for installing the package. A simpler installation based on pip is forthcoming.

Contact & contributors

For general discussion, questions, and comments, please contact the principal developer and maintainer Bastian Rieck ([email protected]).

The following people have contributed code to Aleph:

  • ExpectationMax (Max Horn): fixes and improvements to the Python bindings
  • Filco306 (Filip Cornell): pybind11 documentation, Docker tutorial
  • macjohnny (Esteban Gehring): documentation updates
  • Pseudomanifold (Bastian Rieck): principal developer

aleph's People

Contributors

expectationmax avatar filco306 avatar macjohnny avatar pseudomanifold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aleph's Issues

Permit arbitrary indices for adjacency matrix creation

When converting a simplicial complex to an adjacency matrix for faster clique enumeration, I am assuming that vertex indices start at zero. This is not always the case and could easily be rectified by adding an additional map.

Not able to build due to error in test_spine.cc.o

Building from source from github is not working due to the error below:

make[2]: *** [tests/CMakeFiles/test_spine.dir/build.make:63: tests/CMakeFiles/test_spine.dir/test_spine.cc.o] Error 1

I have verified this on 3 different machines, using the standard make commands after cloning with git, or using the provided PKGBUILD / yay / packer / pacaur, etc.

Create PLY reader class

Similar to the reader class for edge lists, this reader should handle PLY files. This gives us the opportunity to specify arbitrary simplicial complex implementations that may be stored in there.

Provide package files for installations

Aleph is still missing package files that facilitate installing the library and its examples. It would be nice to have packages for some distributions. This issue shows the status of this endeavour.

Fix `CMakeLists.txt` for subordinate directories

Not quite sure whether the CMakeLists.txt need to contain specific INCLUDE_DIRECTORIES specifications. Also, they are lacking installation targets---this needs to be rectified before Aleph can make a release.

Can't import aleph as a package in python

Hello!

Thank you for this nice repository. I cannot however seem to get it to work.

I have done the following.

$ mkdir build
$ cd build
$ cmake ../
$ make
$ make test # Passes all tests

$ cd build/bindings/python/aleph
$ python3 setup.py install

However, starting python, it does not seem to work.

$ python3
Python 3.8.5 (default, Jul 21 2020, 10:48:26) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import aleph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../venv/lib/python3.8/site-packages/aleph/__init__.py", line 1, in <module>
    from .aleph import *
ModuleNotFoundError: No module named 'aleph.aleph'

Running ccmake . in the build/ dir gives me:

 BUILD_EXAMPLES                   ON                                                                                                                                                                                                         
 BUILD_PYTHON_BINDINGS            ON                                                                                                                                                                                                         
 BUILD_TOOLS                      ON                                                                                                                                                                                                         
 Boost_INCLUDE_DIR                /usr/local/include                                                                                                                                                                                         
 CMAKE_BUILD_TYPE                                                                                                                                                                                                                            
 CMAKE_EXECUTABLE_FORMAT          MACHO                                                                                                                                                                                                      
 CMAKE_INSTALL_PREFIX             /usr/local                                                                                                                                                                                                 
 CMAKE_OSX_ARCHITECTURES                                                                                                                                                                                                                     
 CMAKE_OSX_DEPLOYMENT_TARGET                                                                                                                                                                                                                 
 CMAKE_OSX_SYSROOT                /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk                                                                                                                                                   
 FLANN_DIR                                                                                                                                                                                                                                   
 FLANN_INCLUDE_DIR                FLANN_INCLUDE_DIR-NOTFOUND                                                                                                                                                                                 
 FLANN_LIBRARY                    FLANN_LIBRARY-NOTFOUND                                                                                                                                                                                     
 HDF5_DIR                         HDF5_DIR-NOTFOUND                                                                                                                                                                                          
 PYBIND11_DIR                                                                                                                                                                                                                                
 PYBIND11_INCLUDE_DIR             PYBIND11_INCLUDE_DIR-NOTFOUND                                                                                                                                                                              
 tinyxml2_DIR                     tinyxml2_DIR-NOTFOUND 

Would you perhaps know what the problem is? I suspect it has something to do with PYBIND11, but I can't seem to get it to work. I have pybind11 installed.

Thank you in advance! 😄

Best,

Fix torus rejection sampling

The rejection sampling procedure should yield exactly the desired number of points. Currently, it performs early stopping. This does not follow the principle of least surprise.

Building python binding with g++-4.8 results in undefined symbols

Compiling the python binding with g++-4.8 successfully links, yet results in an unusable binary with undefined symbols.

Compiling with g++-6 works fine though.

Error when loading:

>>> import aleph as al
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/hornm/Projects/DeepTDA/Aleph/build/bindings/python/aleph/aleph.so: undefined symbol: _ZNSt20regex_token_iteratorIN9__gnu_cxx17__normal_iteratorIPKcSsEEcSt12regex_traitsIcEEC1ES4_S4_RKSt11basic_regexIcS6_EiSt6bitsetILm11EE
Output CMake

-- The CXX compiler identification is GNU 4.8.4
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- CMAKE_ROOT:           /usr/share/cmake-2.8
-- CMAKE_SYSTEM_VERSION: 3.13.0-133-generic
-- Performing Test ALEPH_HAVE_FLAG_Wall
-- Performing Test ALEPH_HAVE_FLAG_Wall - Success
-- Performing Test ALEPH_HAVE_FLAG_Wconversion
-- Performing Test ALEPH_HAVE_FLAG_Wconversion - Success
-- Performing Test ALEPH_HAVE_FLAG_Wextra
-- Performing Test ALEPH_HAVE_FLAG_Wextra - Success
-- Performing Test ALEPH_HAVE_FLAG_Wnon-virtual-dtor
-- Performing Test ALEPH_HAVE_FLAG_Wnon-virtual-dtor - Success
-- Performing Test ALEPH_HAVE_FLAG_Wold-style-cast
-- Performing Test ALEPH_HAVE_FLAG_Wold-style-cast - Success
-- Performing Test ALEPH_HAVE_FLAG_Woverloaded-virtual
-- Performing Test ALEPH_HAVE_FLAG_Woverloaded-virtual - Success
-- Performing Test ALEPH_HAVE_FLAG_Wself-init
-- Performing Test ALEPH_HAVE_FLAG_Wself-init - Failed
-- Performing Test ALEPH_HAVE_FLAG_Wunsafe-loop-optimization
-- Performing Test ALEPH_HAVE_FLAG_Wunsafe-loop-optimization - Failed
-- Performing Test ALEPH_HAVE_FLAG_pedantic
-- Performing Test ALEPH_HAVE_FLAG_pedantic - Success
-- Boost version: 1.67.0
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
-- Could NOT find FLANN (missing:  FLANN_INCLUDE_DIR FLANN_LIBRARY)
-- Found HDF5: HDF5_hdf5_cpp_LIBRARY-NOTFOUND;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so
CMake Warning at CMakeLists.txt:116 (MESSAGE):
  One of the required HDF5 C++ libraries was not found

  but the module returned HDF5_FOUND.  This indicates a broken installation.


-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- checking for one of the modules 'RapidJSON'
-- checking for one of the modules 'eigen3'
-- Found PythonInterp: /local0/software/python/python3_bleeding_edge/bin/python3 (found suitable version "3.6.4", minimum required is "3")
-- Found PythonLibs: /local0/software/python/python3_bleeding_edge/lib (found suitable version "3.6.4", minimum required is "3")
CMake Warning at CMakeLists.txt:150 (FIND_PACKAGE):
  By not providing "Findtinyxml2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "tinyxml2",
  but CMake did not find one.

  Could not find a package configuration file provided by "tinyxml2" with any
  of the following names:

    tinyxml2Config.cmake
    tinyxml2-config.cmake

  Add the installation prefix of "tinyxml2" to CMAKE_PREFIX_PATH or set
  "tinyxml2_DIR" to a directory containing one of the above files.  If
  "tinyxml2" provides a separate development package or SDK, be sure it has
  been installed.


-- Found PYBIND11: X/pybind11/include
-- Building tools
-- Performing Test ALEPH_HAVE_FLAG_O3
-- Performing Test ALEPH_HAVE_FLAG_O3 - Success
-- Building examples
-- Performing Test ALEPH_HAVE_FLAG_Og
-- Performing Test ALEPH_HAVE_FLAG_Og - Success
-- Performing Test ALEPH_HAVE_FLAG_g
-- Performing Test ALEPH_HAVE_FLAG_g - Success
-- Performing Test ALEPH_HAVE_FLAG_Werror
-- Performing Test ALEPH_HAVE_FLAG_Werror - Success
-- Configuring done
-- Generating done
-- Build files have been written to: X/Aleph/build
Output of ldd and objdump

aleph[0]> ldd aleph.so
        linux-vdso.so.1 =>  (0x00007ffd5acca000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f558b32f000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f558b029000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f558ae12000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f558aa49000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f558bbbc000)

aleph[0]> objdump -p aleph.so

aleph.so:     file format elf64-x86-64

Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**21
         filesz 0x000000000036654b memsz 0x000000000036654b flags r-x
    LOAD off    0x0000000000366d48 vaddr 0x0000000000566d48 paddr 0x0000000000566d48 align 2**21
         filesz 0x0000000000012428 memsz 0x00000000000125c0 flags rw-
 DYNAMIC off    0x00000000003688f0 vaddr 0x00000000005688f0 paddr 0x00000000005688f0 align 2**3
         filesz 0x0000000000000200 memsz 0x0000000000000200 flags rw-
    NOTE off    0x00000000000001c8 vaddr 0x00000000000001c8 paddr 0x00000000000001c8 align 2**2
         filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
EH_FRAME off    0x00000000002e98a8 vaddr 0x00000000002e98a8 paddr 0x00000000002e98a8 align 2**2
         filesz 0x00000000000166a4 memsz 0x00000000000166a4 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000366d48 vaddr 0x0000000000566d48 paddr 0x0000000000566d48 align 2**0
         filesz 0x00000000000022b8 memsz 0x00000000000022b8 flags r--

Dynamic Section:
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  SONAME               aleph.so
  INIT                 0x00000000001d0fe0
  FINI                 0x00000000002e5820
  INIT_ARRAY           0x0000000000566d48
  INIT_ARRAYSZ         0x0000000000000010
  FINI_ARRAY           0x0000000000566d58
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x00000000000001f0
  STRTAB               0x0000000000056a28
  SYMTAB               0x0000000000014cb0
  STRSZ                0x00000000001409e4
  SYMENT               0x0000000000000018
  PLTGOT               0x0000000000569000
  PLTRELSZ             0x0000000000030180
  PLTREL               0x0000000000000007
  JMPREL               0x00000000001a0e60
  RELA                 0x000000000019cd08
  RELASZ               0x0000000000004158
  RELAENT              0x0000000000000018
  VERNEED              0x000000000019cbd8
  VERNEEDNUM           0x0000000000000004
  VERSYM               0x000000000019740c
  RELACOUNT            0x0000000000000080

Version References:
  required from libgcc_s.so.1:
    0x0b792650 0x00 16 GCC_3.0
  required from libm.so.6:
    0x09691a75 0x00 12 GLIBC_2.2.5
  required from libc.so.6:
    0x0d696914 0x00 14 GLIBC_2.4
    0x06969194 0x00 13 GLIBC_2.14
    0x09691a75 0x00 04 GLIBC_2.2.5
  required from libstdc++.so.6:
    0x0297f861 0x00 15 GLIBCXX_3.4.11
    0x0297f868 0x00 11 GLIBCXX_3.4.18
    0x02297f85 0x00 10 GLIBCXX_3.4.5
    0x0297f863 0x00 09 GLIBCXX_3.4.13
    0x0297f864 0x00 08 GLIBCXX_3.4.14
    0x0bafd173 0x00 07 CXXABI_1.3.3
    0x0bafd175 0x00 06 CXXABI_1.3.5
    0x0297f865 0x00 05 GLIBCXX_3.4.15
    0x056bafd3 0x00 03 CXXABI_1.3
    0x08922974 0x00 02 GLIBCXX_3.4

Fix HDF5 usage (make optional/configurable)

It makes sense to keep HDF5 configurable for users because they do not necessarily want to use the library just for obtaining a corresponding simplicial complex reader.

Ideally, we should do the following:

  • Check for HDF5
  • Set a provisional HDF5_FOUND variable
  • Make it configurable by users

Alternatively, we could try to detect proper installations by attempting to compile a snippet. It might be possible to use CHECK_CXX_SOURCE_COMPILES for this purpose.

ping

submanifold was a cool github identifier.

Rename `complexes` to `geometry`

This also pertains to the namespaces, of course. The geometry assignment makes more sense, I guess, because it refers to how these complexes are being generated.

Check correctness of face insertion for simplicial complexes

The simplicial complex class automatically inserts faces of the simplices in order to retain validity. Maybe this is not the smartest move because one might want to check in a partial list of simplices without creating their faces.

Need to check at which points this may cause a problem.

Force conversion of simplicial complex for Vietoris--Rips expansion

It should be possible to specified a dedicated data type for the output of the simplicial complex that arises from Vietoris--Rips expansion. At present, the output type is automatically determined from the
nearest neighbour wrapper, but it should be possible to perform a conversion after the expansion by employing a similar interface.

Fix namespace for distance functors

Distance functors are part of the wrong namespace. They should be in aleph::geometry::distances, as indicated by the folder structure, but they are actually in aleph::distances. This needs to be changed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.