Giter Site home page Giter Site logo

scikit-tda / ripser.py Goto Github PK

View Code? Open in Web Editor NEW
260.0 15.0 60.0 20.33 MB

A Lean Persistent Homology Library for Python

Home Page: http://ripser.scikit-tda.org

License: Other

C++ 43.55% Python 38.70% C 0.46% TeX 15.59% Cython 1.70%
topological-data-analysis persistent-homology homology topology tda data-science ripser

ripser.py's Introduction

DOI PyPI - Version PyPI - Downloads

Scikit-TDA is a home for Topological Data Analysis Python libraries intended for non-topologists.

This project aims to provide a curated library of TDA Python tools that are widely usable and easily approachable. It is structured so that each package can stand alone or be used as part of the scikit-tda bundle.

Documentation

For complete documentation please checkout docs.scikit-tda.org.

Contact

If you would like to contribute, please reach out to us on github by starting a discussion topic, creating an issue, or reaching out on twitter.

Setup

To install all these libraries

    pip install scikit-tda

Citations

If you would like to cite Scikit-TDA, please use the following citation/bibtex

Saul, Nathaniel and Tralie, Chris. (2019). Scikit-TDA: Topological Data Analysis for Python. Zenodo. http://doi.org/10.5281/zenodo.2533369

@misc{scikittda2019,
  author       = {Nathaniel Saul, Chris Tralie},
  title        = {Scikit-TDA: Topological Data Analysis for Python},
  year         = 2019,
  doi          = {10.5281/zenodo.2533369},
  url          = {https://doi.org/10.5281/zenodo.2533369}
}

License

This package is licensed with the MIT license.

Contributing

Contributions are more than welcome! There are lots of opportunities for potential projects, so please get in touch if you would like to help out. Everything from code to notebooks to examples and documentation are all equally valuable so please don't feel you can't contribute. To contribute please fork the project make your changes and submit a pull request. We will do our best to work through any issues with you and get your code merged into the main branch.

ripser.py's People

Contributors

arfon avatar bdice avatar blasern avatar brandmeredith avatar catanzaromj avatar ctralie avatar edoput avatar ghilesmeddour avatar joperea avatar mtsch avatar ohai avatar pep8speaks avatar refu6enik avatar sauln avatar tmelorc avatar ubauer avatar ulupo 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  avatar  avatar

Watchers

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

ripser.py's Issues

can not install

I just got a new Mac book and I am trying to install ripser.py and get the following error messages.
I have been using Ripser on several other Macs and it was very easy to install.
Any advise?
best,
Wojtek

Collecting ripser
  Using cached https://files.pythonhosted.org/packages/20/59/302dab2f1be85f32c57bdf8d4595d0437db76131b13504025abfc8373b03/ripser-0.3.0.tar.gz
Requirement already satisfied: Cython in /anaconda3/lib/python3.7/site-packages (from ripser) (0.29.2)
Requirement already satisfied: numpy in /anaconda3/lib/python3.7/site-packages (from ripser) (1.15.4)
Requirement already satisfied: scipy in /anaconda3/lib/python3.7/site-packages (from ripser) (1.1.0)
Requirement already satisfied: matplotlib in /anaconda3/lib/python3.7/site-packages (from ripser) (3.0.2)
Requirement already satisfied: scikit-learn in /anaconda3/lib/python3.7/site-packages (from ripser) (0.20.1)
Requirement already satisfied: cycler>=0.10 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (2.3.0)
Requirement already satisfied: python-dateutil>=2.1 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (2.7.5)
Requirement already satisfied: six in /anaconda3/lib/python3.7/site-packages (from cycler>=0.10->matplotlib->ripser) (1.12.0)
Requirement already satisfied: setuptools in /anaconda3/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib->ripser) (40.6.3)
Building wheels for collected packages: ripser
  Running setup.py bdist_wheel for ripser ... error
  Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/k0/v0s8xqdd65n4ssm5fv5wr7640000gn/T/pip-install-1zz7tnm8/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/k0/v0s8xqdd65n4ssm5fv5wr7640000gn/T/pip-wheel-0yuf1q7p --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.7
  creating build/lib.macosx-10.7-x86_64-3.7/ripser
  copying ripser/_version.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
  copying ripser/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
  copying ripser/ripser.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
  running build_ext
  building 'pyRipser' extension
  creating build/temp.macosx-10.7-x86_64-3.7
  creating build/temp.macosx-10.7-x86_64-3.7/ripser
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/anaconda3/include/python3.7m -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.7-x86_64-3.7/ripser/pyRipser.o -std=c++11 -Ofast -D_hypot=hypot
  warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
  In file included from ripser/pyRipser.cpp:665:
  In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
  In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
  In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1823:
  /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  #warning "Using deprecated NumPy API, disable it by " \
   ^
  ripser/pyRipser.cpp:667:10: fatal error: 'ios' file not found
  #include "ios"
           ^~~~~
  2 warnings and 1 error generated.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for ripser
  Running setup.py clean for ripser
Failed to build ripser
Installing collected packages: ripser
  Running setup.py install for ripser ... error
    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/k0/v0s8xqdd65n4ssm5fv5wr7640000gn/T/pip-install-1zz7tnm8/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/k0/v0s8xqdd65n4ssm5fv5wr7640000gn/T/pip-record-4zflunt_/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/ripser
    copying ripser/_version.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
    copying ripser/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
    copying ripser/ripser.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
    running build_ext
    building 'pyRipser' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/ripser
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/anaconda3/include/python3.7m -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.7-x86_64-3.7/ripser/pyRipser.o -std=c++11 -Ofast -D_hypot=hypot
    warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    In file included from ripser/pyRipser.cpp:665:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1823:
    /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it by " \
     ^
    ripser/pyRipser.cpp:667:10: fatal error: 'ios' file not found
    #include "ios"
             ^~~~~
    2 warnings and 1 error generated.
    error: command 'gcc' failed with exit status 1

Installing from wheel, no pyRipser

I was unable to install ripser using pip install ripser so I installed ripser directly from the whl file at https://pypi.org/project/ripser/#files. Now from ripser import Rips gives

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-777271b17a02> in <module>
      1 import numpy as np
----> 2 from ripser import Rips

~\.conda\envs\datasci_py37\lib\site-packages\ripser\__init__.py in <module>
----> 1 from .ripser import *
      2 
      3 from ._version import __version__

~\.conda\envs\datasci_py37\lib\site-packages\ripser\ripser.py in <module>
     36 import persim
     37 
---> 38 from pyRipser import doRipsFiltrationDM as DRFDM
     39 from pyRipser import doRipsFiltrationDMSparse as DRFDMSparse
     40 

ModuleNotFoundError: No module named 'pyRipser'

