Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #16803: Reimplement matrix_integer_dense using FLINT
In this ticket we reimplement all of matrix_integer_dense using FLINT fmpz_mat_t. The speed-up is substantial. With the new code: {{{ sage: A = Matrix(ZZ,1000,1000,range(10^6)) sage: %time B = A*A CPU times: user 883 ms, sys: 3.33 ms, total: 887 ms Wall time: 888 ms }}} This takes more than 1 minute in the same computer using Sage 6.3. URL: http://trac.sagemath.org/16803 Reported by: mmasdeu Ticket author(s): Marc Masdeu Reviewer(s): William Stein, Jeroen Demeyer
- Loading branch information
Showing
30 changed files
with
1,282 additions
and
860 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
include "sage/libs/flint/fmpz.pxi" | ||
include "sage/libs/flint/fmpz_poly.pxi" | ||
|
||
cdef extern from "flint/fmpz_mat.h": | ||
ctypedef void* fmpz_mat_t | ||
void fmpz_mat_init(fmpz_mat_t mat, unsigned long rows, unsigned long cols) | ||
void fmpz_mat_init_set(fmpz_mat_t mat, const fmpz_mat_t src) | ||
void fmpz_mat_set(fmpz_mat_t result, fmpz_mat_t mat) | ||
void fmpz_mat_clear(fmpz_mat_t mat) | ||
int fmpz_mat_print_pretty(const fmpz_mat_t mat) | ||
fmpz_t fmpz_mat_entry(fmpz_mat_t mat, long i, long j) | ||
void fmpz_mat_one(fmpz_mat_t mat) | ||
void fmpz_mat_zero(fmpz_mat_t mat) | ||
void fmpz_mat_neg(fmpz_mat_t f, fmpz_mat_t g) | ||
void fmpz_mat_scalar_mul_si(fmpz_mat_t B, const fmpz_mat_t A, long c) | ||
void fmpz_mat_scalar_mul_fmpz(fmpz_mat_t B, const fmpz_mat_t A, const fmpz_t c) | ||
void fmpz_mat_mul(fmpz_mat_t C, const fmpz_mat_t A, const fmpz_mat_t B) | ||
void fmpz_mat_sqr(fmpz_mat_t B, const fmpz_mat_t A) | ||
void fmpz_mat_add(fmpz_mat_t C, const fmpz_mat_t A, const fmpz_mat_t B) | ||
void fmpz_mat_sub(fmpz_mat_t C, const fmpz_mat_t A, const fmpz_mat_t B) | ||
void fmpz_mat_pow(fmpz_mat_t C, const fmpz_mat_t A, unsigned long n) | ||
int fmpz_mat_is_zero(const fmpz_mat_t mat) | ||
void fmpz_mat_charpoly(fmpz_poly_t cp, const fmpz_mat_t mat) | ||
void fmpz_mat_det(fmpz_t det, const fmpz_mat_t A) | ||
int fmpz_mat_inv(fmpz_mat_t Ainv, fmpz_t den, const fmpz_mat_t A) | ||
void fmpz_mat_transpose(fmpz_mat_t B, const fmpz_mat_t A) | ||
long fmpz_mat_rref(fmpz_mat_t B, fmpz_t den, const fmpz_mat_t A) | ||
long fmpz_mat_fflu(fmpz_mat_t B, fmpz_poly_t den, long *perm, const fmpz_mat_t A, int rank_check) | ||
long fmpz_mat_rref_fraction_free(long * perm, fmpz_mat_t B, fmpz_t den, const fmpz_mat_t A) | ||
long fmpz_mat_rank(const fmpz_mat_t A) | ||
int fmpz_mat_solve(fmpz_mat_t X, fmpz_t den, const fmpz_mat_t A, const fmpz_mat_t B) | ||
long fmpz_mat_nullspace(fmpz_mat_t B, const fmpz_mat_t A) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.