Skip to content

Commit

Permalink
clean dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
njwfish committed Jul 5, 2023
1 parent 149d348 commit 9d4e1a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ authors = ["Nic Fishman"]
version = "0.1.0"

[deps]
Convex = "f65535da-76fb-5f13-bab9-19810c17039a"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"

[compat]
julia = "1"
Expand Down
8 changes: 4 additions & 4 deletions src/ConeProj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ module ConeProj
include("QRupdate.jl")

using LinearAlgebra
export coneB, coneBEq, solvex, solvexeq
export nnls, ecnnls, solvex, solvexeq

# there is some way to switch to views here which may speed things up

function coneB(A, b; p=0, passive_set=nothing, R=nothing, tol=1e-8, maxit=nothing)
function nnls(A, b; p=0, passive_set=nothing, R=nothing, tol=1e-8, maxit=nothing)
optimal = true
n, = size(b)
_, m = size(A)
Expand Down Expand Up @@ -78,7 +78,7 @@ function coneB(A, b; p=0, passive_set=nothing, R=nothing, tol=1e-8, maxit=nothin
return(coefs, passive_set, R, optimal)
end

function coneBEq(A, b, C, d; p=0, passive_set=nothing, R=nothing, constraint_set=nothing, tol=1e-8, maxit=nothing)
function ecnnls(A, b, C, d; p=0, passive_set=nothing, R=nothing, constraint_set=nothing, tol=1e-8, maxit=nothing)
optimal = true
n, = size(b)
q = size(d)
Expand Down Expand Up @@ -129,7 +129,7 @@ function coneBEq(A, b, C, d; p=0, passive_set=nothing, R=nothing, constraint_set
# _, r = qr(A)
# Cp = (pinv(r) * C')'
# print(size(Cp))
# _, constraint_set, _, _ = coneB(Cp, d, p=p)
# _, constraint_set, _, _ = nnls(Cp, d, p=p)
# print(size(constraint_set))
# passive_set = union(1:p, constraint_set)
# _, R = qr(A[:, passive_set])
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ end
@test all(A' * (b - A[:, passive_set] * _coefs) + C' * lambd .<= 1e-8)

# nn constrained p > 0
coefs, passive_set, R, status = coneB(A, b, p=1);
coefs, passive_set, R, status = nnls(A, b, p=1);
@test status == 1
_, r = qr(A[:, passive_set])
_coefs = solvex(r, A[:, passive_set], b)
@test all(A' * (b - A[:, passive_set] * _coefs) .<= 1e-8)

# eq and nn constrained p > 0
coefs, passive_set, R, status = coneBEq(A, b, C, d, p=1);
coefs, passive_set, R, status = ecnnls(A, b, C, d, p=1);
@test status == 1
_, r = qr(A[:, passive_set])
_coefs, lambd = solvexeq(r, A[:, passive_set], b, C[:, passive_set], d)
Expand Down

0 comments on commit 9d4e1a0

Please sign in to comment.