# 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 -0500
**

Seen: **111 times**

Last updated: **Oct 01**

Finding basis of image of Matrix

echelon_form not giving reduced echelon form

Sage Floyd algorithm in Cython

What are all the types we can declare in Cython?

Suppress error warnings from Cythonized code

Convert a matrix to a list of equations

more complicated data types to/from sage from/to C functions

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.