Skip to content

Commit bde8358

Browse files
Merge pull request #527 from SciML/ChrisRackauckas-patch-2
Fix hessian_sparsity documentation?
2 parents 53ae2cd + 6d3e162 commit bde8358

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/direct.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ end
100100

101101
isidx(x) = x isa TermCombination
102102

103+
"""
104+
```julia
105+
hessian_sparsity(ops::AbstractVector{<:Expression}, vars::AbstractVector{<:Expression})
106+
```
107+
108+
Return the sparsity pattern of the Hessian of an array of expressions with respect to
109+
an array of variable expressions.
110+
"""
111+
function hessian_sparsity end
112+
103113
let
104114
_scalar = one(TermCombination)
105115

@@ -123,17 +133,8 @@ let
123133
end
124134
end] |> Rewriters.Chain |> Rewriters.Postwalk |> Rewriters.Fixpoint
125135

126-
# we do this in a let block so that Revise works on the list of rules
127136
global hessian_sparsity
128-
129-
"""
130-
```julia
131-
hessian_sparsity(ops::AbstractVector{<:Expression}, vars::AbstractVector{<:Expression})
132-
```
133-
134-
Return the sparsity pattern of the Hessian of an array of expressions with respect to
135-
an array of variable expressions.
136-
"""
137+
# we do this in a let block so that Revise works on the list of rules
137138
function hessian_sparsity(f, u)
138139
idx(i) = TermCombination(Set([Dict(i=>1)]))
139140
dict = Dict(SymbolicUtils.to_symbolic.(u) .=> idx.(1:length(u)))

0 commit comments

Comments
 (0)