# Echelon form in cython

Is there an already function implemented in Cython which computes the echelon form of an integer matrix? Thanks for the help.

Echelon form in cython

add a comment

3

I assume you mean Hermite normal form. Yes, there are highly optimized library functions for that. See hermite_form in matrix/matrix_integer_dense.pyx

Yes I mean the Hermite normal form (in fact I do not care to have rational entries, so the usual echelon form is enough). But it seems to me that this library is coded in Sage, not in Cython? The point is that I have enormous matrices (e.g. of size 10^5*10^4, although there are many 0's), so I want to make use of the speed of cython (Sage is too slow).

???? Look at the file extension. It's "pyx". That's cython. It may very well be possible to improve this code, but it's already received quite a bit of attention, so I'd be surprised if you can make spectacular gains.You might try playing around with the different algorithms available. One may be better suited to the type of problem you're considering than the other.

If rational echelon form is sufficient, you should do that. It's generally cheaper to compute than HNF.

Sorry, I thought it had to be spyx for cython. I tried to use this library as follows: I created a file "Cython_Matrices.spyx" with the code in the webpage: https://sage.math.leidenuniv.nl/src/m...

Then I tried to load the file "Cython_Matrices.spyx" in my Sage terminal, but I have the following error: "Internal compiler error: 'sage/ext/cdefs.pxi' not found" What should I do?

Not use "spyx". It's meant to be a form of "sage-preparsed cython", but I don't think it gets used very much and therefore is prone to failure. Better to just write straight-up cython as is used in the sage library, and interface with the sage libraries in the usual cythonic/pythonic way.

Asked: **
2020-10-01 05:36:01 -0600
**

Seen: **120 times**

Last updated: **Oct 01 '20**

Finding basis of image of Matrix

echelon_form not giving reduced echelon form

Simultaneously diagonalizing matrices exactly

Importing Sage functions into Cython gives me an error (but not on sagenb.org)

Using MPolynomial_libsingular in Cython code

Avoiding redundancy in checking uniqueness of solution to linear equation

Sage/Cython compile embedded Cython with Sage import

Is there a way do declare a python function or fast_callable fo a cython function ?

Solver returns empty solution for linear system (but it has a solution)

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.