On 2012-10-30, Jason Grout <jason-s...@creativetrax.com> wrote:
> On 10/30/12 6:34 AM, Dima Pasechnik wrote:
>> On 2012-10-29, Raniere Gaia Silva <r.gaia...@gmail.com> wrote:
>>> Hi,
>>> I need to performe a (numerical) cholesky factorization of a sparse
>>> matrix (20x20) but I'm getting a error.
>>
>> the error message is clear: there is no implementation for RDF matrices,
>> only for exact matrices. So you can do this for QQ, for instance.
>>
>> This is of course a deficiency in Sage matrices. There are Cholesky
>> implementations available for RDF matrices from numpy, for instance,
>> it's just absense of proper hooks in Sage.
>> You can do the following as a workaround:
>>
>> sage: import numpy as np
>> sage: D = matrix(RDF, 2, 2, [[1, 1],[1,2]])
>> sage: np.linalg.cholesky(D.numpy())
>> array([[ 1.,  0.],
>>         [ 1.,  1.]])
>> sage:
>>
>> you can get Sage matrix out of it, too:
>> sage: L=matrix(np.linalg.cholesky(D.numpy())); L
>> [1.0 0.0]
>> [1.0 1.0]
>>
>> HTH,
>> Dmitrii
>>
>>
>
> I think the point was that cholesky was not implemented for *sparse* 
> matrices.  Dense RDF matrices in Sage do have cholesky implemented (and 
> that calls scipy).
ok, I might have misread the post in question.

>
> Of course, converting sparse to dense RDF and using cholesky on the 
> dense matrix works if the matrix is small enough.  Scipy had some 
> interest in adding sparse cholesky [1], but it seems that nothing came 
> of it.
>
> On the other hand, it would be cool if we wrapped something like CHOLMOD 
> [2] to compute sparse cholesky decompositions.  Even cooler would be 
> supporting the SuiteSparse package [3] and its various algorithms. 
> Sparse matrices in Sage need some attention.
cvxopt bundles and wraps SuiteSparce.
More precisely: cholmod:
http://www.cise.ufl.edu/research/sparse/cholmod/
see
http://abel.ee.ucla.edu/cvxopt/userguide/spsolvers.html?highlight=cholmod#cvxopt.cholmod.numeric

Let me see if I can get this to work in Sage...

Dima

>
> Thanks,
>
> Jason
>
> [1] http://projects.scipy.org/scipy/ticket/261
> [2] http://www.cise.ufl.edu/research/sparse/cholmod/
> [3] http://www.cise.ufl.edu/research/sparse/SuiteSparse/
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to