NetworkDynamics.jl Kuramoto oscillators tutorial example: definition sum_coupling!()

How is the function sum_couling!() on the page https://pik-icon.github.io/NetworkDynamics.jl/dev/heterogeneous_system/ defined?

Thx! Domenico.

Any ideas?

1 Like

Thank you!

1 Like

Here’s how you find out:

julia> using NetworkDynamics, OrdinaryDiffEq, LightGraphs # as I don't know which package it is from!

julia> methods(sum_coupling!)
# 1 method for generic function "sum_coupling!":
[1] sum_coupling!(e_sum, dst_edges) in NetworkDynamics.Utilities at ...\.julia\packages\NetworkDynamics\r6g0k\src\Utilities.jl:166

which points to the definition here:

For these purposes, @which and @edit are also useful, although they require an actual function call with arguments to work out which method is called. In this case that’s easy as the function only has one method which is untyped, so you can call it with any arguments:

julia> @which sum_coupling!(rand(10), rand(10))
sum_coupling!(e_sum, dst_edges) in NetworkDynamics.Utilities at C:\Users\ngudat\.julia\packages\NetworkDynamics\r6g0k\src\Utilities.jl:166

and

julia> @edit sum_coupling!(rand(10), rand(10))
sum_coupling!(e_sum, dst_edges) in NetworkDynamics.Utilities at C:\Users\ngudat\.julia\packages\NetworkDynamics\r6g0k\src\Utilities.jl:166

should take you straight to the definition on your local machine in a text editor of your choice.

2 Likes

Right! Thx.