DMonniaux wrote:
> I'm computing with sparse rational matrices of moderate size (about
> 55x55). Curiously, a lot of time seems to be spent in functions
> constructing matrices, for instance from list of sparse vectors.
>
> 112 0.385 0.003 0.772 0.007 constructor.py:33
> (matrix)
> 369/321 0.012 0.000 0.419 0.001 matrix_space.py:256
> (__call__)
> 12 0.311 0.026 0.313 0.026 matrix_space.py:1216
> (list_to_dict)
> 1566 0.190 0.000 0.214 0.000 free_module.py:736
> (__call__)
> 2 0.043 0.021 0.197 0.098 {method 'stack' of
> 'sage.matrix.matrix1.Matrix' objects}
>
> Any advice on possible speedups? Is there some kind of specialized
> library that implements faster matrices?
If it's possible for you to deal with dense matrices (at that size),
things would most likely be much faster:
sage: %timeit a=random_matrix(QQ,55)
100 loops, best of 3: 3.17 ms per loop
sage: %timeit a=random_matrix(QQ,55,sparse=True)
10 loops, best of 3: 128 ms per loop
There hasn't been a lot of optimization of sparse matrix code. Almost
certainly there is a lot of low-hanging fruit that would speed up the
code a lot.
If you are willing to use floating point or integer matrices, scipy has
some classes for sparse matrices that may or may not be faster.
Thanks,
Jason
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---