Giter Club home page Giter Club logo

Comments (8)

rveltz avatar rveltz commented on June 10, 2024

Hi,

Note that you may be interested in using DefaultLS(false) to remove the need to define factorize.

One thing I noticed (maybe unimportant) is that F returns a MArray when given a SArray.

I cannot even make

########################################################### normal arrays
x = @SVector[-1.0,42.0]
deflated_root = @SVector[Inf,Inf]
deflation = DeflationOperator(1.0, dot, 1.0, [ deflated_root ] )

u, = newton( F, J, x, p, NewtonPar() )                      # success

work. Basically, the methods of KrylovKit have to be defined (see here). How did you solve this?

ERROR: setindex!(::SArray{Tuple{2},Float64,1,2}, value, ::Int) is not defined.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] setindex!(::SArray{Tuple{2},Float64,1,2}, ::Float64, ::Int64) at /Users/rveltz/.julia/packages/StaticArrays/l7lu2/src/indexing.jl:3
 [3] axpy!(::Int64, ::MArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/generic.jl:1390
 [4] minus!(::SArray{Tuple{2},Float64,1,2}, ::MArray{Tuple{2},Float64,1,2}) at /Users/rveltz/work/prog_gd/julia/dev/dev1/BifurcationKit/src/BorderedArrays.jl:99
 [5] newton(::typeof(F), ::typeof(J), ::SArray{Tuple{2},Float64,1,2}, ::NamedTuple{(:k,),Tuple{Array{Float64,1}}}, ::NewtonPar{Float64,DefaultLS,DefaultEig{typeof(real)}}; normN::typeof(LinearAlgebra.norm), callback::Function, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/rveltz/work/prog_gd/julia/dev/dev1/BifurcationKit/src/Newton.jl:116
 [6] newton(::Function, ::Function, ::SArray{Tuple{2},Float64,1,2}, ::NamedTuple{(:k,),Tuple{Array{Float64,1}}}, ::NewtonPar{Float64,DefaultLS,DefaultEig{typeof(real)}}) at /Users/rveltz/work/prog_gd/julia/dev/dev1/BifurcationKit/src/Newton.jl:92
 [7] top-level scope at REPL[47]:1

from bifurcationkit.jl.

gszep avatar gszep commented on June 10, 2024

One thing I noticed (maybe unimportant) is that F returns a MArray when given a SArray.

this is because similar(::SArray) returns an MArray which is mutable. Otherwise you can't assign values F[1] = .... setindex!(::SArray...) is not defined on purpose to prevent mutation. Since netwon has in-place methods similar(::SArray) should be used to convert to mutable type before other methods are called.

I cannot even make

########################################################### normal arrays
x = @SVector[-1.0,42.0]
deflated_root = @SVector[Inf,Inf]
deflation = DeflationOperator(1.0, dot, 1.0, [ deflated_root ] )

u, = newton( F, J, x, p, NewtonPar() )                      # success

work. Basically, the methods of KrylovKit have to be defined (see here). How did you solve this?

I am one subversion of BifurcationKit behind you I think pkg status reads

  [0f109fa4] BifurcationKit v0.1.0
  [f6369f11] ForwardDiff v0.10.12
  [d96e819e] Parameters v0.12.1
  [90137ffa] StaticArrays v0.12.4

from bifurcationkit.jl.

gszep avatar gszep commented on June 10, 2024

Note that you may be interested in using DefaultLS(false) to remove the need to define factorize.

this is very useful thank you! Although it is the BorderedLinearSolver that eventually calls factorize which is sadly not accessible through ContinuationPar. Perhaps it should be? The way I set it at the moment is with the last positional argument linearAlgo of

Cont/PALCIterable(Fhandle, Jhandle, x0, par, lens::Lens, contParams::ContinuationPar, linearAlgo::AbstractBorderedLinearSolver)

from bifurcationkit.jl.

rveltz avatar rveltz commented on June 10, 2024

It should be, you pass MatrixBLS(DefaultLS(false)).

from bifurcationkit.jl.

gszep avatar gszep commented on June 10, 2024

how? currently to pass DefaultLS I have to do this. I can't see a kwarg for to place a MatrixBLS struct

ContinuationPar(newtonOptions=NewtonPar(linsolver=DefaultLS(false)))

from bifurcationkit.jl.

rveltz avatar rveltz commented on June 10, 2024

no, you pass this to continuation as linearAlgo. There are 2 continuation, chose this one

If you pass linearAlgo = MatrixBLS(DefaultLS(false)) to the usual (simple) continuation, it might be overwritten here.

from bifurcationkit.jl.

gszep avatar gszep commented on June 10, 2024

I'm using the iterator interface so I need it initialise ContIterable rather than continuation what I'm suggesting is that rather than having to pass ContinuationPar and linearAlgo in separate positional arguments, linearAlgo should be a field in the ContinuationPar struct and let continuation extract it from there. This way the user only needs to modify ContinuationPar to configure the method

from bifurcationkit.jl.

rveltz avatar rveltz commented on June 10, 2024

Ill think about this.

from bifurcationkit.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.