From 668d403171ff49b875327643f3b31692341ebe32 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Mon, 20 Aug 2018 03:50:16 +0200 Subject: [PATCH] add selective constraint(pm, k) --- src/SDPs.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SDPs.jl b/src/SDPs.jl index 97792ca..6462490 100644 --- a/src/SDPs.jl +++ b/src/SDPs.jl @@ -9,9 +9,14 @@ function constraints(pm::Matrix{I}, total_length=maximum(pm)) where {I<:Integer} return cnstrs end +function constraint(pm::Matrix{I}, k) where {I<:Integer} + cnstr = Vector{I}() + for i in eachindex(pm) + if pm[i] == k + push!(cnstr, i) end end - return constraints + return cnstr end function spLaplacian(RG::GroupRing, S, T::Type=Float64)