Migration from the MATLAB toolbox#
The MATLAB/Octave NOCAD toolbox (github.com/abonyilab/NOCAD) is organized in three
modules. Every function maps onto nocad as listed below. Node indices are 0-based
in Python; matchedBy becomes matched_by with -1 for unmatched nodes. As in
MATLAB, functions of a network take the adjacency matrix and functions of a system
the state matrix \(\mathbf{A}=\mathbf{W}^{\mathsf T}\).
Module 1: network mapping#
MATLAB |
nocad |
|---|---|
|
|
|
|
|
|
|
|
— |
|
|
|
|
|
Module 2: system characterisation#
MATLAB |
nocad |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
non-zero rows of |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Module 3: improvement and robustness#
MATLAB |
nocad |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Exchanging data with the MATLAB toolbox#
nocad.io.write_mat(path, design) (or write_network(design, "file.mat")) stores
A, B, C, D, the adjacency matrix adj, the node labels and the
1-based drivers and sensors for MATLAB; nocad.io.read_mat reads a file with
A (and optionally B, C, D) as a state-space model or any square matrix as
a network.
Differences#
Controllability tests.
isControllabletook the structural rank of the numerically formed Kalman matrix. That value is an upper bound of the generic rank, so it can report a dilation-ridden system as controllable.nocaduses Lin’s exact graph test (method="structural"), a numerical test on the given values ("kalman") or on a random realization ("generic"). On the example of the manual this changes the robustness of the improved configuration: removing \(x_8\) leaves \(x_4\) as the only driver with two children that have no other parent, a dilation, so \(x_8\) is a critical node too (robustness 5/9, not 6/9).Control centrality is the generic dimension of the controllable subspace (random realization, orthogonal Krylov iteration);
method="sprank"reproduces the MATLAB value.Percentage of symmetric edges. The manual defines it per edge (40 % in its example); the MATLAB code counted node pairs (25 %).
nocadfollows the manual.Annealing. The replacement node is never one that is already configured; the run keeps the best configuration it visited.
Driver types. Besides the MATLAB closure test, a driver node is internal if some maximum matching leaves it unmatched (Kőnig’s theorem); the closure test alone misses dilations inside large balanced components.
New in nocad: the exact minimum of dedicated inputs, node roles and edge classes, control profiles, edge-removal robustness, the visualization module, import/export with role annotations and the bundled networks.