(I'm sure this is not the intended way of installing, but I ran into the python error about Microsoft VS 14.0, and then "error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2". As I understand it, these are python errors, unrelated to the minGW installation.)

Installation failed on Mac

Hi, my installation of ripser on Mac failed with the following error:

Running setup.py clean for ripser
Failed to build ripser
DEPRECATION: Could not build wheels for ripser which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at pypa/pip#8368.
Installing collected packages: umap-learn, ripser, tadasets, scikit-tda
Running setup.py install for ripser ... error

I tried updating Xcode command line tool as the other issues suggested, but it didnโ€™t work for me. I think this might have something to do with pypa/pip#8368?

Analysing time-series data

Hi guys,
Thank you very much for your hard work in developing and maintaining this excellent tool - it really is a breeze to work with!

We are currently working on problems involving time-series data (trajectories). In order to achieve this, we post-process the distance matrix D to set the distance between subsequent points (t and t+1) to 0. This works just fine with dense filtration and we obtain the results that we expect. With sparse/approximate filtration, however, this breaks (maybe because the 0 to be interpreted as a sparse entry?). As our datasets usually are larger than the synthetic ones we used to test, ripser.py often runs out of memory and we'd like to leverage the approximate filtration. Do you have any advice or perhaps best practices for dealing with time-series data and approximate filtration?

Thank you very much,
Wolfgang

Unable to install

Hello,

I want to use Ripser for my independent study, but I'm unable to install it. I first tried to install it via PyPy, but with command "pip install ripser" I get the error message

Command "c:\users\appdata\local\programs\python\python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AppData\\Local\\Temp\\pip-install-8xwi42nr\\ripser\\setup.py';
f=getattr(tokenize, 'open', open)(__file__);
code=f.read().replace('\r\n', '\n');
f.close();
exec(compile(code, __file__, 'exec'))" 
install --record C:\Users\AppData\Local\Temp\pip-record-bmouiamb\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\AppData\Local\Temp\pip-install-8xwi42nr\ripser\

Then I tried to download the whole package from GitHub and after I located the folder where the package is downloaded, with command "python setup.py", I get the error message "

274: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied

What should I do? Please let me know. Thank you!

Using Z/17 in Representative Cocycles tutorial

Hello, I am working on expanding the explanation of cohomology in this tutorial, but I had a question about the following statement:

The death edge between 3_8 has been removed. For the remaining triangles, we can now verify that the cocycle condition is satisfied. For instance, for triangle 0_2_11, we have 1 + 16 + 0 = 17 = 0 (mod 17). Along triangle 0_1_2 we have 0 + 1 - 1 (since the edge 2_0 is negatively oriented), which is 0 (mod 17).

The problem is that the edge 2_11 is above the threshold and not part of the simplicial complex. As it stands all edges evaluate to either 1 or 0. Has the example changed since this was written?

Bug: Small distances seem not to be added

I found a point cloud that seems to break ripser. I'm not yet sure if it's on the Python side or the C++ side. But when I run it through, it doesn't seem to add any edges. But if I multiply all coordinates by 2, it seems to work

x.txt

import numpy as np
from ripser import Rips

if __name__ == '__main__':
    x = np.loadtxt("x.txt")
    r = Rips()
    res = r.fit_transform(x)
    print(res) #All 0D classes are infinite (seems like no edges were added)
    
    x *= 2.0
    res = r.fit_transform(x)
    print(res) #This seems to work properly

Key Error in Representative Cocycles tutorial

In Representative Cocycles tutorial, this code block

result = ripser(x, coeff=17, do_cocycles=True)
diagrams = result['dgms']
cocycles = result['cocycles']
D = result['dm']

raises a KeyError: 'dm' since returned object doesn't have the key. The available keys are:

result.keys()
# ['dgms', 'cocycles', 'num_edges', 'dperm2all', 'idx_perm', 'r_cover']

get the index instead of birth/death time for persistence diagram

Hello,

I am using some other software for computing generating cycles, and it requires the pairing of index instead of birth/death time, i.e. the index of the simplex which creates/destroys certain homology classes, not the corresponding values.

I was wondering would it be possible to get the index from ripser? I looked at the documents but didn't find a way to do so.

H_0 Connectedness

Dear authors,

Thank you for your wonderful library. It was easy-to-install and could be used right away!

I have a question regarding detection in H_0. Suppose you had a data set living in, say, a 10 x 10 grid where the points are integer pairs (x, y). In addition, suppose there were two points (0, 0) and (1, 0). We would connect these points provided that d(x,y) <= 0.5. If we measure H_0, wouldn't that bar have a life time of 0.5 to some death? When I apply ripser(), I am obtaining a birth of 0 and death of 1. I am not sure why this is happening or if it is a fundamental error in interpretation on my end.

If you could please provide any assistance or insight, I would greatly appreciate it. Thank you!

Kind regards,
Anthony

Visual Studio failed with exit status 2

Hi,
I tried to install ripser, but I ran into a couple error messages. First I had a building wheel error which appears to be resolved by adding "--no-cache-dir" to the install command. Then I ran into an error apparently with Visual Studio: "error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2".

I've tried reinstalling VS with the 2017 version as well, and a similar error occurs.

(base) C:\Users\jacob>pip install --no-cache-dir ripser
Collecting ripser
  Downloading https://files.pythonhosted.org/packages/20/59/302dab2f1be85f32c57bdf8d4595d0437db76131b13504025abfc8373b03/ripser-0.3.0.tar.gz (71kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 71kB 2.2MB/s
Requirement already satisfied: Cython in c:\users\jacob\anaconda3\lib\site-packages (from ripser) (0.28.5)
Requirement already satisfied: numpy in c:\users\jacob\anaconda3\lib\site-packages (from ripser) (1.15.2)
Requirement already satisfied: scipy in c:\users\jacob\anaconda3\lib\site-packages (from ripser) (1.1.0)
Requirement already satisfied: matplotlib in c:\users\jacob\anaconda3\lib\site-packages (from ripser) (2.2.3)
Requirement already satisfied: scikit-learn in c:\users\jacob\anaconda3\lib\site-packages (from ripser) (0.19.2)
Requirement already satisfied: cycler>=0.10 in c:\users\jacob\anaconda3\lib\site-packages (from matplotlib->ripser) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\jacob\anaconda3\lib\site-packages (from matplotlib->ripser) (2.2.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\jacob\anaconda3\lib\site-packages (from matplotlib->ripser) (2.7.3)
Requirement already satisfied: pytz in c:\users\jacob\anaconda3\lib\site-packages (from matplotlib->ripser) (2018.5)
Requirement already satisfied: six>=1.10 in c:\users\jacob\anaconda3\lib\site-packages (from matplotlib->ripser) (1.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\jacob\anaconda3\lib\site-packages (from matplotlib->ripser) (1.0.1)
Requirement already satisfied: setuptools in c:\users\jacob\anaconda3\lib\site-packages (from kiwisolver>=1.0.1->matplotlib->ripser) (40.4.3)
Installing collected packages: ripser
  Running setup.py install for ripser ... error
    Complete output from command c:\users\jacob\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\jacob\\AppData\\Local\\Temp\\pip-install-n_efm1ru\\ripser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\jacob\AppData\Local\Temp\pip-record-sm30oijf\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\ripser
    copying ripser\ripser.py -> build\lib.win-amd64-3.7\ripser
    copying ripser\_version.py -> build\lib.win-amd64-3.7\ripser
    copying ripser\__init__.py -> build\lib.win-amd64-3.7\ripser
    running build_ext
    building 'pyRipser' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\ripser
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I.\ripser -Ic:\users\jacob\anaconda3\include -Ic:\users\jacob\anaconda3\include -Ic:\users\jacob\anaconda3\lib\site-packages\numpy\core\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpripser/pyRipser.cpp /Fobuild\temp.win-amd64-3.7\Release\ripser/pyRipser.obj -std=c++11 -Ofast -D_hypot=hypot
    cl : Command line warning D9025 : overriding '/Os' with '/Ot'
    cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
    cl : Command line warning D9002 : ignoring unknown option '-Of'
    cl : Command line warning D9002 : ignoring unknown option '-Oa'
    pyRipser.cpp
    c:\users\jacob\anaconda3\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): error C2079: 'packed' uses undefined struct '__attribute__'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): error C2146: syntax error: missing ';' before identifier 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(102): error C2275: 'index_t': illegal use of this type as an expression
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(55): note: see declaration of 'index_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(102): error C2146: syntax error: missing ')' before identifier 'index'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(102): error C2059: syntax error: 'constant'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(105): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(105): error C2365: 'entry_t': redefinition; previous definition was 'data variable'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(105): error C2550: 'entry_t': constructor initializer lists are only allowed on constructor definitions
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(106): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(106): error C2365: 'entry_t': redefinition; previous definition was 'data variable'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(106): error C2550: 'entry_t': constructor initializer lists are only allowed on constructor definitions
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(107): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(107): error C2365: 'entry_t': redefinition; previous definition was 'data variable'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(107): error C2550: 'entry_t': constructor initializer lists are only allowed on constructor definitions
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(108): error C2059: syntax error: '}'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(108): error C2143: syntax error: missing ';' before '}'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(112): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(112): error C2086: 'int entry_t': redefinition
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(112): error C2146: syntax error: missing ';' before identifier 'make_entry'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(112): error C2143: syntax error: missing ';' before '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(112): error C2447: '{': missing function header (old-style formal list?)
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(115): error C2143: syntax error: missing ',' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(115): error C2065: 'e': undeclared identifier
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(115): error C2228: left of '.index' must have class/struct/union
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(115): note: type is 'unknown-type'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(116): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(116): error C2143: syntax error: missing ',' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(116): error C2065: 'e': undeclared identifier
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(116): error C2228: left of '.coefficient' must have class/struct/union
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(116): note: type is 'unknown-type'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(117): error C2065: 'e': undeclared identifier
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(117): error C2059: syntax error: 'const'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(117): error C2143: syntax error: missing ';' before '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(117): error C2447: '{': missing function header (old-style formal list?)
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(119): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(119): error C2143: syntax error: missing ',' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(119): error C2803: 'operator ==' must have at least one formal parameter of class type
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(119): error C2805: binary 'operator ==' has too few parameters
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(120): error C2065: 'e1': undeclared identifier
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(120): error C2065: 'e2': undeclared identifier
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(123): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(123): error C2143: syntax error: missing ',' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(124): error C2065: 'e': undeclared identifier
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(138): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(138): error C2143: syntax error: missing ';' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(138): error C2373: 'entry_t': redefinition; different type modifiers
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(138): error C2143: syntax error: missing ',' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(138): error C2059: syntax error: '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(138): error C2143: syntax error: missing ';' before '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(138): error C2447: '{': missing function header (old-style formal list?)
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(144): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(144): error C2955: 'std::pair': use of class template requires template argument list
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\utility(76): note: see declaration of 'std::pair'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(147): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(147): error C2143: syntax error: missing ',' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(147): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(147): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(147): error C2065: 'e': undeclared identifier
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(147): error C2614: 'diameter_entry_t': illegal member initialization: 'pair' is not a base or member
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(148): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(149): error C3861: 'make_entry': identifier not found
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(148): error C2614: 'diameter_entry_t': illegal member initialization: 'pair' is not a base or member
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(150): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(152): error C3861: 'make_entry': identifier not found
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(152): error C2614: 'diameter_entry_t': illegal member initialization: 'pair' is not a base or member
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(157): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(157): error C2143: syntax error: missing ';' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(157): error C2373: 'entry_t': redefinition; different type modifiers
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(157): error C2059: syntax error: '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(157): error C2143: syntax error: missing ';' before '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(157): error C2447: '{': missing function header (old-style formal list?)
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(158): error C2143: syntax error: missing ';' before '&'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(158): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(158): error C2086: 'int entry_t': redefinition
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(158): error C2059: syntax error: '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(158): error C2143: syntax error: missing ';' before '{'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(158): error C2447: '{': missing function header (old-style formal list?)
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(161): warning C4244: 'return': conversion from 'index_t' to 'const coefficient_t', possible loss of data
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(163): error C2039: 'first': is not a member of 'diameter_entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(144): note: see declaration of 'diameter_entry_t'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(165): error C2664: 'void set_coefficient(diameter_entry_t &,const coefficient_t)': cannot convert argument 1 from 'int' to 'diameter_entry_t &'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(984): error C2664: 'ripser<sparse_distance_matrix>::simplex_coboundary_enumerator::simplex_coboundary_enumerator(ripser<sparse_distance_matrix>::simplex_coboundary_enumerator &&)': cannot convert argument 3 from 'ripser<sparse_distance_matrix>' to 'const ripser &'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(984): note: Reason: cannot convert from 'ripser<sparse_distance_matrix>' to 'const ripser'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(984): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(826): error C2662: 'OutputIterator ripser<DistanceMatrix>::get_simplex_vertices<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<__int64>>>>(index_t,const index_t,index_t,OutputIterator) const': cannot convert 'this' pointer from 'const ripser' to 'const ripser<DistanceMatrix> &'
            with
            [
                OutputIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<__int64>>>
            ]
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(826): note: Reason: cannot convert from 'const ripser' to 'const ripser<DistanceMatrix>'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(826): note: Conversion requires a second user-defined-conversion operator or constructor
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(877): error C2039: 'back_inserter': is not a member of 'std'
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\unordered_map(14): note: see declaration of 'std'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(877): error C3861: 'back_inserter': identifier not found
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(899): error C2662: 'index_t ripser<DistanceMatrix>::get_next_vertex(index_t &,const index_t,const index_t) const': cannot convert 'this' pointer from 'const ripser' to 'const ripser<DistanceMatrix> &'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(899): note: Reason: cannot convert from 'const ripser' to 'const ripser<DistanceMatrix>'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(899): note: Conversion requires a second user-defined-conversion operator or constructor
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(908): error C2662: 'index_t ripser<DistanceMatrix>::get_next_vertex(index_t &,const index_t,const index_t) const': cannot convert 'this' pointer from 'const ripser' to 'const ripser<DistanceMatrix> &'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(908): note: Reason: cannot convert from 'const ripser' to 'const ripser<DistanceMatrix>'
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(908): note: Conversion requires a second user-defined-conversion operator or constructor
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(1067): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(1072): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(1088): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
    c:\users\jacob\appdata\local\temp\pip-install-n_efm1ru\ripser\ripser\ripser.cpp(1105): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
    ripser/pyRipser.cpp(1890): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\users\jacob\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\jacob\\AppData\\Local\\Temp\\pip-install-n_efm1ru\\ripser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\jacob\AppData\Local\Temp\pip-record-sm30oijf\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\jacob\AppData\Local\Temp\pip-install-n_efm1ru\ripser\

Diagram in blue color only

The following code from Usage section

import numpy as np
from ripser import Rips

rips = Rips()
data = np.random.random((100,2))
diagrams = rips.fit_transform(data)
rips.plot(diagrams)

does not show the plot. But yes if using rips.plot(diagrams, show=True).

Also, both bullets in diagram are in blue color, as in the image:

Figure 1_170

Any idea why? Maybe bug or matplotlib problems?

Issue with installation. Kindly help.

I am getting the following error when installing the ripser on anaconda 3. Kindly let me know the ways to fix it.

(base) PS C:\Users\pc> pip install ripser
Collecting ripser
  Using cached ripser-0.5.2.tar.gz (80 kB)
Requirement already satisfied: Cython in c:\programdata\anaconda3\lib\site-packages (from ripser) (0.29.21)
Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (from ripser) (1.18.5)
Requirement already satisfied: scipy in c:\programdata\anaconda3\lib\site-packages (from ripser) (1.5.0)
Requirement already satisfied: scikit-learn in c:\programdata\anaconda3\lib\site-packages (from ripser) (0.23.1)
Requirement already satisfied: persim in c:\programdata\anaconda3\lib\site-packages (from ripser) (0.1.3)
Requirement already satisfied: joblib>=0.11 in c:\programdata\anaconda3\lib\site-packages (from scikit-learn->ripser) (0.16.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\programdata\anaconda3\lib\site-packages (from scikit-learn->ripser) (2.1.0)
Requirement already satisfied: matplotlib in c:\programdata\anaconda3\lib\site-packages (from persim->ripser) (3.2.2)
Requirement already satisfied: hopcroftkarp in c:\programdata\anaconda3\lib\site-packages (from persim->ripser) (1.2.5)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\lib\site-packages (from matplotlib->persim->ripser) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib->persim->ripser) (2.4.7)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib->persim->ripser) (1.2.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib->persim->ripser) (2.8.1)
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib->persim->ripser) (1.15.0)
Building wheels for collected packages: ripser
  Building wheel for ripser (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\pc\\AppData\\Local\\Temp\\pip-install-en11byy8\\ripser\\setup.py'"'"'; __file__='"'"'C:\\Users\\pc\\AppData\\Local\\Temp\\pip-install-en11byy8\\ripser\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\pc\AppData\Local\Temp\pip-wheel-wozshgka'
       cwd: C:\Users\pc\AppData\Local\Temp\pip-install-en11byy8\ripser\
  Complete output (12 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\ripser
  copying ripser\ripser.py -> build\lib.win-amd64-3.8\ripser
  copying ripser\_version.py -> build\lib.win-amd64-3.8\ripser
  copying ripser\__init__.py -> build\lib.win-amd64-3.8\ripser
  running build_ext
  building 'pyRipser' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
  ----------------------------------------
  ERROR: Failed building wheel for ripser
  Running setup.py clean for ripser
Failed to build ripser
Installing collected packages: ripser
    Running setup.py install for ripser ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\pc\\AppData\\Local\\Temp\\pip-install-en11byy8\\ripser\\setup.py'"'"'; __file__='"'"'C:\\Users\\pc\\AppData\\Local\\Temp\\pip-install-en11byy8\\ripser\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\pc\AppData\Local\Temp\pip-record-u9s13721\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\ProgramData\Anaconda3\Include\ripser'
         cwd: C:\Users\pc\AppData\Local\Temp\pip-install-en11byy8\ripser\
    Complete output (12 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\ripser
    copying ripser\ripser.py -> build\lib.win-amd64-3.8\ripser
    copying ripser\_version.py -> build\lib.win-amd64-3.8\ripser
    copying ripser\__init__.py -> build\lib.win-amd64-3.8\ripser
    running build_ext
    building 'pyRipser' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\pc\\AppData\\Local\\Temp\\pip-install-en11byy8\\ripser\\setup.py'"'"'; __file__='"'"'C:\\Users\\pc\\AppData\\Local\\Temp\\pip-install-en11byy8\\ripser\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\pc\AppData\Local\Temp\pip-record-u9s13721\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\ProgramData\Anaconda3\Include\ripser' Check the logs for full command output.
(base) PS C:\Users\pc>

Retrieving Max Lifespan from Rips

I'm relatively new to TDA, so forgive some uninformed sounding wording.

In the Ripser.py implementation, I see that we are using the C++ structs for the arrays of points.
Is there any way to (still in Python) retrieve the maximum lifespan of some points in the persistence diagram/barcodes? I.E., is there a way to find the maximum lifespan of a point in a point cloud, when running the rips complex persistence homology on it?

I need to find the two longest lifespans in the dataset.

Respectfully,
Aidan Lytle

another (different?) installation issue

Hi! I'm trying to install on macOS Mojave and running into issues. Not sure whether they're related to problems others are having. When I attempt via pip:

Alex-Mac:ripser.py-master alex$ pip3 install ripser
Collecting ripser
  Using cached https://files.pythonhosted.org/packages/20/59/302dab2f1be85f32c57bdf8d4595d0437db76131b13504025abfc8373b03/ripser-0.3.0.tar.gz
Requirement already satisfied: Cython in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from ripser) (0.29.3)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from ripser) (1.16.0)
Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from ripser) (1.2.0)
Requirement already satisfied: matplotlib in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from ripser) (3.0.2)
Requirement already satisfied: scikit-learn in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from ripser) (0.20.2)
Requirement already satisfied: python-dateutil>=2.1 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from matplotlib->ripser) (2.7.5)
Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from matplotlib->ripser) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from matplotlib->ripser) (2.3.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from matplotlib->ripser) (1.0.1)
Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from python-dateutil>=2.1->matplotlib->ripser) (1.12.0)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib->ripser) (40.6.2)
Building wheels for collected packages: ripser
  Building wheel for ripser (setup.py) ... error
  Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/sr/kj8trxfd57sc9c_bwvwxl8nh0000gn/T/pip-install-wqfcvtit/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/sr/kj8trxfd57sc9c_bwvwxl8nh0000gn/T/pip-wheel-i8piv9uu --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.7
  creating build/lib.macosx-10.9-x86_64-3.7/ripser
  copying ripser/_version.py -> build/lib.macosx-10.9-x86_64-3.7/ripser
  copying ripser/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/ripser
  copying ripser/ripser.py -> build/lib.macosx-10.9-x86_64-3.7/ripser
  running build_ext
  building 'pyRipser' extension
  creating build/temp.macosx-10.9-x86_64-3.7
  creating build/temp.macosx-10.9-x86_64-3.7/ripser
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.9-x86_64-3.7/ripser/pyRipser.o -std=c++11 -Ofast -D_hypot=hypot
  In file included from /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/syslimits.h:7:0,
                   from /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/limits.h:34,
                   from /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:11,
                   from ripser/pyRipser.cpp:42:
  /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
   #include_next <limits.h>  /* recurse down to the real one */
                                                               ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for ripser
  Running setup.py clean for ripser
