Skip to content

Add Named-Port Network Builder #24

Description

@oameye

The package already supports the core SLH reduction rules: cascade, concatenate, and feedback. However, complicated networks still require manual port bookkeeping with integer indices, e.g.

feedback(G, 1 => 3, 3 => 5, 5 => 7)

This is powerful but easy to get wrong. A higher-level named-port interface would make large networks easier to read, debug, and teach.

net = Network()

add!(net, :source, coherent_drive(α), outputs=[:out])
add!(net, :cavity, one_sided_cavity(a; κ, Δ), inputs=[:in], outputs=[:out])
add!(net, :phase, phase_shifter(ϕ), inputs=[:in], outputs=[:out])

connect!(net, :source => :out, :cavity => :in)
connect!(net, :cavity => :out, :phase => :in)

G_eff = reduce(net)

And then we can add plotting

plot_network(net)
plot_reduction_steps(net)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions