Skip to content

gromov_barycenters function always returns the zero matrix #530

Closed
@youssef62

Description

@youssef62

Describe the bug

gromov_barycenters function always returns the zero matrix as cost matrix.
I executed the code below multiple times and it always returns 0.

Screenshots

image

Code sample

from ot.gromov import gromov_barycenters

n = 5
g1 = nx.erdos_renyi_graph(n,.8)
g2 = nx.erdos_renyi_graph(n,.8)

c1 = nx.adjacency_matrix(g1).toarray()
c2 = nx.adjacency_matrix(g2).toarray()
print(c1)
print(c2) 
b , log = gromov_barycenters(n,[c1,c2] ,log = True )  
print(b)
print(log)

Expected behavior

A non zero matrix.

Environment (please complete the following information):

  • OS (e.g. MacOS, Windows, Linux): MacOs , also tried on collab
  • Python version:Python 3.11.5
  • How was POT installed (source, pip, conda): pip

Output of the following code snippet:

import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import ot; print("POT", ot.__version__)
macOS-12.5.1-arm64-arm-64bit
Python 3.11.5 (main, Aug 24 2023, 15:09:32) [Clang 14.0.0 (clang-1400.0.29.202)]
NumPy 1.26.0
SciPy 1.11.3
POT 0.9.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions