Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle zero-length input #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Handle zero-length input #2

wants to merge 2 commits into from

Conversation

ms609
Copy link

@ms609 ms609 commented Apr 19, 2023

Thanks for this handy package.

It would be useful to add a sense check to avoid crashing R when a zero-length input is provided.

RcppHungarian::HungarianSolver(matrix(0, 0, 0)) # Crashes R

One alternative would be to return an error, but I've proposed returning a zero-length, zero-score matching.

I've not checked or tested the code proposed below, but hopefully it provides a useful starting point.

@jan-glx
Copy link

jan-glx commented Nov 22, 2023

Great! The second element of the returned list should be 2 column 0 row matrix though.

The second element of the returned list should be 2 column 0 row matrix
@ms609
Copy link
Author

ms609 commented Nov 23, 2023

I've updated the proposed code accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants