-
-
Couldn't load subscription status.
- Fork 56
Explicit imports #646
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
Explicit imports #646
Conversation
| ```@example diagnostics_example | ||
| cache = init(prob, DFSane(); show_trace = Val(true), trace_level = TraceMinimal(50)); | ||
| solve!(cache) | ||
| cache = NLS.init(prob, NLS.DFSane(); show_trace = Val(true), trace_level = NLS.TraceMinimal(50)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| cache = NLS.init(prob, NLS.DFSane(); show_trace = Val(true), trace_level = NLS.TraceMinimal(50)); | |
| cache = NLS.init( | |
| prob, NLS.DFSane(); show_trace = Val(true), trace_level = NLS.TraceMinimal(50)); |
| u0 = CUDA.cu(ones(1000)) | ||
| p = CUDA.cu(collect(1:1000)) | ||
| prob = NLS.NonlinearProblem(f, u0, p) | ||
| sol = NLS.solve(prob, NLS.NewtonRaphson(), abstol=1f-4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| sol = NLS.solve(prob, NLS.NewtonRaphson(), abstol=1f-4) | |
| sol = NLS.solve(prob, NLS.NewtonRaphson(), abstol = 1.0f-4) |
| import Metal # For if you have a Mac M-series device and want to use the built-in GPU | ||
| import OneAPI # For if you have an Intel GPU | ||
|
|
||
| @KernelAbstractions.kernel function parallel_nonlinearsolve_kernel!(result, @Const(prob), @Const(alg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| @KernelAbstractions.kernel function parallel_nonlinearsolve_kernel!(result, @Const(prob), @Const(alg)) | |
| KernelAbstractions.@kernel function parallel_nonlinearsolve_kernel!( | |
| result, @Const(prob), @Const(alg)) |
| out3 = (x[2] - p[3] * x[3])^2 | ||
| out4 = sqrt(p[4]) * (x[1] - x[4]) * (x[1] - x[4]) | ||
| SA[out1,out2,out3,out4] | ||
| StaticArrays.SA[out1,out2,out3,out4] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| StaticArrays.SA[out1,out2,out3,out4] | |
| StaticArrays.SA[out1, out2, out3, out4] |
| p = @SVector [@SVector(rand(Float32, 4)) for _ in 1:1024] | ||
| u0 = SA[1f0, 2f0, 3f0, 4f0] | ||
| p = StaticArrays.@SVector [StaticArrays.@SVector(rand(Float32, 4)) for _ in 1:1024] | ||
| u0 = StaticArrays.SA[1f0, 2f0, 3f0, 4f0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| u0 = StaticArrays.SA[1f0, 2f0, 3f0, 4f0] | |
| u0 = StaticArrays.SA[1.0f0, 2.0f0, 3.0f0, 4.0f0] |
| p_init = zeros(4) | ||
| nlls_prob = NonlinearLeastSquaresProblem(loss_function, p_init, vec(reduce(hcat, sol.u))) | ||
| nlls_prob = NLS.NonlinearLeastSquaresProblem(loss_function, p_init, vec(reduce(hcat, sol.u))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| nlls_prob = NLS.NonlinearLeastSquaresProblem(loss_function, p_init, vec(reduce(hcat, sol.u))) | |
| nlls_prob = NLS.NonlinearLeastSquaresProblem( | |
| loss_function, p_init, vec(reduce(hcat, sol.u))) |
| ```@example parameterized_ode | ||
| res = solve(nlls_prob, LevenbergMarquardt(); maxiters = 1000, show_trace = Val(true), | ||
| trace_level = TraceWithJacobianConditionNumber(25)) | ||
| res = NLS.solve(nlls_prob, NLS.LevenbergMarquardt(); maxiters = 1000, show_trace = Val(true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| res = NLS.solve(nlls_prob, NLS.LevenbergMarquardt(); maxiters = 1000, show_trace = Val(true), | |
| res = NLS.solve( | |
| nlls_prob, NLS.LevenbergMarquardt(); maxiters = 1000, show_trace = Val(true), |
| nlfunc_dense = NonlinearFunction(form_residual!) | ||
| nlfunc_sparse = NonlinearFunction(form_residual!; sparsity = TracerSparsityDetector()) | ||
| nlfunc_dense = NLS.NonlinearFunction(form_residual!) | ||
| nlfunc_sparse = NLS.NonlinearFunction(form_residual!; sparsity = SparseConnectivityTracer.TracerSparsityDetector()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| nlfunc_sparse = NLS.NonlinearFunction(form_residual!; sparsity = SparseConnectivityTracer.TracerSparsityDetector()) | |
| nlfunc_sparse = NLS.NonlinearFunction( | |
| form_residual!; sparsity = SparseConnectivityTracer.TracerSparsityDetector()) |
| prob_brusselator_2d_autosparse = NonlinearProblem( | ||
| NonlinearFunction(brusselator_2d_loop; sparsity = TracerSparsityDetector()), | ||
| prob_brusselator_2d_autosparse = NLS.NonlinearProblem( | ||
| NLS.NonlinearFunction(brusselator_2d_loop; sparsity = SparseConnectivityTracer.TracerSparsityDetector()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| NLS.NonlinearFunction(brusselator_2d_loop; sparsity = SparseConnectivityTracer.TracerSparsityDetector()), | |
| NLS.NonlinearFunction( | |
| brusselator_2d_loop; sparsity = SparseConnectivityTracer.TracerSparsityDetector()), |
| f! = (du, u) -> brusselator_2d_loop(du, u, p) | ||
| du0 = similar(u0) | ||
| jac_sparsity = ADTypes.jacobian_sparsity(f!, du0, u0, TracerSparsityDetector()) | ||
| jac_sparsity = ADTypes.jacobian_sparsity(f!, du0, u0, SparseConnectivityTracer.TracerSparsityDetector()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| jac_sparsity = ADTypes.jacobian_sparsity(f!, du0, u0, SparseConnectivityTracer.TracerSparsityDetector()) | |
| jac_sparsity = ADTypes.jacobian_sparsity( | |
| f!, du0, u0, SparseConnectivityTracer.TracerSparsityDetector()) |
| @btime solve(prob_brusselator_2d_sparse, NewtonRaphson(linsolve = KLUFactorization())); | ||
| BenchmarkTools.@btime NLS.solve(prob_brusselator_2d, NLS.NewtonRaphson()); | ||
| BenchmarkTools.@btime NLS.solve(prob_brusselator_2d_sparse, NLS.NewtonRaphson()); | ||
| BenchmarkTools.@btime NLS.solve(prob_brusselator_2d_sparse, NLS.NewtonRaphson(linsolve = LS.KLUFactorization())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| BenchmarkTools.@btime NLS.solve(prob_brusselator_2d_sparse, NLS.NewtonRaphson(linsolve = LS.KLUFactorization())); | |
| BenchmarkTools.@btime NLS.solve( | |
| prob_brusselator_2d_sparse, NLS.NewtonRaphson(linsolve = LS.KLUFactorization())); |
|
|
||
| ```@example ill_conditioned_nlprob | ||
| @btime solve(prob_brusselator_2d, NewtonRaphson(linsolve = KrylovJL_GMRES())); | ||
| BenchmarkTools.@btime NLS.solve(prob_brusselator_2d, NLS.NewtonRaphson(linsolve = LS.KrylovJL_GMRES())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| BenchmarkTools.@btime NLS.solve(prob_brusselator_2d, NLS.NewtonRaphson(linsolve = LS.KrylovJL_GMRES())); | |
| BenchmarkTools.@btime NLS.solve( | |
| prob_brusselator_2d, NLS.NewtonRaphson(linsolve = LS.KrylovJL_GMRES())); |
| @btime solve(prob_brusselator_2d_sparse, | ||
| NewtonRaphson(linsolve = KrylovJL_GMRES(precs = incompletelu), concrete_jac = true) | ||
| BenchmarkTools.@btime NLS.solve(prob_brusselator_2d_sparse, | ||
| NLS.NewtonRaphson(linsolve = LS.KrylovJL_GMRES(precs = incompletelu), concrete_jac = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| NLS.NewtonRaphson(linsolve = LS.KrylovJL_GMRES(precs = incompletelu), concrete_jac = true) | |
| NLS.NewtonRaphson( | |
| linsolve = LS.KrylovJL_GMRES(precs = incompletelu), concrete_jac = true) |
| function algebraicmultigrid(W, p = nothing) | ||
| return aspreconditioner(ruge_stuben(convert(AbstractMatrix, W))), LinearAlgebra.I | ||
| return AlgebraicMultigrid.aspreconditioner(AlgebraicMultigrid.ruge_stuben(convert(AbstractMatrix, W))), LinearAlgebra.I |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| return AlgebraicMultigrid.aspreconditioner(AlgebraicMultigrid.ruge_stuben(convert(AbstractMatrix, W))), LinearAlgebra.I | |
| return AlgebraicMultigrid.aspreconditioner(AlgebraicMultigrid.ruge_stuben(convert( | |
| AbstractMatrix, W))), | |
| LinearAlgebra.I |
| prob_brusselator_2d_exact_tracer = NonlinearProblem( | ||
| NonlinearFunction(brusselator_2d_loop; sparsity = TracerSparsityDetector()), | ||
| prob_brusselator_2d_exact_tracer = NLS.NonlinearProblem( | ||
| NLS.NonlinearFunction(brusselator_2d_loop; sparsity = SparseConnectivityTracer.TracerSparsityDetector()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| NLS.NonlinearFunction(brusselator_2d_loop; sparsity = SparseConnectivityTracer.TracerSparsityDetector()), | |
| NLS.NonlinearFunction( | |
| brusselator_2d_loop; sparsity = SparseConnectivityTracer.TracerSparsityDetector()), |
| sparsity = DenseSparsityDetector(AutoForwardDiff(); atol = 1e-4)), | ||
| prob_brusselator_2d_approx_di = NLS.NonlinearProblem( | ||
| NLS.NonlinearFunction(brusselator_2d_loop; | ||
| sparsity = DifferentiationInterface.DenseSparsityDetector(ADTypes.AutoForwardDiff(); atol = 1e-4)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| sparsity = DifferentiationInterface.DenseSparsityDetector(ADTypes.AutoForwardDiff(); atol = 1e-4)), | |
| sparsity = DifferentiationInterface.DenseSparsityDetector( | |
| ADTypes.AutoForwardDiff(); atol = 1e-4)), |
ec72c4c to
c0cb859
Compare
| NonlinearSolveSciPy.SciPyLeastSquares | ||
| NonlinearSolveSciPy.SciPyRoot | ||
| NonlinearSolveSciPy.SciPyRootScalar | ||
| ``` No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| ``` | |
| ``` |
No description provided.