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

Should fraction_free_gauss_jordan_solve have a return value? #1989

Open
bjodah opened this issue Nov 17, 2023 · 0 comments · May be fixed by #1990
Open

Should fraction_free_gauss_jordan_solve have a return value? #1989

bjodah opened this issue Nov 17, 2023 · 0 comments · May be fixed by #1990

Comments

@bjodah
Copy link
Contributor

bjodah commented Nov 17, 2023

I tried to replace sympy.linsolve with symengine.linsolve in a project of mine, it worked well until I tried to solve an underdetermined system, upon the python process crashed. The reason for this is that I'm using a debug build of symengine (to increase chances of discovering bugs through asserts). In this case however we have an assert which doesn't indicate an internal error in the function, but rather that there exists no solutions to the problem:

https://github.com/symengine/symengine/blob/d6718a0794c3db0dc2beeb1553c0075ac6b58c92/symengine/dense_matrix.cpp#L1261C15-L1261C15

My instinct is to change fraction_free_gauss_jordan_solve (and probably it's sibling-functions as well, I haven't checked) to return an int (0 for success, 1 for when unable to solve the problem, or maybe i+1 to return as much information as possible?). And have either it's calling function throw an exception in symengine or propagate the return flag back to symengine.py and raise a python-exceptoin from there. What do you think?

EDIT:

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 a pull request may close this issue.

1 participant