1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 02:15:29 +01:00

sparsify! in transform and in constrLHS

This commit is contained in:
kalmarek 2017-08-27 18:59:16 +02:00
parent 7dbd11bebf
commit db55927729

View File

@ -108,7 +108,7 @@ end
function transform(U::AbstractArray, V::AbstractArray; sparse=true)
if sparse
return sparsify(U'*V*U)
return sparsify!(U'*V*U)
else
return U'*V*U
end
@ -122,10 +122,9 @@ function constrLHS(m::JuMP.Model, data::OrbitData, t)
return lhs
end
function constrLHS(m::JuMP.Model, cnstr, Us, Ust, dims, vars)
lhs = @expression(m,
sum(vecdot(dims[π].*Ust[π]*cnstr*Us[π], vars[π]) for π in 1:endof(Us)))
return lhs
function constrLHS(m::JuMP.Model, cnstr, Us, Ust, dims, vars, eps=100*eps(1.0))
M = [PropertyT.sparsify!(dims[π].*Ust[π]*cnstr*Us[π], eps) for π in 1:endof(Us)]
return @expression(m, sum(vecdot(M[π], vars[π]) for π in 1:endof(Us)))
end
function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.laplacian); var::Symbol = )