About Install Documentation Problems Tree Forum Save your money
via IT outsourcing!

Ukrainian HI-TECH Initiative

SparseMatrices

From OpenOpt

Jump to: navigation, search
Using Sparse Matrices


Unfortunately, sparse matrices still remains one of most weak features in Python usage for scientific purposes, as I had mentioned here.

But if you strongly require it, here are some useful info.

Attention See also: sparse matrices for FuncDesigner LP

CVXOPT solvers

AttentionSince OpenOpt 0.29 glpk and cvxopt_lp can use any type from scipy.sparse. As for cvxopt_socp and SDP solvers (dsdp and cvxopt_sdp), using sparsity hasn't been tested properly yet.

For FuncDesigner you should use latest svn snapshot.

If sparsity of a matrix ((nElems-nNonZeros)/nElems) exceeds certain threshold, for the cvxopt solvers they will be converted to sparse type automatically, so using sparsity from the very beginning can yield essential benefits if and only if you have a problem in storing huge arrays during prob creation (i.e. not enough memory to hold prob instance with the matrices in RAM).


lpSolve

Current wrapper for lpSolve (LP) cannot handle sparse matrices, it converts general linear constraints (A, Aeq) into Python list and pass it into the solver, where lpSolve cast it into its own sparse matrix format (provided sparsity exceeds certain threshold). See situation with sparse in Python lpSolve wrapper here.

Some other cases

  • scipy.sparse stuff sometimes is used in FuncDesigner - for some functions used in Automatic differentiation and for solving SLEs (systems of linear equations).
  • scipy.sparse matrices are used in OpenOpt solver ralg; you can either pass it from the very beginning of type scipy.sparse, or they will be cast to the format automatically, if a certain sparsity threshold has been exceeded. However, it can benefit for very large matrices only.
  • latest svn snapshot also allows using sparsity with ipopt solver.
Personal tools
Latest OOSuite 0.29