Failed to build ripser
Installing collected packages: ripser
  Running setup.py install for ripser ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/sr/kj8trxfd57sc9c_bwvwxl8nh0000gn/T/pip-install-wqfcvtit/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/sr/kj8trxfd57sc9c_bwvwxl8nh0000gn/T/pip-record-mn9lirpo/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.7
    creating build/lib.macosx-10.9-x86_64-3.7/ripser
    copying ripser/_version.py -> build/lib.macosx-10.9-x86_64-3.7/ripser
    copying ripser/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/ripser
    copying ripser/ripser.py -> build/lib.macosx-10.9-x86_64-3.7/ripser
    running build_ext
    building 'pyRipser' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/ripser
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.9-x86_64-3.7/ripser/pyRipser.o -std=c++11 -Ofast -D_hypot=hypot
    In file included from /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/syslimits.h:7:0,
                     from /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/limits.h:34,
                     from /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:11,
                     from ripser/pyRipser.cpp:42:
    /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
     #include_next <limits.h>  /* recurse down to the real one */
                                                                 ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1`
    
    ----------------------------------------
`Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/sr/kj8trxfd57sc9c_bwvwxl8nh0000gn/T/pip-install-wqfcvtit/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/sr/kj8trxfd57sc9c_bwvwxl8nh0000gn/T/pip-record-mn9lirpo/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/sr/kj8trxfd57sc9c_bwvwxl8nh0000gn/T/pip-install-wqfcvtit/ripser/

