Topics

Constructing rips filtration using the distance matrix

biraj.pandey@...
 

Hi Dmitriy,

Is there anyway to construct a rips filtration using the distance matrix itself instead of the point cloud? In my specific case, I don't have the point cloud and only the distance matrix. I am having issues with the fill_rips function.

We had a conversation relating to this past summer (July 25th, 2017 to be exact).  I did a fresh install and it seems that the feature is gone.  Before I could do something like,

dist_matrix = np.array([[0, 5, 4], [5, 0, 3], [4, 3, 0]])
f = d.fill_rips(squareform(dist_matrix), 2, 1000)

Now, when I run that I get the error that says
RuntimeError: Unknown array dtype

Any chance you could bring the back? Or perhaps some workaround?

Best, 
Biraj

Dmitriy Morozov
 

Hi Biraj,

The functionality is still there. It just doesn't like that the array entries are integers (it wants them to be floating point numbers). The easiest fix is to add ".astype('f4')" to your array:

dist_matrix = np.array([[0, 5, 4], [5, 0, 3], [4, 3, 0]]).astype('f4')
f = d.fill_rips(squareform(dist_matrix), 2, 1000)

Let me know if that works.

Best,
Dmitriy


On Tue, Feb 27, 2018 at 10:40 PM, biraj.pandey via Groups.Io <biraj.pandey@...> wrote:
Hi Dmitriy,

Is there anyway to construct a rips filtration using the distance matrix itself instead of the point cloud? In my specific case, I don't have the point cloud and only the distance matrix. I am having issues with the fill_rips function.

We had a conversation relating to this past summer (July 25th, 2017 to be exact).  I did a fresh install and it seems that the feature is gone.  Before I could do something like,

dist_matrix = np.array([[0, 5, 4], [5, 0, 3], [4, 3, 0]])
f = d.fill_rips(squareform(dist_matrix), 2, 1000)

Now, when I run that I get the error that says
RuntimeError: Unknown array dtype

Any chance you could bring the back? Or perhaps some workaround?

Best, 
Biraj