{"id":24360493,"url":"https://github.com/simonsfoundation/nnqp","last_synced_at":"2025-04-10T08:54:30.890Z","repository":{"id":98237333,"uuid":"52041537","full_name":"simonsfoundation/NNQP","owner":"simonsfoundation","description":"Efficient numba based implementation of a nonnegative quadratic programming solver ","archived":false,"fork":false,"pushed_at":"2016-10-12T19:29:28.000Z","size":9,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T08:11:11.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonsfoundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-18T21:53:07.000Z","updated_at":"2022-03-01T21:21:44.000Z","dependencies_parsed_at":"2023-04-29T14:47:06.190Z","dependency_job_id":null,"html_url":"https://github.com/simonsfoundation/NNQP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsfoundation%2FNNQP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsfoundation%2FNNQP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsfoundation%2FNNQP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsfoundation%2FNNQP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonsfoundation","download_url":"https://codeload.github.com/simonsfoundation/NNQP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248190407,"owners_count":21062277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-18T21:30:15.122Z","updated_at":"2025-04-10T08:54:30.882Z","avatar_url":"https://github.com/simonsfoundation.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"NNQP\n====\n\nEfficient implementation of nonnegative quadratic programming solver in numba \nThe solver implements a coordinate descent algorithm to find a solution to the problem\n\n```\n1/2 X^T Q X + f' X\n\nsubject to\n\nX\u003e=0\n```\n\n\n**Authors:** \nAndrea Giovannucci and Cengiz Pehlevan.\n\nInstallation\n============\n\nRequirements\n------------\n- numpy\n- scipy\n- numba (Anaconda distribution suggested) \n- cvxpy (only if you want to compare with another solver)\n\nExample\n========\n\n```python\n\nimport numpy as  np\nimport nnqp\n#%% EXAMPLE WITH RANDOM VARIABLES\np = 10\nQ1 = np.random.randn(p,p)\nQ = Q1.dot(Q1.T)\nf = np.random.randn(p)\n\n#%% solve with NNQP\nx = nnqp.nnqp(Q,f)\nprint x\n\n#%% run only if you want to compare with another solver (requires cvxpy)\nimport cvxpy as cvx\ncx = cvx.Variable(p) \nobjective=cvx.Minimize(0.5*cvx.quad_form(cx, Q) + f.T*cx ) \nconstraints= [cx \u003e= 0]\nprob = cvx.Problem(objective, constraints)\nresult = prob.solve(solver='SCS')\nprint(cx.value.T)\n\n#%% compute the difference between outputs\nprint(np.linalg.norm(x-cx.value.T))/p\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsfoundation%2Fnnqp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonsfoundation%2Fnnqp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsfoundation%2Fnnqp/lists"}