From 73eec599c9777372961883c65022b0886d71a2bc Mon Sep 17 00:00:00 2001 From: ManifoldFR Date: Fri, 9 Aug 2024 17:55:10 +0200 Subject: [PATCH] [examples/julia] partial revert --- examples/julia/overview-simple.jl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/julia/overview-simple.jl b/examples/julia/overview-simple.jl index c525b4655..ca6ffa89d 100644 --- a/examples/julia/overview-simple.jl +++ b/examples/julia/overview-simple.jl @@ -19,32 +19,33 @@ function generate_mixed_qp(n, seed=1) P = spa.random( n, n, density=0.85, data_rvs=np.random.randn, format="csc" - ).toarray(order="C") + ).toarray() P = (P + np.transpose(P)) / 2.0 s = np.max(np.absolute(np.linalg.eigvals(P))) P += (np.abs(s) + 1e-02) * spa.eye(n) - P = spa.coo_matrix(P).toarray(order="C") + P = spa.coo_matrix(P) q = np.random.randn(n) - A = spa.random(m, n, density=0.85, data_rvs=np.random.randn, format="csc").toarray(order="C") + A = spa.random(m, n, density=0.85, data_rvs=np.random.randn, format="csc") v = np.random.randn(n) # Fictitious solution - delta = np.random.rand(m) # To get inequality u = A * v l = -1.0e20 * np.ones(m) - return P, q, get(A, slice(0, n_eq)), get(u, slice(0, n_eq)), get(A, slice(n_in, m)), get(u, slice(n_in, m, )), l[n_in+1:end] + return P.toarray("C"), q, get(A, slice(0, n_eq)), get(u, slice(0, n_eq)), get(A, slice(n_in, m)), get(u, slice(n_in, m, )), l[n_in+1:end] end # generate a qp problem n = 10 H, g, A, b, C, u, l = generate_mixed_qp(n) -n_eq = A.shape[1] -n_in = C.shape[1] +A = A.toarray("C") +C = C.toarray("C") +n_eq = size(A, 1) +n_in = size(C, 1) # solve it qp = proxsuite.proxqp.dense.QP(n, n_eq, n_in) qp.settings.eps_abs = EPS -qp.init(H, g, A.toarray(), b, C.toarray(), l, u) +qp.init(H, g, A, b, C, l, u) qp.solve() x_res = qp.results.x