Skip to content

Commit 145d87b

Browse files
fix: respect return_sparsity in generate_cost_hessian
1 parent 294b3b1 commit 145d87b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/systems/codegen.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,10 @@ function generate_cost_hessian(
386386
exprs = Symbolics.hessian(obj, dvs; simplify)
387387
end
388388
res = build_function_wrapper(sys, exprs, dvs, ps...; expression = Val{true}, kwargs...)
389-
return maybe_compile_function(
389+
fn = maybe_compile_function(
390390
expression, wrap_gfw, (2, 2, is_split(sys)), res; eval_expression, eval_module)
391+
392+
return return_sparsity ? (fn, sparsity) : fn
391393
end
392394

393395
function canonical_constraints(sys::System)

0 commit comments

Comments
 (0)