I need a convenient matrix class for some numerical work. SciPy doesn't
accept GPL code and besides I heavily dislike the NumPy matrix class. So
why not put my efforts into improving Sage (or at least write something
Sage-compatible for myself)...
In particular I need to Cholesky-factor Hermitian matrices (possibly
sparse and possibly million-by-million elements), and it would be nice
to be able to abstract away which library does the factorization (dense
or sparse) from case to case by simpling passing "sparse=True" to the
matrix function...
Here's the list of I need (I think) -- thoughts? Would you accept this
into Sage, or should I just write my own custom class? Is it allowed to
only submit new features over RDF and CDF or should any new API item
work on all parents to be accepted?
(Apologies if some of this is already in, I'm mostly ignorant about the
Sage matrix classes):
1) Efficient sparse matrix class for RDF and CDF. (I don't think this
exist currently? At least I get
sage.matrix.matrix_generic_sparse.Matrix_generic_sparse which doesn't
feel right.)
2) I haven't checked but I think converting all my sparse values to a
Python dict to get it into a Sage matrix would be too slow, at least it
is wasteful. So I'd like something like
matrix(CDF, I=I, J=J, V=V, sparse=True)
where I, J, and V are vectors containing respectively rows, columns, and
values, element by element.
3) Support for declaring a matrix as Hermitian (or symmetric), and then
only store half of it. Something like
sage: a = matrix(..., hermitian=True)
sage: a[1,0] = 1+1j
sage: print a[0,1]
(1-1j)
or perhaps
sage: a = matrix(..., hermitian='upper')
sage: a[1,0] = 1+1j
Traceback...
...
ValueError: Matrix is defined by its upper-triangular elements only
This would allow storing only half the elements (and probably trigger
Cholesky solving for log_determinant etc.).
4) Explicit diagonal matrices. And probably explicit
lower/upper-triangular matrices as well (with efficient back-solving etc.)
sage: a = matrix(CDF, ..., diagonal=True)
sage: a[1,0] = 2
Traceback...
...
ValueError: Assigning outside of diagonal on a diagonal matrix
and similar for matrix(..., lower=True) and ...upper=True...
5) Call CHOLMOD to do sparse Cholesky, either through cvxopt or more
likely through a recent wrapper by Nathaniel Smith. CHOLMOD is already
in Sage through cvxopt.
--
Dag Sverre
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org