Skip to content

Nan in metric cost matrix causes 'segmentation fault core dumped' for GW solver #469

Closed

Description

@KrzakalaPaul

Bug

Hello!
When there is a nan in the metric cost matrix (gromov_wasserstein or fused_gromov_wasserstein) I get a 'segmentation fault core dumped' error.

Code sample

import numpy as np
from ot import gromov_wasserstein2

C1 = np.zeros((2,2))
C2 = np.ones((2,2))
p = np.array([0.5,0.5])
q = np.array([0.5,0.5])

gromov_wasserstein2(C1, C2, p, q)

C1[0,0]=np.nan

gromov_wasserstein2(C1, C2, p, q)

Expected behavior

I would expect a more clear warning/error or even that gromov_wasserstein2 returns a nan.

Activity

  1. changed the title [-]nan in metric cost matrix causes 'segmentation fault core dumped'[/-] [+]nan in metric cost matrix causes 'segmentation fault core dumped' for GW solver[/+] on May 5, 2023
  2. changed the title [-]nan in metric cost matrix causes 'segmentation fault core dumped' for GW solver[/-] [+]Nan in metric cost matrix causes 'segmentation fault core dumped' for GW solver[/+] on May 5, 2023
  3. bobluppes commented on May 17, 2024

    @bobluppes

    Hi, I would be interested in working on this!
    Could you please assign it to me?

  4. rflamary commented on May 17, 2024

    @rflamary
    Collaborator

    OK great! Feel free to cone POT and work on it the do a PR so that we can look at the code and discus it.

  5. rflamary commented on Jul 7, 2026

    @rflamary
    Collaborator

    I hecked this in the current release and the function indeed returns a nan, closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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