You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/faq.md
+3-8Lines changed: 3 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,16 +15,11 @@ However, this can be switched to any other "inner" backend compatible with [Diff
15
15
16
16
## Input and output types
17
17
18
-
### Vectors
19
-
20
-
Functions that eat or spit out arbitrary vectors are supported, as long as the forward mapping _and_ conditions return vectors of the same size.
21
-
22
-
If you deal with small vectors (say, less than 100 elements), consider using [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) for increased performance.
23
-
24
18
### Arrays
25
19
26
-
Functions that eat or spit out matrices and higher-order tensors are not supported.
27
-
You can use `vec` and `reshape` for the conversion to and from vectors.
20
+
Functions that eat or spit out arbitrary arrays are supported, as long as the forward mapping _and_ conditions return arrays of the same size.
21
+
22
+
If you deal with small arrays (say, less than 100 elements), consider using [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) for increased performance.
Copy file name to clipboardExpand all lines: examples/0_intro.jl
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,15 +29,15 @@ This is essentially the componentwise square root function but with an additiona
29
29
We can check that it does what it's supposed to do.
30
30
=#
31
31
32
-
x = [4.0, 9.0]
32
+
x = [1.02.0; 3.04.0]
33
33
badsqrt(x)
34
34
@testbadsqrt(x) ≈sqrt.(x) #src
35
35
36
36
#=
37
37
Of course the Jacobian has an explicit formula.
38
38
=#
39
39
40
-
J =Diagonal(0.5./sqrt.(x))
40
+
J =Diagonal(0.5./vec(sqrt.(x)))
41
41
42
42
#=
43
43
However, things start to go wrong when we compute it with autodiff, due to the [limitations of ForwardDiff.jl](https://juliadiff.org/ForwardDiff.jl/stable/user/limitations/) and [those of Zygote.jl](https://fluxml.ai/Zygote.jl/stable/limitations/).
Copy file name to clipboardExpand all lines: src/implicit_function.jl
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ This requires solving a linear system `A * J = -B` where `A = ∂₂c`, `B = ∂
29
29
30
30
## Positional arguments
31
31
32
-
- `solver`: a callable returning `(x, args...) -> (y, z)` where `z` is an arbitrary byproduct of the solve. Both `x` and `y` must be subtypes of `AbstractVector`, while `z` and `args` can be anything.
32
+
- `solver`: a callable returning `(x, args...) -> (y, z)` where `z` is an arbitrary byproduct of the solve. Both `x` and `y` must be subtypes of `AbstractArray`, while `z` and `args` can be anything.
33
33
- `conditions`: a callable returning a vector of optimality conditions `(x, y, z, args...) -> c`, must be compatible with automatic differentiation
34
34
35
35
## Keyword arguments
@@ -127,6 +127,6 @@ function Base.show(io::IO, implicit::ImplicitFunction)
127
127
)
128
128
end
129
129
130
-
function (implicit::ImplicitFunction)(x::AbstractVector, args::Vararg{Any,N}) where {N}
130
+
function (implicit::ImplicitFunction)(x::AbstractArray, args::Vararg{Any,N}) where {N}
0 commit comments