Skip to content

Commit 397b1c7

Browse files
committed
fix
1 parent 7cc0e38 commit 397b1c7

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

src/graph_tools.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,11 @@ end
249249
Compute the sparsity pattern of the gradient of an expression (that is, a list
250250
of which variable indices are present).
251251
252-
`f` is duck-typed to a `_SubexpressionStorage`-like object exposing `f.nodes`
253-
and `f.sizes`. For `NODE_VARIABLE_BLOCK` nodes, the block's length is read
254-
from `f.sizes` (via `_length`), and the block contributes that many
255-
consecutive variable indices starting at `nodes[k].index`.
252+
`f` is duck-typed (as its type is defined later) to a
253+
`_SubexpressionStorage`-like object exposing `f.nodes` and `f.sizes`.
254+
For `NODE_VARIABLE_BLOCK` nodes, the block's length is read from `f.sizes`
255+
(via `_length`), and the block contributes that many consecutive variable
256+
indices starting at `nodes[k].index`.
256257
"""
257258
function _compute_gradient_sparsity!(indices::Coloring.IndexedSet, f)
258259
for (k, node) in enumerate(f.nodes)
@@ -263,16 +264,11 @@ function _compute_gradient_sparsity!(indices::Coloring.IndexedSet, f)
263264
for i in 0:(len - 1)
264265
push!(indices, node.index + i)
265266
end
266-
elseif node.type == NODE_MOI_VARIABLE
267+
elseif node.type == NODE_MOI_VARIABLE || node.type == NODE_MOI_VARIABLE_BLOCK
267268
error(
268-
"Internal error: Invalid to compute sparsity if NODE_MOI_VARIABLE " *
269+
"Internal error: Invalid to compute sparsity if $(node.type) " *
269270
"nodes are present.",
270271
)
271-
elseif node.type == NODE_MOI_VARIABLE_BLOCK
272-
error(
273-
"Internal error: Invalid to compute sparsity if " *
274-
"NODE_MOI_VARIABLE_BLOCK nodes are present.",
275-
)
276272
end
277273
end
278274
return

0 commit comments

Comments
 (0)