type conversion from numpy matrices to cvxopt matrices

55 views
Skip to first unread message

yd2612

unread,
Jul 5, 2017, 9:56:05 AM7/5/17
to CVXOPT
Hi,
I have some optimization application where I am using numpy and scipy libraries for various linear algberaic routines. So now when I have to use the cvxopt I have to do the type coversion from numpy array to cvxopt matrices which takes significant times as my problem sizes are large. Is there a way to handle this? Thanks in advance.

Dima Pasechnik

unread,
Jul 6, 2017, 3:29:34 AM7/6/17
to CVXOPT
I am under impression is that dense cvxopt matrices ought to be able to reuse data in numpy arrays without much overhead. Perhaps with some extra coding this can be made to work.

Joachim Dahl

unread,
Jul 6, 2017, 3:32:41 AM7/6/17
to cvx...@googlegroups.com
Wouldn't copying matrices back and forth be negligable compared to any optimization or linear algebra involving these matrices?

On Thu, Jul 6, 2017 at 9:29 AM, Dima Pasechnik <dim...@gmail.com> wrote:
I am under impression is that dense cvxopt matrices ought to be able to reuse data in numpy arrays without much overhead. Perhaps with some extra coding this can be made to work.

--
You received this message because you are subscribed to the Google Groups "CVXOPT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cvxopt+unsubscribe@googlegroups.com.
To post to this group, send email to cvx...@googlegroups.com.
Visit this group at https://groups.google.com/group/cvxopt.
For more options, visit https://groups.google.com/d/optout.

yd2612

unread,
Jul 6, 2017, 8:15:41 AM7/6/17
to CVXOPT
@Joachim Actually I am trying to optimize things by building custom KKT solver so the copying overhead in that case accumlates over iterations. For example 25% of my time in KKT solver is used up in type conversion(I have large problems) . 
@ Dima Do you mean that we can do the conversion without copying? Can you please give some details on how to go about doing this. Thanks.


On Thursday, July 6, 2017 at 1:02:41 PM UTC+5:30, Joachim Dahl wrote:
Wouldn't copying matrices back and forth be negligable compared to any optimization or linear algebra involving these matrices?
On Thu, Jul 6, 2017 at 9:29 AM, Dima Pasechnik <dim...@gmail.com> wrote:
I am under impression is that dense cvxopt matrices ought to be able to reuse data in numpy arrays without much overhead. Perhaps with some extra coding this can be made to work.

--
You received this message because you are subscribed to the Google Groups "CVXOPT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cvxopt+un...@googlegroups.com.

Martin

unread,
Jul 6, 2017, 1:50:05 PM7/6/17
to CVXOPT
What parts of numpy/scipy do you need? You may be able to do what you want using the blas/lapack/cholmod modules in cvxopt and avoid copying altogether. 

yd2612

unread,
Jul 6, 2017, 2:46:45 PM7/6/17
to CVXOPT
So I am using iterative methods(scipy.sparse.linalg.lsmr) from scipy for some least squares subproblems (as my problems are well conditioned and large).

Dima Pasechnik

unread,
Jul 7, 2017, 3:27:43 AM7/7/17
to CVXOPT
If it is some fast optimisation over a lot of redundant constraints then building the model from scratch may well dominate, time-wise.
Reply all
Reply to author
Forward
0 new messages