-
Notifications
You must be signed in to change notification settings - Fork 20
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
Return wrong results #39
Comments
Hi @jingxu94, thanks for the report, I'll look into it. |
Hi @jingxu94, thanks again for the detailed bug report. You were absolutely right; there was a bug related to the memory layout for one-dimensional slices: The pardiso solver expects fortran contiguous memory layout for the rhs and the memory layout wasn't changed in the case of one-dimensional slices. I fixed it and released pypardiso version 0.4.1 on pypi and conda-forge. |
Hi @haasad, Nice work! Thanks again for developing and maintaining this project. PyPardiso allows me to focus on other aspects of my python code without worrying about the efficiency of solving equations with large sparse matrices. |
Happy to hear to pypardiso is useful to you! As a side note:
Are you aware that you can pass to whole 2D array to the solver and the solutions will be the columns of the returned array? This would be faster than looping. |
Thank you for tips. In fact, I'm building a matrix where each column depends on the solution of the equation with the previous column as the rhs. This is an iterative process with no parallelism. |
Ah yes, that makes sense 👍 just wanted to be sure |
Hi @haasad, thank you for this project.$x$ is wrong. I checked carefully and found that there may be a bug in the memory usage of the right-hand side of the equation. My code loops through each column of a 2D array as the rhs, at which point pypardiso gets the wrong solution. Here is a simple code snippet that reproduces the problem, where $x_1$ is the wrong result ($A \times x_1 \neq b_1, A \times x_2 = b_2 = b_1 $ ).
I've been using PyPardiso recently and found that sometimes the result
An instance of$b$ as the rhs can get the correct result.
Class <ndarray>
is composed of a contiguous one-dimensional memory segment and an indexing scheme. I guess the current code needs the rhs to point a contiguous memory slice, because as code snippet above, using the copy method or take each row of the two-dimensional arrayThe text was updated successfully, but these errors were encountered: