Giter Site home page Giter Site logo

How to add new primitives? about ransac.jl HOT 2 CLOSED

csertegt3 avatar csertegt3 commented on September 12, 2024
How to add new primitives?

from ransac.jl.

Comments (2)

cserteGT3 avatar cserteGT3 commented on September 12, 2024

Parameters solved:
A nested NamedTuple and the @extract macro from ExtractMacro.jl:

julia> using ExtractMacro

julia> plane_par ==10, ϵ=0.1, other_par = 11.3)
(α = 10, ϵ = 0.1, other_par = 11.3)

julia> sphere_par ==5, ϵ=0.05, )
(α = 5, ϵ = 0.05)

julia> iter_par1 = (maxit=100, p = 0.99)
(maxit = 100, p = 0.99)

julia> new_shape ==1, ϵ=15, oth="A")
(α = 1, ϵ = 15, oth = "A")

julia> ransacpars = (plane=plane_par, sphere=sphere_par, iterations=iter_par1)
(plane == 10, ϵ = 0.1, other_par = 11.3), sphere == 5, ϵ = 0.05), iterations = (maxit = 100, p = 0.99))

julia> function test1(p)
       @extract p : sphere_p=sphere plane_p=plane
       @show sphere_p
       @show plane_p
       end
test1 (generic function with 1 method)

julia> test1(ransacpars)
sphere_p == 5, ϵ = 0.05)
plane_p == 10, ϵ = 0.1, other_par = 11.3)
(α = 10, ϵ = 0.1, other_par = 11.3)

julia> test1(ransacpars);
sphere_p == 5, ϵ = 0.05)
plane_p == 10, ϵ = 0.1, other_par = 11.3)

julia> function test2(p)
       @extract p : sphere_p=sphere plane_p=plane
       @show sphere_p
       @show plane_p
       end
test2 (generic function with 1 method)

julia> function test2(p)
       @extract p : sphere_p=sphere plane_p=plane
       @show sphere_p
       @extract sphere_p : sphere_alpha=α
       @extract plane_p : plane_alpha = α
       @show sphere_alpha
       @show plane_alpha
       end
test2 (generic function with 1 method)

julia> test2(ransacpars);
sphere_p == 5, ϵ = 0.05)
sphere_alpha = 5
plane_alpha = 10

julia> newshape_par = (newshape=new_shape)
(α = 1, ϵ = 15, oth = "A")

julia> newshape_par = (newshape=new_shape,)
(newshape == 1, ϵ = 15, oth = "A"),)

julia> merge(ransacpars, newshape_par)
(plane == 10, ϵ = 0.1, other_par = 11.3), sphere == 5, ϵ = 0.05), iterations = (maxit = 100, p = 0.99), newshape == 1, ϵ = 15, oth = "A"))

from ransac.jl.

cserteGT3 avatar cserteGT3 commented on September 12, 2024

Implemented in #12

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