and when I try directly from the master branch:

Alex-Mac:ripser.py-master alex$ python3 setup.py install
Add compile flag macs
running install
running bdist_egg
running egg_info
writing ripser.egg-info/PKG-INFO
writing dependency_links to ripser.egg-info/dependency_links.txt
writing requirements to ripser.egg-info/requires.txt
writing top-level names to ripser.egg-info/top_level.txt
reading manifest file 'ripser.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'ripser.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.9-x86_64/egg
running install_lib
running build_py
running build_ext
building 'pyRipser' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.9-x86_64-3.7/ripser/pyRipser.o -std=c++11 -Ofast -D_hypot=hypot -stdlib=libc++
gcc: error: unrecognized command line option โ€˜-stdlib=libc++โ€™
error: command 'gcc' failed with exit status 1

Any advice would be much appreciated!

DLL load failed

Hello,

I tried to install your Python package Ripser. I succeeded at home with a Python 3.6 32 bits.
I have followed the steps mentionned on https://pypi.org/project/ripser/ :
pip install cython
pip install ripser

Nevertheless, I tried to do exactly the same thing on my work, but each time (with Python 3.6 32 bits and Python 3.6 64 bits), I had the same error :

Traceback (most recent call last):
  File "C:\machine_learning\research\tda_ripser.py", line 3, in <module>
    from ripser import *
  File "C:\Anaconda3_3.6_32\lib\site-packages\ripser\__init__.py", line 1, in <module>
    from .ripser import *
  File "C:\Anaconda3_3.6_32\lib\site-packages\ripser\ripser.py", line 36, in <module>
    from pyRipser import doRipsFiltrationDM as DRFDM
ImportError: DLL load failed: Le module spรฉcifiรฉ est introuvable.

I am wondering if it is not due to a problem of dependence to a build library like MS build or something else.

Any help would be greatly appreciated. Thanks in advance !
Best regards,

Axel

Index out of range issue

Sometimes this happens:

"""
Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "run_homology_computation.py", line 306, in process_experiment_homology
    raise ef
  File "run_homology_computation.py", line 290, in process_experiment_homology
    diagram = r.fit_transform(Xtouse)
  File "/usr/local/lib/python3.5/dist-packages/ripser/ripser.py", line 119, in fit_transform
    self.transform(X, distance_matrix, metric)
  File "/usr/local/lib/python3.5/dist-packages/ripser/ripser.py", line 95, in transform
    dgm = self._compute_rips(X)
  File "/usr/local/lib/python3.5/dist-packages/ripser/ripser.py", line 141, in _compute_rips
    n_classes = int(res[0])
IndexError: list index out of range
"""

Unable to install on Mac

I am trying to install ripser and I get the following error. I have looked at similar threads here but these fixes don't seem to help. The error message is the following.

Collecting ripser
  Using cached https://files.pythonhosted.org/packages/8c/52/ca457da871708a169a0042d955f31f55caa060d1846f3de72b538724ef50/ripser-0.3.2.tar.gz
Requirement already satisfied: Cython in /anaconda3/lib/python3.6/site-packages (from ripser) (0.27.3)
Requirement already satisfied: numpy in /anaconda3/lib/python3.6/site-packages (from ripser) (1.14.0)
Requirement already satisfied: scipy in /anaconda3/lib/python3.6/site-packages (from ripser) (1.0.0)
Requirement already satisfied: scikit-learn in /anaconda3/lib/python3.6/site-packages (from ripser) (0.19.1)
Requirement already satisfied: persim in /anaconda3/lib/python3.6/site-packages (from ripser) (0.0.8)
Requirement already satisfied: matplotlib in /anaconda3/lib/python3.6/site-packages (from persim->ripser) (2.1.2)
Requirement already satisfied: hopcroftkarp in /anaconda3/lib/python3.6/site-packages (from persim->ripser) (1.2.4)
Requirement already satisfied: six>=1.10 in /anaconda3/lib/python3.6/site-packages (from matplotlib->persim->ripser) (1.11.0)
Requirement already satisfied: python-dateutil>=2.1 in /anaconda3/lib/python3.6/site-packages (from matplotlib->persim->ripser) (2.6.1)
Requirement already satisfied: pytz in /anaconda3/lib/python3.6/site-packages (from matplotlib->persim->ripser) (2017.3)
Requirement already satisfied: cycler>=0.10 in /anaconda3/lib/python3.6/site-packages (from matplotlib->persim->ripser) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /anaconda3/lib/python3.6/site-packages (from matplotlib->persim->ripser) (2.2.0)
Building wheels for collected packages: ripser
  Building wheel for ripser (setup.py) ... error
  Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/x8/54zby91n1sxc7qkgbl9x7jl00000gp/T/pip-install-ur6l9u3i/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/x8/54zby91n1sxc7qkgbl9x7jl00000gp/T/pip-wheel-2llctf8k --python-tag cp36:
  Warning: Extension name 'pyRipser' does not match fully qualified name 'ripser.pyRipser' of 'ripser/pyRipser.pyx'
  /anaconda3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.6
  creating build/lib.macosx-10.7-x86_64-3.6/ripser
  copying ripser/_version.py -> build/lib.macosx-10.7-x86_64-3.6/ripser
  copying ripser/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/ripser
  copying ripser/ripser.py -> build/lib.macosx-10.7-x86_64-3.6/ripser
  running build_ext
  building 'pyRipser' extension
  creating build/temp.macosx-10.7-x86_64-3.6
  creating build/temp.macosx-10.7-x86_64-3.6/ripser
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/anaconda3/include/python3.6m -I/anaconda3/lib/python3.6/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.7-x86_64-3.6/ripser/pyRipser.o -Ofast -D_hypot=hypot -std=c++11 -mmacosx-version-min=10.9
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for ripser
  Running setup.py clean for ripser
