Skip to content

Commit

Permalink
Cleanup before release (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle authored Jun 25, 2024
1 parent 738b482 commit e0f156c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CITATION.bib
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ @misc{ImplicitDifferentiation.jl
url = {https://github.com/gdalle/ImplicitDifferentiation.jl},
version = {v0.6.0},
year = {2024},
month = {4}
month = {6}
}

@phdthesis{dalle:tel-04053322,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ If you want a deeper dive into the theory, you can refer to the paper [_Efficien
To install the stable version, open a Julia REPL and run:

```julia
julia> using Pkg; Pkg.add("ImplicitDifferentiation")
using Pkg; Pkg.add("ImplicitDifferentiation")
```

For the latest version, run this instead:

```julia
julia> using Pkg; Pkg.add(url="https://github.com/JuliaDecisionFocusedLearning/ImplicitDifferentiation.jl")
using Pkg; Pkg.add(url="https://github.com/JuliaDecisionFocusedLearning/ImplicitDifferentiation.jl")
```

Please read the [documentation](https://JuliaDecisionFocusedLearning.github.io/ImplicitDifferentiation.jl/stable/), especially the examples and FAQ.
Expand Down
6 changes: 3 additions & 3 deletions examples/0_intro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ We represent it using a type called [`ImplicitFunction`](@ref), which you will s
=#

#=
First we define a forward mapping corresponding to the function we consider.
First we define a `forward` mapping corresponding to the function we consider.
It returns the actual output $y(x)$ of the function, and can be thought of as a black box solver.
Importantly, this Julia callable _doesn't need to be differentiable by automatic differentiation packages but the underlying function still needs to be mathematically differentiable_.
Importantly, this Julia callable doesn't need to be differentiable by automatic differentiation packages but the underlying function still needs to be mathematically differentiable.
=#

forward(x) = badsqrt(x);

#=
Then we define `conditions` $c(x, y) = 0$ that the output $y(x)$ is supposed to satisfy.
These conditions must be array-valued, with the same size as $y$.
Unlike the forward mapping, _the conditions need to be differentiable by automatic differentiation packages_ with respect to both $x$ and $y$.
Unlike the forward mapping, the conditions need to be differentiable by automatic differentiation packages with respect to both $x$ and $y$.
Here the conditions are very obvious: the square of the square root should be equal to the original value.
=#

Expand Down
2 changes: 1 addition & 1 deletion examples/1_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ForwardDiff.jacobian(_x -> implicit_optim(_x; method=LBFGS()), x)
@test ForwardDiff.jacobian(_x -> implicit_optim(_x; method=LBFGS()), x) J #src

#=
In this instance, we could use ForwardDiff.jl directly on the solver, but it returns the wrong result (not sure why).
In this instance, we could use ForwardDiff.jl directly on the solver:
=#

ForwardDiff.jacobian(_x -> forward_optim(_x; method=LBFGS()), x)
Expand Down
3 changes: 1 addition & 2 deletions examples/2_advanced.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# # Advanced use cases

#=
We dive into more advanced applications of implicit differentiation:
- constrained optimization problems
We dive into more advanced applications of implicit differentiation.
=#

using ForwardDiff
Expand Down
2 changes: 1 addition & 1 deletion examples/3_tricks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function conditions_components_aux(a, b, m, d, e)
return c_d, c_e
end;

# You can use `ComponentVector` as an intermediate storage.
# You can use `ComponentVector` from [ComponentArrays.jl](https://github.com/jonniedie/ComponentArrays.jl) as an intermediate storage.

function forward_components(x::ComponentVector)
d, e = forward_components_aux(x.a, x.b, x.m)
Expand Down
8 changes: 4 additions & 4 deletions src/implicit_function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ The value of `lazy` must be chosen together with the `linear_solver`, see below.
- `forward`: a callable computing `y(x)`, does not need to be compatible with automatic differentiation
- `conditions`: a callable computing `c(x, y)`, must be compatible with automatic differentiation
- `linear_solver`: a callable to solve the linear system
- `conditions_x_backend`: defines how the conditions will be differentiated with respect to the first argument `x`
- `conditions_y_backend`: defines how the conditions will be differentiated with respect to the second argument `y`
- `conditions_x_backend`: how the conditions will be differentiated w.r.t. the first argument `x`
- `conditions_y_backend`: how the conditions will be differentiated w.r.t. the second argument `y`
# Function signatures
Expand All @@ -79,7 +79,7 @@ The byproduct `z` and the other positional arguments `args...` beyond `x` are co
The provided `linear_solver` objects needs to be callable, with two methods:
- `(A, b::AbstractVector) -> s::AbstractVector` such that `A * s = b`
- `(A, B::AbstractVector) -> S::AbstractMatrix` such that `A * S = B`
- `(A, B::AbstractMatrix) -> S::AbstractMatrix` such that `A * S = B`
It can be either a direct solver (like `\\`) or an iterative one (like [`KrylovLinearSolver`](@ref)).
Typically, direct solvers work best with dense Jacobians (`lazy = false`) while iterative solvers work best with operators (`lazy = true`).
Expand All @@ -105,7 +105,7 @@ end
forward, conditions;
linear_solver=lazy ? KrylovLinearSolver() : \\,
conditions_x_backend=nothing,
conditions_x_backend=nothing,
conditions_y_backend=nothing,
)
Constructor for an [`ImplicitFunction`](@ref) which picks the `linear_solver` automatically based on the `lazy` parameter.
Expand Down

2 comments on commit e0f156c

@gdalle
Copy link
Member Author

@gdalle gdalle commented on e0f156c Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/109732

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" e0f156c695332dd72d4876b2ab0089598bad74bd
git push origin v0.6.0

Please sign in to comment.