On Fri, Nov 27, 2009 at 7:37 AM, Dag Sverre Seljebotn
<da...@student.matnat.uio.no> wrote:
> 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)...

Cool.   Make sure to also look into CVXOPT
(http://abel.ee.ucla.edu/cvxopt/) which is included in Sage and does
accept GPL code.

>
> 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...

Sage is perfect for that.

>
> Here's the list of I need (I think) -- thoughts? Would you accept this
> into Sage,

Yes.

> or should I just write my own custom class?

No.

>  Is it allowed to
> only submit new features over RDF and CDF

Yes, definitely.

> 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.)

This is not in Sage yet.

> 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.

I don't quite understand this yet.   Note that you can directly access
your Matrix_sparse_rdf from Cython, if you so choose.

> 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.).

Good idea.  This could be a class Matrix_sparse_RDF_hermitian, *or*
better you could
make your Matrix_sparse_RDF class have access functions for each
different type of storage format, and support several.  I think this
would be very easy to do given the current design of Sage matrices.

> 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 sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to 
> sage-devel-unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to