Giter VIP home page Giter VIP logo

Comments (9)

jlperla avatar jlperla commented on June 15, 2024 1

@pkofod I just checked, and with the using added above at the top is the full example.

But just to confirm to all: this is low priority. Would be nice to have it at some point in the future, but not sure I want to spend any time on this for a while.

from lecture-source-jl.

arnavs avatar arnavs commented on June 15, 2024

The issue is with this line of code which turns out of place functions into in-place functions. I think it's trying to put a DualNumber in a Float64 array, which fails.

Will see how to patch. cc: @pkofod

from lecture-source-jl.

pkofod avatar pkofod commented on June 15, 2024

This should be a simple fix

from lecture-source-jl.

jlperla avatar jlperla commented on June 15, 2024

It may not be. I don't think it is that function which has issues, so much of how the F is pre-allocated

It could require replacing a whole bunch of buffers inside of the underlying algorihtms to use similar to x instead of assuming they are reals vectors... or something like that.

This is low priority for sure.

from lecture-source-jl.

arnavs avatar arnavs commented on June 15, 2024

@pkofod Just ran JuliaNLSolvers/NLsolve.jl#188, and it didn't work. No worries, guess this is more complicated than I figured.

from lecture-source-jl.

pkofod avatar pkofod commented on June 15, 2024

Can I please get the full exampe?

from lecture-source-jl.

arnavs avatar arnavs commented on June 15, 2024

Code is same as above. Error is:

Arnav Sood@ARTS-ECON-ARNAV MINGW64 ~/desktop
$ julia adtest.jl
fp([0.1, 2.0]) = 2.2222222208
ERROR: LoadError: MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2})
Closest candidates are:
  Float64(::Real, !Matched::RoundingMode) where T<:AbstractFloat at rounding.jl:185
  Float64(::T<:Number) where T<:Number at boot.jl:725
  Float64(!Matched::Int8) at float.jl:60
  ...
Stacktrace:
 [1] convert(::Type{Float64}, ::ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2}) at .\number.jl:7
 [2] setindex!(::Array{Float64,1}, ::ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2}, ::Int64) at .\array.jl:769
 [3] copyto! at .\abstractarray.jl:731 [inlined]
 [4] copyto! at .\abstractarray.jl:723 [inlined]
 [5] (::getfield(NLSolversBase, Symbol("#ff!#1")){getfield(NLsolve, Symbol("#g#22")){getfield(Main, Symbol("##3#4")){ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2},ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2}}}})(::Array{Float64,1}, ::SubArray{Float64,1,Array{Float64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at C:\Users\Arnav Sood\.julia\packages\NLSolversBase\ylZ0n\src\objective_types\inplace_factory.jl:11
 [6] value!!(::OnceDifferentiable{Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}, ::SubArray{Float64,1,Array{Float64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at C:\Users\Arnav Sood\.julia\packages\NLSolversBase\ylZ0n\src\interface.jl:178
 [7] anderson_(::OnceDifferentiable{Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}, ::Float64, ::Float64, ::Int64, ::Bool, ::Bool, ::Bool, ::Int64, ::Float64, ::NLsolve.AndersonCache{Array{Float64,2},Array{Float64,1},Array{Float64,1},Array{Float64,1}}) at C:\Users\Arnav Sood\.julia\dev\NLsolve\src\solvers\anderson.jl:54
 [8] anderson at C:\Users\Arnav Sood\.julia\dev\NLsolve\src\solvers\anderson.jl:122 [inlined] (repeats 2 times)
 [9] #nlsolve#14(::Symbol, ::Float64, ::Float64, ::Int64, ::Bool, ::Bool, ::Bool, ::Static, ::Float64, ::Bool, ::Int64, ::Float64, ::typeof(nlsolve), ::OnceDifferentiable{Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}) at C:\Users\Arnav Sood\.julia\dev\NLsolve\src\nlsolve\nlsolve.jl:27
 [10] #nlsolve at .\none:0 [inlined]
 [11] #fixedpoint#20(::Symbol, ::Float64, ::Float64, ::Int64, ::Bool, ::Bool, ::Bool, ::Static, ::Float64, ::Bool, ::Int64, ::Float64, ::Symbol, ::Bool, ::typeof(fixedpoint), ::getfield(Main, Symbol("##3#4")){ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2},ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2}}, ::Array{Float64,1}) at C:\Users\Arnav Sood\.julia\dev\NLsolve\src\nlsolve\fixedpoint.jl:33
 [12] #fixedpoint at .\none:0 [inlined]
 [13] fp at C:\Users\Arnav Sood\desktop\adtest.jl:5 [inlined]
 [14] #5 at C:\Users\Arnav Sood\desktop\adtest.jl:11 [inlined]
 [15] vector_mode_dual_eval(::getfield(Main, Symbol("##5#6")), ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2},1}}) at C:\Users\Arnav Sood\.julia\packages\ForwardDiff\hnKaN\src\apiutils.jl:35
 [16] vector_mode_gradient(::getfield(Main, Symbol("##5#6")), ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2},1}}) at C:\Users\Arnav Sood\.julia\packages\ForwardDiff\hnKaN\src\gradient.jl:96
 [17] gradient(::Function, ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2},1}}, ::Val{true}) at C:\Users\Arnav Sood\.julia\packages\ForwardDiff\hnKaN\src\gradient.jl:17
 [18] gradient(::Function, ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2,Array{ForwardDiff.Dual{ForwardDiff.Tag{getfield(Main, Symbol("##5#6")),Float64},Float64,2},1}}) at C:\Users\Arnav Sood\.julia\packages\ForwardDiff\hnKaN\src\gradient.jl:15 (repeats 2 times)
 [19] top-level scope at show.jl:555
 [20] include at .\boot.jl:317 [inlined]
 [21] include_relative(::Module, ::String) at .\loading.jl:1038
 [22] include(::Module, ::String) at .\sysimg.jl:29
 [23] exec_options(::Base.JLOptions) at .\client.jl:229
 [24] _start() at .\client.jl:421
in expression starting at C:\Users\Arnav Sood\desktop\adtest.jl:11

from lecture-source-jl.

pkofod avatar pkofod commented on June 15, 2024

Ah, now I get the problem. I thought you got the issue in a call to fixedpoint. You want to find the change in the fixedpoint when a parameter changes, right?

from lecture-source-jl.

arnavs avatar arnavs commented on June 15, 2024

@pkofod That's right. I don't think Jesse and I have enough manpower to iterate on this specific issue, but mainly wanted to bring it to your attention.

from lecture-source-jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.