Failed to build ripser
Installing collected packages: ripser
  Running setup.py install for ripser ... error
    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/x8/54zby91n1sxc7qkgbl9x7jl00000gp/T/pip-install-ur6l9u3i/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/x8/54zby91n1sxc7qkgbl9x7jl00000gp/T/pip-record-q8rku06t/install-record.txt --single-version-externally-managed --compile:
    Warning: Extension name 'pyRipser' does not match fully qualified name 'ripser.pyRipser' of 'ripser/pyRipser.pyx'
    /anaconda3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    creating build/lib.macosx-10.7-x86_64-3.6/ripser
    copying ripser/_version.py -> build/lib.macosx-10.7-x86_64-3.6/ripser
    copying ripser/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/ripser
    copying ripser/ripser.py -> build/lib.macosx-10.7-x86_64-3.6/ripser
    running build_ext
    building 'pyRipser' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/ripser
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/anaconda3/include/python3.6m -I/anaconda3/lib/python3.6/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.7-x86_64-3.6/ripser/pyRipser.o -Ofast -D_hypot=hypot -std=c++11 -mmacosx-version-min=10.9
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/x8/54zby91n1sxc7qkgbl9x7jl00000gp/T/pip-install-ur6l9u3i/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/x8/54zby91n1sxc7qkgbl9x7jl00000gp/T/pip-record-q8rku06t/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/x8/54zby91n1sxc7qkgbl9x7jl00000gp/T/pip-install-ur6l9u3i/ripser/```

Add Support for Vertex Weights

This will mainly involve making some tweaks to "compute_dim_0_pairs()" to support negative vertex weights. I don't think there's much else I have to do. But I will definitely add unit tests to make sure

Advice

Hi

I am trying to use ripser but I can't go forward unfortunately.
The following two steps
pip install Cython
pip install Ripser
work without any problem.
But this is not work

import numpy as np
from ripser import ripser, plot_dgms
Traceback (most recent call last):
File "", line 1, in
File "/Users/admin/ripser.py", line 1
/*
^
SyntaxError: invalid syntax

Please, advise me to fix the problem.
Regards

Faik Mayah

Failed to install ripser on Windows 10

I'm trying to install ripser for a couple of days. I've followed all the raised issues and nothing worked. I use Python 3.7.0 (I also installed conda for the purpose of installation). There was a message about something wrong with Visual Studio , so I got the latest update. During couple of days I also tried installing mingw, building wheel, using conda-forge (but there's info that such package isn't available although I clearly saw that somebody was working on that 2 months ago). I tried to install it from venv console, conda prompt and Pycharm settings. I'm getting following errors:

Installing collected packages: ripser
  Running setup.py install for ripser ... error
    Complete output from command C:\Users\patka\PycharmProjects\PARSER\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\patka\\AppData\\Local\\Temp\\pip-install-lp820rnv\\ripser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\patka\AppData\Local\Temp\pip-record-cxu61hxt\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\patka\PycharmProjects\PARSER\venv\include\site\python3.7\ripser:
    C:\Users\patka\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.7
    creating build\lib.win32-3.7\ripser
    copying ripser\ripser.py -> build\lib.win32-3.7\ripser
    copying ripser\_version.py -> build\lib.win32-3.7\ripser
    copying ripser\__init__.py -> build\lib.win32-3.7\ripser
    running build_ext
    building 'pyRipser' extension
    creating build\temp.win32-3.7
    creating build\temp.win32-3.7\Release
    creating build\temp.win32-3.7\Release\ripser
    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I.\ripser -IC:\Users\patka\PycharmProjects\PARSER\venv\include -IC:\Users\patka\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\patka\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\patka\PycharmProjects\PARSER\venv\lib\site-packages\numpy\core\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpripser/pyRipser.cpp /Fobuild\temp.win32-3.7\Release\ripser/pyRipser.obj -Ofast -D_hypot=hypot
    cl : Command line warning D9025 : overriding '/Os' with '/Ot'
    cl : Command line warning D9002 : ignoring unknown option '-Of'
    cl : Command line warning D9002 : ignoring unknown option '-Oa'
    pyRipser.cpp
    c:\users\patka\pycharmprojects\Parser\venv\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(62): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(64): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(67): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(69): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(75): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): error C2079: 'packed' uses undefined struct '__attribute__'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): error C2146: syntax error: missing ';' before identifier 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(102): error C2275: 'index_t': illegal use of this type as an expression
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(55): note: see declaration of 'index_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(102): error C2146: syntax error: missing ')' before identifier 'index'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(102): error C2059: syntax error: 'constant'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(105): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(105): error C2365: 'entry_t': redefinition; previous definition was 'data variable'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(105): error C2550: 'entry_t': constructor initializer lists are only allowed on constructor definitions
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(106): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(106): error C2365: 'entry_t': redefinition; previous definition was 'data variable'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(106): error C2550: 'entry_t': constructor initializer lists are only allowed on constructor definitions
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(107): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(107): error C2365: 'entry_t': redefinition; previous definition was 'data variable'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(107): error C2550: 'entry_t': constructor initializer lists are only allowed on constructor definitions
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(108): error C2059: syntax error: '}'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(108): error C2143: syntax error: missing ';' before '}'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(112): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(112): error C2086: 'int entry_t': redefinition
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(112): error C2146: syntax error: missing ';' before identifier 'make_entry'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(112): error C2143: syntax error: missing ';' before '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(112): error C2447: '{': missing function header (old-style formal list?)
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(115): error C2143: syntax error: missing ',' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(115): error C2065: 'e': undeclared identifier
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(116): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(116): error C2143: syntax error: missing ',' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(116): error C2065: 'e': undeclared identifier
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(117): error C2065: 'e': undeclared identifier
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(117): error C2059: syntax error: 'const'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(117): error C2143: syntax error: missing ';' before '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(117): error C2447: '{': missing function header (old-style formal list?)
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(119): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(119): error C2143: syntax error: missing ',' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(119): error C2803: 'operator ==' must have at least one formal parameter of class type
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(119): error C2805: binary 'operator ==' has too few parameters
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(120): error C2065: 'e1': undeclared identifier
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(120): error C2065: 'e2': undeclared identifier
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(123): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(123): error C2143: syntax error: missing ',' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(124): error C2065: 'e': undeclared identifier
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(138): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(138): error C2143: syntax error: missing ';' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(138): error C2373: 'entry_t': redefinition; different type modifiers
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(138): error C2143: syntax error: missing ',' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(138): error C2059: syntax error: '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(138): error C2143: syntax error: missing ';' before '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(138): error C2447: '{': missing function header (old-style formal list?)
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(144): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(144): error C2955: 'std::pair': use of class template requires template argument list
    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include\utility(95): note: see declaration of 'std::pair'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(147): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(147): error C2143: syntax error: missing ',' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(147): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(147): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(147): error C2065: 'e': undeclared identifier
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(147): error C2614: 'diameter_entry_t': illegal member initialization: 'pair' is not a base or member
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(148): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(149): error C3861: 'make_entry': identifier not found
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(149): error C2614: 'diameter_entry_t': illegal member initialization: 'pair' is not a base or member
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(150): error C2923: 'std::pair': 'entry_t' is not a valid template type argument for parameter '_Ty2'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(152): error C3861: 'make_entry': identifier not found
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(151): error C2614: 'diameter_entry_t': illegal member initialization: 'pair' is not a base or member
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(157): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(157): error C2143: syntax error: missing ';' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(157): error C2373: 'entry_t': redefinition; different type modifiers
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(157): error C2059: syntax error: '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(157): error C2143: syntax error: missing ';' before '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(157): error C2447: '{': missing function header (old-style formal list?)
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(158): error C2143: syntax error: missing ';' before '&'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(158): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(158): error C2086: 'int entry_t': redefinition
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(101): note: see declaration of 'entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(158): error C2059: syntax error: '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(158): error C2143: syntax error: missing ';' before '{'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(158): error C2447: '{': missing function header (old-style formal list?)
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(161): warning C4244: 'return': conversion from 'index_t' to 'const coefficient_t', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(163): error C2039: 'first': is not a member of 'diameter_entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(144): note: see declaration of 'diameter_entry_t'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(165): error C2664: 'void set_coefficient(diameter_entry_t &,const coefficient_t)': cannot convert argument 1 from 'int' to 'diameter_entry_t &'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(262): warning C4244: 'argument': conversion from 'const index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(268): warning C4244: 'argument': conversion from 'const index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(281): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(282): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(286): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(290): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(294): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(297): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(299): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(301): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(303): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(311): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(312): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(313): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(316): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(317): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(318): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(937): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(951): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(984): error C2664: 'ripser<sparse_distance_matrix>::simplex_coboundary_enumerator::simplex_coboundary_enumerator(ripser<sparse_distance_matrix>::simplex_coboundary_enumerator &&)': cannot convert argument 3 from 'ripser<sparse_distance_matrix>' to 'const ripser &'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(984): note: Reason: cannot convert from 'ripser<sparse_distance_matrix>' to 'const ripser'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(984): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(824): warning C4244: 'argument': conversion from 'index_t' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(826): error C2662: 'OutputIterator ripser<DistanceMatrix>::get_simplex_vertices<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>>(index_t,const index_t,index_t,OutputIterator) const': cannot convert 'this' pointer from 'const ripser' to 'const ripser<DistanceMatrix> &'
            with
            [
                OutputIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<index_t>>>,
                _Ty=index_t
            ]
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(826): note: Reason: cannot convert from 'const ripser' to 'const ripser<DistanceMatrix>'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(826): note: Conversion requires a second user-defined-conversion operator or constructor
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(877): error C2662: 'OutputIterator ripser<DistanceMatrix>::get_simplex_vertices<std::back_insert_iterator<std::vector<index_t,std::allocator<_Ty>>>>(index_t,const index_t,index_t,OutputIterator) const': cannot convert 'this' pointer from 'const ripser' to 'const ripser<DistanceMatrix> &'
            with
            [
                OutputIterator=std::back_insert_iterator<std::vector<index_t,std::allocator<index_t>>>,
                _Ty=index_t
            ]
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(877): note: Reason: cannot convert from 'const ripser' to 'const ripser<DistanceMatrix>'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(877): note: Conversion requires a second user-defined-conversion operator or constructor
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(880): warning C4244: 'argument': conversion from '__int64' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(881): warning C4244: 'argument': conversion from '__int64' to 'const unsigned int', possible loss of data
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(898): error C2662: 'index_t ripser<DistanceMatrix>::get_next_vertex(index_t &,const index_t,const index_t) const': cannot convert 'this' pointer from 'const ripser' to 'const ripser<DistanceMatrix> &'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(899): note: Reason: cannot convert from 'const ripser' to 'const ripser<DistanceMatrix>'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(899): note: Conversion requires a second user-defined-conversion operator or constructor
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(908): error C2662: 'index_t ripser<DistanceMatrix>::get_next_vertex(index_t &,const index_t,const index_t) const': cannot convert 'this' pointer from 'const ripser' to 'const ripser<DistanceMatrix> &'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(908): note: Reason: cannot convert from 'const ripser' to 'const ripser<DistanceMatrix>'
    c:\users\patka\appdata\local\temp\pip-install-lp820rnv\ripser\ripser\ripser.cpp(908): note: Conversion requires a second user-defined-conversion operator or constructor
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Users\patka\PycharmProjects\PARSER\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\patka\\AppData\\Local\\Temp\\pip-install-lp820rnv\\ripser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\patka\AppData\Local\Temp\pip-record-cxu61hxt\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\patka\PycharmProjects\PARSER\venv\include\site\python3.7\ripser" failed with error code 1 in C:\Users\patka\AppData\Local\Temp\pip-install-lp820rnv\ripser\

Can you help me with that issue? Thanks.

Handle multiplicity of points in visualization

Currently, the visualization does not indicate whether there are points being overplotted.

We could possibly:

  • Add jitter (this could be confusing as it would change the interpretation of the diagrams).
  • Make points opaque so multiple points are easy to see.
  • Add annotations indicating multiplicity.

Restructure ripser and all language bindings

This is a continuation of a conversation from mtsch/Ripser.jl#1

The current ripser+bindings ecosystem is a bit of a mess. We currently have multiple repositories and forks, all accomplishing different goals. I suggest we restructure the repos so that the ecosystem can grow smoothly. This current fork has diverged greatly from the original repository and I don't foresee us ever merging it back.

There is also intention to create Matlab bindings and to port the old Wasm bindings. @mtsch is working on C bindings that might simplify this whole process and enable many other languages.

There are probably a couple different ways we could do this. One that stands out to me would be to split this repo into 2, one with the modified cpp and the other with the Python bindings. Then all bindings repositories could point towards the cpp library. Only the cpp repo would be a fork of ripser, the rest would be standalone repos.

Ideally, we could put all repos under the @Ripser organization, but @ubauer would have to give everyone access to the organization.

@ctralie, @mtsch, what do you two think?

Negative values for births and deaths

I apologize in advance if this is explained somewhere or if it is a trivial question. I admit being very new to topological analyses. Anyway, I could not find anything (e.g., some normalization or transformation) that would explain the fact that I obtain negative values for births and deaths on the persistence plot I obtained with Ripser. This happens using the following code:

from ripser import Rips
rips = Rips(maxdim=4)
diagrams = rips.fit_transform(data, distance_matrix=True)
rips.plot(diagrams)

which produced the following figure: https://pasteboard.co/IGNZumH.png

Let me know if this is a bug, in which case I'll share the data that are used in this example so that you can reproduce the issue. If it is not a bug, maybe the documentation can highlight more clearly the fact that the plots generated are not standard persistence plots (i.e., with positive births and deaths) and in which way they depart from standard persistence plots.

Bottleneck distance

How can I compute the bottleneck distance between persistence diagrams from Ripser? I was previously using the R TDA package which has this built in. Is there an alternative in Python?

Unable to import Ripster

Hi,

I could install Ripster succesfully but when I am trying to import it I get the error:

.../lib/python3.7/site-packages/Cython/Includes/numpy/init.pxd in init pyRipser()

ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

Apparently it is happening when compiling these lines from ripser.py:
---> 38 from pyRipser import doRipsFiltrationDM as DRFDM
and/or
---> 39 from pyRipser import doRipsFiltrationDMSparse as DRFDMSparse

I don't know how I could fix this, any help is welcome (Cython is up to date).

Thank you.

install error of ripser on mac, python 3.7

I have successfully installed ripser. But when import ripser, I got the following error. My numpy is up-to-date.

ValueError Traceback (most recent call last)
in ()
1
----> 2 import ripser

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ripser/init.py in ()
----> 1 from .ripser import *
2
3 from ._version import version

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ripser/ripser.py in ()
36 import persim
37
---> 38 from pyRipser import doRipsFiltrationDM as DRFDM
39 from pyRipser import doRipsFiltrationDMSparse as DRFDMSparse
40

venv/lib/python3.7/site-packages/Cython/Includes/numpy/init.pxd in init pyRipser()

ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

Unable to import ripser

Hi,
I get the following error when importing ripser:

ImportError: /home/......../.local/lib/python3.7/site-packages/pyRipser.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNSt8ios_base4InitD1Ev

I am on CentOS 7.

Bottleneck distance

Is there a way to comment on the projections using bottleneck distance or heat kernel distance?

For example, suppose I have a huge dataset and I project it using some lens(say TSNE). Since there are multiple hyperparameters, I wish to get some kind of optimal values so that the projection is not too far from the original dataset.
Also, since I will be looking at the number of clusters, I should be looking for H_0 and the bottleneck in H_0, right?

I think the same applies to the heat kernel distance or Wasserstein distance?

Failed building wheel for ripser

Hi!

I tried to pip install ripser after downloading anaconda. I have very few other programs on this old computer (macOS Sierra). It says "Failed building wheel" in red further down and I am unable to import ripser to any program in anaconda/spyder. Any help is appreciated, thanks in advance!
/Lukas

Here is what the terminal says:

pip install ripser
Collecting ripser
  Using cached https://files.pythonhosted.org/packages/20/59/302dab2f1be85f32c57bdf8d4595d0437db76131b13504025abfc8373b03/ripser-0.3.0.tar.gz
Requirement already satisfied: Cython in /anaconda3/lib/python3.7/site-packages (from ripser) (0.28.5)
Requirement already satisfied: numpy in /anaconda3/lib/python3.7/site-packages (from ripser) (1.15.1)
Requirement already satisfied: scipy in /anaconda3/lib/python3.7/site-packages (from ripser) (1.1.0)
Requirement already satisfied: matplotlib in /anaconda3/lib/python3.7/site-packages (from ripser) (2.2.3)
Requirement already satisfied: scikit-learn in /anaconda3/lib/python3.7/site-packages (from ripser) (0.19.2)
Requirement already satisfied: cycler>=0.10 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (2.2.0)
Requirement already satisfied: python-dateutil>=2.1 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (2.7.3)
Requirement already satisfied: pytz in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (2018.5)
Requirement already satisfied: six>=1.10 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (1.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /anaconda3/lib/python3.7/site-packages (from matplotlib->ripser) (1.0.1)
Requirement already satisfied: setuptools in /anaconda3/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib->ripser) (40.2.0)
Building wheels for collected packages: ripser
  Running setup.py bdist_wheel for ripser ... error
  Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/0s/5w98_4q16yg4h9vyjmvmwnzm0000gn/T/pip-install-wnp2xir0/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/0s/5w98_4q16yg4h9vyjmvmwnzm0000gn/T/pip-wheel-d5w2gmzx --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.7
  creating build/lib.macosx-10.7-x86_64-3.7/ripser
  copying ripser/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
  copying ripser/_version.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
  copying ripser/ripser.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
  running build_ext
  building 'pyRipser' extension
  creating build/temp.macosx-10.7-x86_64-3.7
  creating build/temp.macosx-10.7-x86_64-3.7/ripser
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/anaconda3/include/python3.7m -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.7-x86_64-3.7/ripser/pyRipser.o -std=c++11 -Ofast -D_hypot=hypot
  In file included from ripser/pyRipser.cpp:619:
  In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
  In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
  In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1823:
  /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  #warning "Using deprecated NumPy API, disable it by " \
   ^
  In file included from ripser/pyRipser.cpp:626:
  ./ripser/ripser.cpp:50:10: fatal error: 'unordered_map' file not found
  #include <unordered_map>
           ^~~~~~~~~~~~~~~
  1 warning and 1 error generated.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for ripser
  Running setup.py clean for ripser
Failed to build ripser
Installing collected packages: ripser
  Running setup.py install for ripser ... error
    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/0s/5w98_4q16yg4h9vyjmvmwnzm0000gn/T/pip-install-wnp2xir0/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/0s/5w98_4q16yg4h9vyjmvmwnzm0000gn/T/pip-record-sy29a5ww/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/ripser
    copying ripser/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
    copying ripser/_version.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
    copying ripser/ripser.py -> build/lib.macosx-10.7-x86_64-3.7/ripser
    running build_ext
    building 'pyRipser' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/ripser
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I./ripser -I/anaconda3/include/python3.7m -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -c ripser/pyRipser.cpp -o build/temp.macosx-10.7-x86_64-3.7/ripser/pyRipser.o -std=c++11 -Ofast -D_hypot=hypot
    In file included from ripser/pyRipser.cpp:619:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1823:
    /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it by " \
     ^
    In file included from ripser/pyRipser.cpp:626:
    ./ripser/ripser.cpp:50:10: fatal error: 'unordered_map' file not found
    #include <unordered_map>
             ^~~~~~~~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/0s/5w98_4q16yg4h9vyjmvmwnzm0000gn/T/pip-install-wnp2xir0/ripser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/0s/5w98_4q16yg4h9vyjmvmwnzm0000gn/T/pip-record-sy29a5ww/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/0s/5w98_4q16yg4h9vyjmvmwnzm0000gn/T/pip-install-wnp2xir0/ripser/

Unable to install on Windows

Hi,

I'm having issues with pip install on Windows 10. In particular, I get the following error code when running pip install scikit-tda:

Building wheels for collected packages: ripser
  Running setup.py bdist_wheel for ripser ... error
  Complete output from command C:\Users\Chris\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Chris\\AppData\\Local\\Temp\\pip-install-cleeqf8f\\ripser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Chris\AppData\Local\Temp\pip-wheel-uy0uj6oa --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\ripser
  copying ripser\ripser.py -> build\lib.win-amd64-3.6\ripser
  copying ripser\_version.py -> build\lib.win-amd64-3.6\ripser
  copying ripser\__init__.py -> build\lib.win-amd64-3.6\ripser
  running build_ext
  building 'pyRipser' extension
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  creating build\temp.win-amd64-3.6\Release\ripser
  C:\MinGW\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I.\ripser -IC:\Users\Chris\Anaconda3\include -IC:\Users\Chris\Anaconda3\include -IC:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include -c ripser/pyRipser.cpp -o build\temp.win-amd64-3.6\Release\ripser\pyripser.o -Ofast -D_hypot=hypot
  ripser/pyRipser.cpp:244:41: warning: division by zero [-Wdiv-by-zero]
       enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                         ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ripser/pyRipser.cpp:244:79: error: division by zero is not a constant expression
       enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                                                                 ^
  ripser/pyRipser.cpp:244:41: error: '(1 / 0)' is not a constant expression
       enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                         ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ripser/pyRipser.cpp:244:79: error: enumerator value for '__pyx_check_sizeof_voidp' is not an integer constant
       enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                                                                 ^
  In file included from C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1823,
                   from C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18,
                   from C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
                   from ripser/pyRipser.cpp:650:
  C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:13:79: note: #pragma message: C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
                            "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
                                                                                 ^
  ripser/pyRipser.cpp: In function 'PyTypeObject* __Pyx_ImportType(PyObject*, const char*, const char*, size_t, __Pyx_ImportType_CheckSize)':
  ripser/pyRipser.cpp:6989:13: warning: unknown conversion type character 'z' in format [-Wformat=]
               "%s.%s size changed, may indicate binary incompatibility. "
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               "Expected %zd from C header, got %zd from PyObject",
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ripser/pyRipser.cpp:6989:13: warning: unknown conversion type character 'z' in format [-Wformat=]
  ripser/pyRipser.cpp:6989:13: warning: too many arguments for format [-Wformat-extra-args]
  error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1

  ----------------------------------------
  Failed building wheel for ripser
  Running setup.py clean for ripser
Failed to build ripser
Installing collected packages: ripser, kmapper, tadasets, scikit-tda
  Running setup.py install for ripser ... error
    Complete output from command C:\Users\Chris\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Chris\\AppData\\Local\\Temp\\pip-install-cleeqf8f\\ripser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Chris\AppData\Local\Temp\pip-record-klznh_dl\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\ripser
    copying ripser\ripser.py -> build\lib.win-amd64-3.6\ripser
    copying ripser\_version.py -> build\lib.win-amd64-3.6\ripser
    copying ripser\__init__.py -> build\lib.win-amd64-3.6\ripser
    running build_ext
    building 'pyRipser' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    creating build\temp.win-amd64-3.6\Release\ripser
    C:\MinGW\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -DUSE_COEFFICIENTS=1 -DNDEBUG=1 -DASSEMBLE_REDUCTION_MATRIX=1 -I.\ripser -IC:\Users\Chris\Anaconda3\include -IC:\Users\Chris\Anaconda3\include -IC:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include -c ripser/pyRipser.cpp -o build\temp.win-amd64-3.6\Release\ripser\pyripser.o -Ofast -D_hypot=hypot
    ripser/pyRipser.cpp:244:41: warning: division by zero [-Wdiv-by-zero]
         enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                           ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ripser/pyRipser.cpp:244:79: error: division by zero is not a constant expression
         enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                                                                   ^
    ripser/pyRipser.cpp:244:41: error: '(1 / 0)' is not a constant expression
         enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                           ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ripser/pyRipser.cpp:244:79: error: enumerator value for '__pyx_check_sizeof_voidp' is not an integer constant
         enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                                                                   ^
    In file included from C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1823,
                     from C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18,
                     from C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
                     from ripser/pyRipser.cpp:650:
    C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:13:79: note: #pragma message: C:\Users\Chris\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
                              "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
                                                                                   ^
    ripser/pyRipser.cpp: In function 'PyTypeObject* __Pyx_ImportType(PyObject*, const char*, const char*, size_t, __Pyx_ImportType_CheckSize)':
    ripser/pyRipser.cpp:6989:13: warning: unknown conversion type character 'z' in format [-Wformat=]
                 "%s.%s size changed, may indicate binary incompatibility. "
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 "Expected %zd from C header, got %zd from PyObject",
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ripser/pyRipser.cpp:6989:13: warning: unknown conversion type character 'z' in format [-Wformat=]
    ripser/pyRipser.cpp:6989:13: warning: too many arguments for format [-Wformat-extra-args]
    error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1

    ----------------------------------------
Command "C:\Users\Chris\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Chris\\AppData\\Local\\Temp\\pip-install-cleeqf8f\\ripser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Chris\AppData\Local\Temp\pip-record-klznh_dl\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Chris\AppData\Local\Temp\pip-install-cleeqf8f\ripser\

Fix Windows wheel build and upload

Appveyor is broken currently. This needs to be fixed.

Also, the process of gathering the windows wheels and uploading them to Pypi is entirely manual. This should be automated.

Example does not work

I'm using Python 2.7 on Linux and the minimal given example does not work.
I have upgraded cython and have installed persim via pip but I got the following error:

    diagrams = ripser(data)['dgms']
TypeError: 'module' object is not callable

Any idea?

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

Hi,
I tried this on my computer for google drive " https://youtu.be/5Z-95U0wIMw?list=WL "

and i got this errors
1} Command errored out with exit status 1
2} error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2

Microsoft Windows [Version 10.0.18363.778]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\Dhaval>cd downloads

C:\Users\Dhaval\Downloads>cd uds-master

C:\Users\Dhaval\Downloads\uds-master>pip install -r requirements.txt
Requirement already satisfied: tabulate==0.8.2 in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 1)) (0.8.2)
Requirement already satisfied: httplib2==0.11.3 in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 2)) (0.11.3)
Collecting cryptography==2.3.1
Using cached cryptography-2.3.1.tar.gz (449 kB)
Collecting google_api_python_client==1.7.5
Using cached google_api_python_client-1.7.5-py3-none-any.whl (56 kB)
Collecting oauth2client==4.1.3
Using cached oauth2client-4.1.3-py2.py3-none-any.whl (98 kB)
Collecting tqdm==4.31.1
Using cached tqdm-4.31.1-py2.py3-none-any.whl (48 kB)
Collecting wcwidth
Using cached wcwidth-0.1.9-py2.py3-none-any.whl (19 kB)
Requirement already satisfied: idna>=2.1 in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from cryptography==2.3.1->-r requirements.txt (line 3)) (2.9)
Requirement already satisfied: asn1crypto>=0.21.0 in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from cryptography==2.3.1->-r requirements.txt (line 3)) (1.3.0)
Requirement already satisfied: six>=1.4.1 in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from cryptography==2.3.1->-r requirements.txt (line 3)) (1.14.0)
Requirement already satisfied: cffi!=1.11.3,>=1.7 in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from cryptography==2.3.1->-r requirements.txt (line 3)) (1.14.0)
Collecting google-auth>=1.4.1
Using cached google_auth-1.14.1-py2.py3-none-any.whl (89 kB)
Collecting uritemplate<4dev,>=3.0.0
Using cached uritemplate-3.0.1-py2.py3-none-any.whl (15 kB)
Collecting google-auth-httplib2>=0.0.3
Using cached google_auth_httplib2-0.0.3-py2.py3-none-any.whl (6.3 kB)
Collecting rsa>=3.1.4
Using cached rsa-4.0-py2.py3-none-any.whl (38 kB)
Collecting pyasn1-modules>=0.0.5
Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting pyasn1>=0.1.7
Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Requirement already satisfied: pycparser in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from cffi!=1.11.3,>=1.7->cryptography==2.3.1->-r requirements.txt (line 3)) (2.20)
Requirement already satisfied: setuptools>=40.3.0 in c:\users\dhaval\appdata\local\programs\python\python38-32\lib\site-packages (from google-auth>=1.4.1->google_api_python_client==1.7.5->-r requirements.txt (line 4)) (41.2.0)
Collecting cachetools<5.0,>=2.0.0
Using cached cachetools-4.1.0-py3-none-any.whl (10 kB)
Installing collected packages: cryptography, pyasn1, rsa, pyasn1-modules, cachetools, google-auth, uritemplate, google-auth-httplib2, google-api-python-client, oauth2client, tqdm, wcwidth
Running setup.py install for cryptography ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\dhaval\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Dhaval\AppData\Local\Temp\pip-install-v1yfdbta\cryptography\setup.py'"'"'; file='"'"'C:\Users\Dhaval\AppData\Local\Temp\pip-install-v1yfdbta\cryptography\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Dhaval\AppData\Local\Temp\pip-record-xiw8ehch\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dhaval\appdata\local\programs\python\python38-32\Include\cryptography'
cwd: C:\Users\Dhaval\AppData\Local\Temp\pip-install-v1yfdbta\cryptography
Complete output (109 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\cryptography
copying src\cryptography\exceptions.py -> build\lib.win32-3.8\cryptography
copying src\cryptography\fernet.py -> build\lib.win32-3.8\cryptography
copying src\cryptography\utils.py -> build\lib.win32-3.8\cryptography
copying src\cryptography_about_.py -> build\lib.win32-3.8\cryptography
copying src\cryptography_init_.py -> build\lib.win32-3.8\cryptography
creating build\lib.win32-3.8\cryptography\hazmat
copying src\cryptography\hazmat_init_.py -> build\lib.win32-3.8\cryptography\hazmat
creating build\lib.win32-3.8\cryptography\x509
copying src\cryptography\x509\base.py -> build\lib.win32-3.8\cryptography\x509
copying src\cryptography\x509\certificate_transparency.py -> build\lib.win32-3.8\cryptography\x509
copying src\cryptography\x509\extensions.py -> build\lib.win32-3.8\cryptography\x509
copying src\cryptography\x509\general_name.py -> build\lib.win32-3.8\cryptography\x509
copying src\cryptography\x509\name.py -> build\lib.win32-3.8\cryptography\x509
copying src\cryptography\x509\oid.py -> build\lib.win32-3.8\cryptography\x509
copying src\cryptography\x509_init_.py -> build\lib.win32-3.8\cryptography\x509
creating build\lib.win32-3.8\cryptography\hazmat\backends
copying src\cryptography\hazmat\backends\interfaces.py -> build\lib.win32-3.8\cryptography\hazmat\backends
copying src\cryptography\hazmat\backends_init_.py -> build\lib.win32-3.8\cryptography\hazmat\backends
creating build\lib.win32-3.8\cryptography\hazmat\bindings
copying src\cryptography\hazmat\bindings_init_.py -> build\lib.win32-3.8\cryptography\hazmat\bindings
creating build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\cmac.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\constant_time.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\hashes.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\hmac.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\keywrap.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\mac.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\padding.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives\serialization.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
copying src\cryptography\hazmat\primitives_init_.py -> build\lib.win32-3.8\cryptography\hazmat\primitives
creating build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\aead.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\backend.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\ciphers.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\cmac.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\decode_asn1.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\dh.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\dsa.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\ec.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\encode_asn1.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\hashes.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\hmac.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\rsa.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\utils.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\x25519.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl\x509.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
copying src\cryptography\hazmat\backends\openssl_init_.py -> build\lib.win32-3.8\cryptography\hazmat\backends\openssl
creating build\lib.win32-3.8\cryptography\hazmat\bindings\openssl
copying src\cryptography\hazmat\bindings\openssl\binding.py -> build\lib.win32-3.8\cryptography\hazmat\bindings\openssl
copying src\cryptography\hazmat\bindings\openssl_conditional.py -> build\lib.win32-3.8\cryptography\hazmat\bindings\openssl
copying src\cryptography\hazmat\bindings\openssl_init_.py -> build\lib.win32-3.8\cryptography\hazmat\bindings\openssl
creating build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric\dh.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric\dsa.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric\ec.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric\padding.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric\rsa.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric\utils.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric\x25519.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
copying src\cryptography\hazmat\primitives\asymmetric_init_.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\asymmetric
creating build\lib.win32-3.8\cryptography\hazmat\primitives\ciphers
copying src\cryptography\hazmat\primitives\ciphers\aead.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\ciphers
copying src\cryptography\hazmat\primitives\ciphers\algorithms.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\ciphers
copying src\cryptography\hazmat\primitives\ciphers\base.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\ciphers
copying src\cryptography\hazmat\primitives\ciphers\modes.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\ciphers
copying src\cryptography\hazmat\primitives\ciphers_init_.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\ciphers
creating build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
copying src\cryptography\hazmat\primitives\kdf\concatkdf.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
copying src\cryptography\hazmat\primitives\kdf\hkdf.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
copying src\cryptography\hazmat\primitives\kdf\kbkdf.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
copying src\cryptography\hazmat\primitives\kdf\pbkdf2.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
copying src\cryptography\hazmat\primitives\kdf\scrypt.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
copying src\cryptography\hazmat\primitives\kdf\x963kdf.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
copying src\cryptography\hazmat\primitives\kdf_init_.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\kdf
creating build\lib.win32-3.8\cryptography\hazmat\primitives\twofactor
copying src\cryptography\hazmat\primitives\twofactor\hotp.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\twofactor
copying src\cryptography\hazmat\primitives\twofactor\totp.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\twofactor
copying src\cryptography\hazmat\primitives\twofactor\utils.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\twofactor
copying src\cryptography\hazmat\primitives\twofactor_init_.py -> build\lib.win32-3.8\cryptography\hazmat\primitives\twofactor
running egg_info
writing src\cryptography.egg-info\PKG-INFO
writing dependency_links to src\cryptography.egg-info\dependency_links.txt
writing requirements to src\cryptography.egg-info\requires.txt
writing top-level names to src\cryptography.egg-info\top_level.txt
reading manifest file 'src\cryptography.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs_build'
warning: no previously-included files matching '*' found under directory 'vectors'
writing manifest file 'src\cryptography.egg-info\SOURCES.txt'
running build_ext
generating cffi module 'build\temp.win32-3.8\Release\_padding.c'
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
generating cffi module 'build\temp.win32-3.8\Release\_constant_time.c'
generating cffi module 'build\temp.win32-3.8\Release\_openssl.c'
building '_openssl' extension
creating build\temp.win32-3.8\Release\build
creating build\temp.win32-3.8\Release\build\temp.win32-3.8
creating build\temp.win32-3.8\Release\build\temp.win32-3.8\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\dhaval\appdata\local\programs\python\python38-32\include -Ic:\users\dhaval\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcbuild\temp.win32-3.8\Release_openssl.c /Fobuild\temp.win32-3.8\Release\build\temp.win32-3.8\Release_openssl.obj
_openssl.c
build\temp.win32-3.8\Release_openssl.c(546): fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\dhaval\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Dhaval\AppData\Local\Temp\pip-install-v1yfdbta\cryptography\setup.py'"'"'; file='"'"'C:\Users\Dhaval\AppData\Local\Temp\pip-install-v1yfdbta\cryptography\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Dhaval\AppData\Local\Temp\pip-record-xiw8ehch\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dhaval\appdata\local\programs\python\python38-32\Include\cryptography' Check the logs for full command output.

Incorrect output on COO matrices instantiated with rows and columns not in lexicographic order

I'm observing inconsistent behaviour between different scipy sparse formats which suggests to me that ripser is secretly assuming that matrices in COO format have lexicographically ordered row and column arrays. I believe that, when calling tocoo() on a non-COO matrix as is done internally by ripser, scipy automatically performs lexicographic ordering. But of course, on COO input, tocoo() does nothing at all. Hence, it seems to me that incorrect results are computed on certain valid-looking COO input.

Here's an example:

from ripser import ripser
import numpy as np
from scipy.sparse import coo_matrix

data = np.array([6., 8., 2., 4., 5., 9., 10., 3., 1., 1.])
row = np.array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3])
col = np.array([4, 1, 3, 2, 4, 3, 2, 3, 4, 4])
dm = coo_matrix((data, (row, col)), shape=(5, 5))

dm is an upper-triangular matrix (more on symmetric matrices below), and its array representation looks like this:

array([[ 0.,  8.,  4.,  2.,  6.],
       [ 0.,  0., 10.,  9.,  5.],
       [ 0.,  0.,  0.,  3.,  1.],
       [ 0.,  0.,  0.,  0.,  1.],
       [ 0.,  0.,  0.,  0.,  0.]])

Now,

ripser(dm, distance_matrix=True)['dgms']

returns

[array([[ 0.,  1.],
        [ 0.,  1.],
        [ 0.,  2.],
        [ 0.,  5.],
        [ 0., inf]]),
 array([[ 8., inf],
        [ 4., inf]])]

Notice the two infinite bars in 1D. Contrast this with the output of:

ripser(dm.tocsr(), distance_matrix=True)['dgms']

which is

[array([[ 0.,  1.],
        [ 0.,  1.],
        [ 0.,  2.],
        [ 0.,  5.],
        [ 0., inf]]),
 array([], shape=(0, 2), dtype=float64)]

with no infinite bars in 1D, and looking correct (e.g. equal to the result of running on dm.toarray()). This is also the output of ripser(dm.tocsr().tocoo(), distance_matrix=True)['dgms'], I believe because the double-conversion performs lexicographic ordering of the row and column index pairs.

As an aside, I want to reassure that this does not seem to have to do with the fact that the input is only upper-triangular. Try symmetrizing as follows:

data_symm = np.hstack([data, data])
row_symm = np.hstack([row, col])
col_symm = np.hstack([col, row])
dm_symm = coo_matrix((data_symm, (row_symm, col_symm)))

Then ripser(dm_symm , distance_matrix=True)['dgms'] yields the same incorrect result.

Segmentation fault 11

Thank you for putting together and maintaining this excellent library. It is wonderfully documented and up until now I've had no issues with it.

I recently ran into an issue when calling ripser(dX,distance_matrix=True) in a loop for a dynamical systems analysis where the application crashes due to a segmentation fault 11 error. I'm admittedly not super knowledgable about diagnosing the root cause of this type of error, but I was not able to reproduce it just by replicating the same input (30x30) matrix. The error only pops up after long runs (e.g. greater than 200 iterations).

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.