Skip to content

Apply JuliaFormatter to fix code formatting #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function AutoModelingToolkit(; obj_sparse::Bool = false, cons_sparse::Bool = fal
return mtk_to_symbolics(obj_sparse, cons_sparse)
end

function AutoTapir(; safe_mode=true)
function AutoTapir(; safe_mode = true)
Base.depwarn(
"`AutoTapir` is deprecated in favour of `AutoMooncake`.", :AutoTapir; force=false
"`AutoTapir` is deprecated in favour of `AutoMooncake`.", :AutoTapir; force = false
)
return AutoTapir(safe_mode)
end
3 changes: 2 additions & 1 deletion src/symbols.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Auto(package::Symbol, args...; kws...) = Auto(Val(package), args...; kws...)
for backend in (:ChainRules, :Diffractor, :Enzyme, :FastDifferentiation,
:FiniteDiff, :FiniteDifferences, :ForwardDiff, :Mooncake, :PolyesterForwardDiff,
:ReverseDiff, :Symbolics, :Tapir, :Tracker, :Zygote)
@eval Auto(::Val{$(QuoteNode(backend))}, args...; kws...) = $(Symbol(:Auto, backend))(
@eval Auto(::Val{$(QuoteNode(backend))}, args...;
kws...) = $(Symbol(:Auto, backend))(
args...; kws...)
end
2 changes: 1 addition & 1 deletion test/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ end

@testset "AutoTapir" begin
@test_deprecated AutoTapir()
@test_deprecated AutoTapir(; safe_mode=false)
@test_deprecated AutoTapir(; safe_mode = false)
end
8 changes: 8 additions & 0 deletions test/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ end
sd = NoSparsityDetector()

for x in (rand(2), rand(2, 3)), f in (f_jac1, f_jac2)

y = f(x)
Js = jacobian_sparsity(f, x, sd)
@test Js isa AbstractMatrix
Expand All @@ -36,6 +37,7 @@ end
end

for x in (rand(2), rand(2, 3)), y in (rand(5), rand(5, 6))

Js = jacobian_sparsity(f_jac!, y, x, sd)
@test Js isa AbstractMatrix
@test size(Js) == (length(y), length(x))
Expand All @@ -54,6 +56,7 @@ end
@testset "Jacobian sparsity detection" begin
@testset "Out-of-place functions" begin
for sx in ((2,), (2, 3)), f in (f_jac1, f_jac2)

x = rand(sx...)
nx = length(x)
Jref = rand(Bool, 2 * nx, nx)
Expand All @@ -66,6 +69,7 @@ end
end
@testset "In-place functions" begin
for sx in ((2,), (2, 3)), sy in ((5,), (5, 6))

x, y = rand(sx...), rand(sy...)
nx, ny = length(x), length(y)
Jref = rand(Bool, ny, nx)
Expand All @@ -89,9 +93,11 @@ end
@testset "Exceptions: DimensionMismatch" begin
sd = KnownJacobianSparsityDetector(rand(Bool, 6, 7)) # wrong Jacobian size
for x in (rand(2), rand(2, 3)), f in (f_jac1, f_jac2)

@test_throws DimensionMismatch jacobian_sparsity(f, x, sd)
end
for x in (rand(2), rand(2, 3)), y in (rand(5), rand(5, 6))

@test_throws DimensionMismatch jacobian_sparsity(f_jac!, y, x, sd)
end
end
Expand All @@ -114,6 +120,7 @@ end
@testset "Exceptions: Jacobian sparsity detection not supported" begin
@testset "Out-of-place functions" begin
for sx in ((2,), (2, 3)), f in (f_jac1, f_jac2)

x = rand(sx...)
nx = length(x)
Jref = rand(Bool, 2 * nx, nx)
Expand All @@ -123,6 +130,7 @@ end
end
@testset "In-place functions" begin
for sx in ((2,), (2, 3)), sy in ((5,), (5, 6))

x, y = rand(sx...), rand(sy...)
nx, ny = length(x), length(y)
Jref = rand(Bool, ny, nx)
Expand Down
Loading