[I'm following the answer here]
I am trying to feed sparse matrices in CVXOPT. Consider the following minimal example:
import numpy
import cvxopt
import scipy.sparse
K = 10
n = 36
g_0 = numpy.random.randn(n, K)
d_0 = numpy.zeros(n) + 1.0
g_2 = scipy.sparse.dia_matrix(([d_0], [0]), shape=(n, n))
g_3 = scipy.sparse.dia_matrix(([-d_0], [0]), shape=(n, n))
g_1 = scipy.sparse.coo_matrix(g_0)
g_4 = scipy.sparse.hstack([g_1, g_2, g_3])
A = cvxopt.spmatrix(g_4.data.tolist(), g_4.col.tolist(), g_4.row.tolist(), size = g_4.shape)
I get:
TypeError: dimension too small
Is this a bug or (more likely) am I misunderstanding this answer?