mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-23 08:15:29 +01:00
sparsify! in transform and in constrLHS
This commit is contained in:
parent
7dbd11bebf
commit
db55927729
@ -108,7 +108,7 @@ end
|
|||||||
|
|
||||||
function transform(U::AbstractArray, V::AbstractArray; sparse=true)
|
function transform(U::AbstractArray, V::AbstractArray; sparse=true)
|
||||||
if sparse
|
if sparse
|
||||||
return sparsify(U'*V*U)
|
return sparsify!(U'*V*U)
|
||||||
else
|
else
|
||||||
return U'*V*U
|
return U'*V*U
|
||||||
end
|
end
|
||||||
@ -122,10 +122,9 @@ function constrLHS(m::JuMP.Model, data::OrbitData, t)
|
|||||||
return lhs
|
return lhs
|
||||||
end
|
end
|
||||||
|
|
||||||
function constrLHS(m::JuMP.Model, cnstr, Us, Ust, dims, vars)
|
function constrLHS(m::JuMP.Model, cnstr, Us, Ust, dims, vars, eps=100*eps(1.0))
|
||||||
lhs = @expression(m,
|
M = [PropertyT.sparsify!(dims[π].*Ust[π]*cnstr*Us[π], eps) for π in 1:endof(Us)]
|
||||||
sum(vecdot(dims[π].*Ust[π]*cnstr*Us[π], vars[π]) for π in 1:endof(Us)))
|
return @expression(m, sum(vecdot(M[π], vars[π]) for π in 1:endof(Us)))
|
||||||
return lhs
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.laplacian); var::Symbol = :λ)
|
function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.laplacian); var::Symbol = :λ)
|
||||||
|
Loading…
Reference in New Issue
Block a user