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

Improve rank calculation of numerical matrices #13315

Open
cbm755 opened this issue Sep 14, 2017 · 4 comments
Open

Improve rank calculation of numerical matrices #13315

cbm755 opened this issue Sep 14, 2017 · 4 comments

Comments

@cbm755
Copy link
Contributor

cbm755 commented Sep 14, 2017

  1. Define "numerical matrix" as one with only Float and Integer entries.
  2. If we have a numerical matrix, we should compute rank using the SVD (which should be computed using mpmath).
  3. We then decide the numerical rank by thresholding the SVs using a tolerance.
  4. That tolerance should be based on the minimum precision in the numerical matrix. [1]
  5. The tolerance should also be a optional kwarg.

cc @siefkenj

I can probably find a student to implement this sometime this term.

[1] reference: "help rank" in GNU Octave.

@cbm755
Copy link
Contributor Author

cbm755 commented Sep 14, 2017

_find_reasonable_pivots may also be useful.

@wsdookadr
Copy link
Contributor

@cbm755 Doesn't this better fit numpy than sympy?

@siefkenj
Copy link
Contributor

I would like to see a FloatMatrix that automatically sets the error tolerance for row reduction, etc. built into sympy. Technically, one should use numpy for such an application, but the number of people who get unexpected results is too large to ignore. Sympy matrices should definitely "just work".

@cbm755
Copy link
Contributor Author

cbm755 commented Sep 15, 2017

Doesn't this better fit numpy than sympy?

Technically, one should use numpy for such an application,

Numpy is single, double and extended precision only. This is certainly what you want for number crunching / scientific computing / etc. But there are use cases for arbitrary precision Floats (where Numpy is not appropriate). Teaching comes to mind, so does executing an algorithm in higher precision to help understand or analyze that algorithm.

My view is if Sympy allows the creation of Floats in matrices (which is does) then it should use the right algorithms for operations on those matrices. And those algorithms are often different for floating-point than for exact symbolic calculations (for example, numerical stability becomes important).

+1 for having FloatMatrix.

Finally, if a FloatMatrix had precisely 53 bits of precision (the default), it should be perfectly fine to call a double-precision numpy routine.

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

No branches or pull requests

3 participants