@@ -48,9 +48,9 @@ function find_sparsity_patterns!(ws::COSMO.Workspace)
48
48
end
49
49
end
50
50
51
- analyse_sparsity_pattern! (ci:: ChordalInfo , csp:: Array{Int64 , 1} , sets:: Vector{AbstractConvexSet} , C:: AbstractConvexSet , k:: Int64 , psd_row_range:: UnitRange{Int64 } , sp_ind:: Int64 , merge_strategy:: Union{Type{<: AbstractMergeStrategy}, OptionsFactory{<: AbstractMergeStrategy}} ) = sp_ind
51
+ analyse_sparsity_pattern! (ci:: ChordalInfo , csp:: Array{Int , 1} , sets:: Vector{AbstractConvexSet} , C:: AbstractConvexSet , k:: Int , psd_row_range:: UnitRange{Int } , sp_ind:: Int , merge_strategy:: Union{Type{<: AbstractMergeStrategy}, OptionsFactory{<: AbstractMergeStrategy}} ) = sp_ind
52
52
53
- function analyse_sparsity_pattern! (ci:: ChordalInfo , csp:: Array{Int64 , 1} , sets:: Vector{AbstractConvexSet} , C:: DecomposableCones{T} , k:: Int64 , psd_row_range:: UnitRange{Int64 } , sp_ind:: Int64 , merge_strategy:: Union{Type{<: AbstractMergeStrategy}, OptionsFactory{<: AbstractMergeStrategy}} ) where {T <: Real }
53
+ function analyse_sparsity_pattern! (ci:: ChordalInfo , csp:: Array{Int , 1} , sets:: Vector{AbstractConvexSet} , C:: DecomposableCones{T} , k:: Int , psd_row_range:: UnitRange{Int } , sp_ind:: Int , merge_strategy:: Union{Type{<: AbstractMergeStrategy}, OptionsFactory{<: AbstractMergeStrategy}} ) where {T <: Real }
54
54
if length (csp) < C. dim
55
55
return _analyse_sparsity_pattern (ci, csp, sets, C, k, psd_row_range, sp_ind, merge_strategy)
56
56
else
@@ -59,7 +59,7 @@ function analyse_sparsity_pattern!(ci::ChordalInfo, csp::Array{Int64, 1}, sets::
59
59
end
60
60
end
61
61
62
- function _analyse_sparsity_pattern (ci:: ChordalInfo{T} , csp:: Array{Int64 , 1} , sets:: Vector{AbstractConvexSet} , C:: Union{PsdCone{T}, PsdConeTriangle{T}} , k:: Int64 , psd_row_range:: UnitRange{Int64 } , sp_ind:: Int64 , merge_strategy:: Union{Type{<: AbstractMergeStrategy}, OptionsFactory{<: AbstractMergeStrategy}} ) where {T <: AbstractFloat }
62
+ function _analyse_sparsity_pattern (ci:: ChordalInfo{T} , csp:: Array{Int , 1} , sets:: Vector{AbstractConvexSet} , C:: Union{PsdCone{T}, PsdConeTriangle{T}} , k:: Int , psd_row_range:: UnitRange{Int } , sp_ind:: Int , merge_strategy:: Union{Type{<: AbstractMergeStrategy}, OptionsFactory{<: AbstractMergeStrategy}} ) where {T <: AbstractFloat }
63
63
ordering, nz_ind_map = find_graph! (ci, csp, C. sqrt_dim, C)
64
64
sp = COSMO. SparsityPattern (ci. L, C. sqrt_dim, ordering, merge_strategy, psd_row_range, k, nz_ind_map)
65
65
# if after analysis of SparsityPattern & clique merging only one clique remains, don't bother decomposing
@@ -74,10 +74,10 @@ function _analyse_sparsity_pattern(ci::ChordalInfo{T}, csp::Array{Int64, 1}, set
74
74
end
75
75
end
76
76
77
- DenseEquivalent (C:: COSMO.PsdCone{T} , dim:: Int64 ) where {T <: AbstractFloat } = COSMO. DensePsdCone {T} (dim)
78
- DenseEquivalent (C:: COSMO.PsdConeTriangle{T} , dim:: Int64 ) where {T <: AbstractFloat } = COSMO. DensePsdConeTriangle {T} (dim)
77
+ DenseEquivalent (C:: COSMO.PsdCone{T} , dim:: Int ) where {T <: AbstractFloat } = COSMO. DensePsdCone {T} (dim)
78
+ DenseEquivalent (C:: COSMO.PsdConeTriangle{T} , dim:: Int ) where {T <: AbstractFloat } = COSMO. DensePsdConeTriangle {T} (dim)
79
79
80
- function nz_rows (a:: SparseMatrixCSC{T} , ind:: UnitRange{Int64 } , DROP_ZEROS_FLAG:: Bool ) where {T <: AbstractFloat }
80
+ function nz_rows (a:: SparseMatrixCSC{T} , ind:: UnitRange{Int } , DROP_ZEROS_FLAG:: Bool ) where {T <: AbstractFloat }
81
81
DROP_ZEROS_FLAG && dropzeros! (a)
82
82
active = falses (length (ind))
83
83
for r in a. rowval
@@ -96,14 +96,14 @@ function number_of_overlaps_in_rows(A::SparseMatrixCSC{T}) where {T <: AbstractF
96
96
end
97
97
98
98
99
- function find_aggregate_sparsity (A:: SparseMatrixCSC{T} , b:: AbstractVector{T} , ind:: UnitRange{Int64 } , C:: DecomposableCones{T} ) where {T <: AbstractFloat }
99
+ function find_aggregate_sparsity (A:: SparseMatrixCSC{T} , b:: AbstractVector{T} , ind:: UnitRange{Int } , C:: DecomposableCones{T} ) where {T <: AbstractFloat }
100
100
AInd = nz_rows (A, ind, false )
101
101
# commonZeros = AInd[find(x->x==0,b[AInd])]
102
102
bInd = findall (x -> x != 0 , view (b, ind))
103
103
commonNZeros = union (AInd, bInd)
104
104
return commonNZeros
105
105
end
106
- find_aggregate_sparsity (A:: SparseMatrixCSC{T} , b:: AbstractVector{T} , ind:: UnitRange{Int64 } , C:: AbstractConvexSet{T} ) where {T <: AbstractFloat } = Int64 []
106
+ find_aggregate_sparsity (A:: SparseMatrixCSC{T} , b:: AbstractVector{T} , ind:: UnitRange{Int } , C:: AbstractConvexSet{T} ) where {T <: AbstractFloat } = Int []
107
107
108
108
109
109
"""
@@ -157,7 +157,7 @@ function fill_dual_variables!(ws::COSMO.Workspace{T}, vars::COSMO.Variables{T})
157
157
return nothing
158
158
end
159
159
160
- function add_sub_blocks! (s:: SplitVector{T} , s_decomp:: SplitVector{T} , μ:: AbstractVector{T} , μ_decomp:: AbstractVector{T} , ci:: ChordalInfo{T} , C:: CompositeConvexSet{T} , C0:: CompositeConvexSet{T} , cone_map:: Dict{Int64, Int64 } ) where {T <: AbstractFloat }
160
+ function add_sub_blocks! (s:: SplitVector{T} , s_decomp:: SplitVector{T} , μ:: AbstractVector{T} , μ_decomp:: AbstractVector{T} , ci:: ChordalInfo{T} , C:: CompositeConvexSet{T} , C0:: CompositeConvexSet{T} , cone_map:: Dict{Int, Int } ) where {T <: AbstractFloat }
161
161
sp_arr = ci. sp_arr
162
162
row_start = 1 # the row pointer in the decomposed problem
163
163
row_ranges = get_set_indices (C0. sets) # the row ranges of the same cone (or "parent" cone) in the original problem
@@ -170,14 +170,14 @@ function add_sub_blocks!(s::SplitVector{T}, s_decomp::SplitVector{T}, μ::Abstra
170
170
return nothing
171
171
end
172
172
173
- function add_blocks! (s:: SplitVector{T} , μ:: AbstractVector{T} , row_start:: Int64 , row_range:: UnitRange{Int64 } , sp_arr:: Array{SparsityPattern, 1} , s_decomp:: SplitVector{T} , μ_decomp:: AbstractVector{T} , C:: AbstractConvexSet{T} ) where {T <: AbstractFloat }
173
+ function add_blocks! (s:: SplitVector{T} , μ:: AbstractVector{T} , row_start:: Int , row_range:: UnitRange{Int } , sp_arr:: Array{SparsityPattern, 1} , s_decomp:: SplitVector{T} , μ_decomp:: AbstractVector{T} , C:: AbstractConvexSet{T} ) where {T <: AbstractFloat }
174
174
175
175
@. s. data[row_range] = s_decomp. data[row_start: row_start + C. dim - 1 ]
176
176
@. μ[row_range] = μ_decomp[row_start: row_start + C. dim - 1 ]
177
177
return row_start + C. dim
178
178
end
179
179
180
- function add_blocks! (s:: SplitVector{T} , μ:: AbstractVector{T} , row_start:: Int64 , row_range:: UnitRange{Int64 } , sp_arr:: Array{SparsityPattern, 1} , s_decomp:: SplitVector{T} , μ_decomp:: AbstractVector{T} , C:: DecomposableCones{T} ) where {T <: AbstractFloat }
180
+ function add_blocks! (s:: SplitVector{T} , μ:: AbstractVector{T} , row_start:: Int , row_range:: UnitRange{Int } , sp_arr:: Array{SparsityPattern, 1} , s_decomp:: SplitVector{T} , μ_decomp:: AbstractVector{T} , C:: DecomposableCones{T} ) where {T <: AbstractFloat }
181
181
# load the appropriate sparsity_pattern
182
182
sp = sp_arr[C. tree_ind]
183
183
sntree = sp. sntree
@@ -217,9 +217,9 @@ function psd_completion!(ws::COSMO.Workspace)
217
217
return nothing
218
218
end
219
219
220
- complete! (μ:: AbstractVector{T} , :: AbstractConvexSet{T} , sp_arr:: Array{SparsityPattern} , sp_ind:: Int64 , rows:: UnitRange{Int64 } ) where {T <: AbstractFloat } = sp_ind
220
+ complete! (μ:: AbstractVector{T} , :: AbstractConvexSet{T} , sp_arr:: Array{SparsityPattern} , sp_ind:: Int , rows:: UnitRange{Int } ) where {T <: AbstractFloat } = sp_ind
221
221
222
- function complete! (μ:: AbstractVector{T} , C:: PsdCone{T} , sp_arr:: Array{SparsityPattern} , sp_ind:: Int64 , rows:: UnitRange{Int64 } ) where {T <: AbstractFloat }
222
+ function complete! (μ:: AbstractVector{T} , C:: PsdCone{T} , sp_arr:: Array{SparsityPattern} , sp_ind:: Int , rows:: UnitRange{Int } ) where {T <: AbstractFloat }
223
223
sp = sp_arr[sp_ind]
224
224
225
225
μ_view = view (μ, rows)
@@ -234,7 +234,7 @@ function complete!(μ::AbstractVector{T}, C::PsdCone{T}, sp_arr::Array{SparsityP
234
234
return sp_ind + 1
235
235
end
236
236
237
- function complete! (μ:: AbstractVector{T} , C:: PsdConeTriangle{T} , sp_arr:: Array{SparsityPattern} , sp_ind:: Int64 , rows:: UnitRange{Int64 } ) where {T <: AbstractFloat }
237
+ function complete! (μ:: AbstractVector{T} , C:: PsdConeTriangle{T} , sp_arr:: Array{SparsityPattern} , sp_ind:: Int , rows:: UnitRange{Int } ) where {T <: AbstractFloat }
238
238
sp = sp_arr[sp_ind]
239
239
240
240
μ_view = view (μ, rows)
250
250
251
251
# positive semidefinite completion (from Vandenberghe - Chordal Graphs..., p. 362)
252
252
# input: A - positive definite completable matrix
253
- function psd_complete! (A:: AbstractMatrix{T} , N:: Int64 , sntree:: SuperNodeTree , p:: Array{Int64 } ) where {T <: AbstractFloat }
253
+ function psd_complete! (A:: AbstractMatrix{T} , N:: Int , sntree:: SuperNodeTree , p:: Array{Int } ) where {T <: AbstractFloat }
254
254
255
255
# if a clique graph based merge strategy was used for this sparsity pattern, recompute a valid clique tree
256
256
# recompute_clique_tree(sntree.strategy) && clique_tree_from_graph!(sntree, sntree.strategy)
0 commit comments