Workspace Allocation Error! P is symmetric positive semidefinite #556
Unanswered
Vldchlms
asked this question in
Python Interface
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The question is related to #290
I have the same issue when the matrix is large.
Here is the code:
dim1 = 5000
dim2 = 5000
lm1 = 5
lm2 = 5
for i in range(n1):
for j in range(n2):
theta[i, j] = 2i + 5j
data = theta + 10* np.random.randn(dim1 * dim2).reshape([dim1, dim2])
d = np.ones(dim1dim2)
D1 = sparse.diags([d,-d],[0,1],format='csr')
D1 = D1[np.arange(1,dim1dim2+1)%dim1 !=0,]
d = np.ones((dim1dim2 - dim1))
D2 = sparse.diags([d,-d],[0,dim1], shape = (dim1dim2 - dim1, dim1*dim2), format='csr')
D = sparse.vstack((D1, D2))
P = D@D.transpose()
d = np.ones(np.shape(D)[0]+1)
A = sparse.diags([d],[0], format='csr')
y = y.reshape(-1,1)
q = -y.transpose()@D.transpose()
q = q.reshape(-1,1)
l = -lm1*np.ones(np.shape(D)[0]+1)
u = (lm1 + lm2)*np.ones(np.shape(D)[0]+1)
prob = osqp.OSQP()
prob.setup(P, q, A, l, u, alpha=1.0)
res = prob.solve()
dl_sol = res.x
When dim1 = 500 dim2 = 500 the code works.
Beta Was this translation helpful? Give feedback.
All reactions