Comments (4)
A preliminary approach is in ulupo#1
from giotto-ph.
Maybe we could add the diamond example and the output when running in sparse and dense, where we can observe an unexpected difference ?
from giotto-ph.
@MonkeyBreaker indeed. Here goes:
import numpy as np
from gph.python import ripser_parallel
diamond_dm = np.array(
[[0, 1, np.inf, 1, 1, 1],
[0, 0, 1, np.inf, 1, 1],
[0, 0, 0, 1, 1, 1],
[0, 0, 0, 0, 1, 1],
[0, 0, 0, 0, 0, np.inf],
[0, 0, 0, 0, 0, 0]],
dtype=np.float64
)
diamond_dm += diamond_dm.T
res = ripser_parallel(diamond_dm, metric="precomputed", maxdim=2, return_generators=True)
yields the correct barcode
[array([[ 0., 1.],
[ 0., 1.],
[ 0., 1.],
[ 0., 1.],
[ 0., 1.],
[ 0., inf]]),
array([], shape=(0, 2), dtype=float64),
array([[ 1., inf]])]
but the incorrect generators
(array([[5, 5, 3],
[3, 5, 2],
[2, 5, 1],
[1, 5, 0],
[4, 4, 3]], dtype=int64),
[array([], shape=(0, 4), dtype=int64), array([[1, 0, 5, 4]], dtype=int64)],
array([0], dtype=int64),
[array([], shape=(0, 2), dtype=int64), array([], shape=(0, 2), dtype=int64)])
The sparse version
from scipy.sparse import coo_matrix
diamond_dm = np.where(diamond_dm == np.inf, 0, diamond_dm)
diamond_dm = coo_matrix(diamond_dm)
gives the correct
(array([[5, 5, 3],
[3, 5, 2],
[2, 5, 1],
[1, 5, 0],
[4, 4, 3]], dtype=int64),
[array([], shape=(0, 4), dtype=int64), array([], shape=(0, 4), dtype=int64)],
array([0], dtype=int64),
[array([], shape=(0, 2), dtype=int64), array([[1, 0]], dtype=int64)])
from giotto-ph.
Perfect, I will just edit your comment to add the python
language highlight
from giotto-ph.
Related Issues (20)
- Possibly faster get_simplex_vertices for 1-d simplices?
- Garbage collection step in python interface is too runtime-costly
- Computation of enclosing radius is too slow
- proof of correctness of your check for the busy loop HOT 5
- Consistency in index dtypes HOT 1
- [BUG] Dead comment in compute_dim_0_pairs/incorrect removal of edges with zero filtration value HOT 4
- Allow computation of barcodes for graphs (no 2-simplices)
- Improve docstrings
- maxdim=0 HOT 2
- [CI] Produce wheels for Python 3.10 and Apple Silicon HOT 2
- [CPP] Variable names in binomial_coeff_table
- Incorrect handling of zeros for dense input when a threshold is passed HOT 1
- Extend dense backend to cover case of non-zero diagonal weights HOT 1
- [DOC] Dimension 0 is computed sequentially
- Investigate flaky multithreading tests HOT 2
- Unify LONG_DESCRIPTION in setup.py and use delvewheel to repair Windows wheels
- Building from source failed HOT 4
- Generators of persistence diagrams do not correspond to longest edge in hole
- OverflowError
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from giotto-ph.