rootmatch.m

From Spinach Documentation Wiki
Revision as of 10:12, 30 August 2026 by Kuprov (talk | contribs) (version fragment to 2.13 per IK 2026-08-30)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Global order-preserving root matching between three magnetic field root lists. The routine returns indices into the input lists that identify matching roots with minimum field-continuation cost. The three lists are sorted by field; when all three have the same length, the sort orders themselves are returned, because an order-preserving matching of equal lists is unique. Otherwise a three-dimensional dynamic programme runs over the sorted lists, at each node choosing between skipping a root in one of the lists and matching one root from each. The primary objective is the number of matched triples, and the cost ((f1-f2)/edge12)^2+((f2-f3)/edge23)^2+((f3-f1)/edge31)^2 accumulated over the matched triples is the tie-breaker, so that the matching follows the smoothest continuation of the eigenvalue sheets across the triangle. The optimal path is recovered by traceback and reversed into forward field order.

Syntax

    [idx1,idx2,idx3]=rootmatch(field1,field2,field3,...
                               edge12,edge23,edge31)

Parameters

    field1 - real vector of roots at the first triangle vertex

    field2 - real vector of roots at the second triangle vertex

    field3 - real vector of roots at the third triangle vertex

    edge12 - positive distance between the first and the second
             triangle vertices

    edge23 - positive distance between the second and the third
             triangle vertices

    edge31 - positive distance between the third and the first
             triangle vertices

Outputs

    idx1   - indices of matched roots in field1

    idx2   - indices of matched roots in field2

    idx3   - indices of matched roots in field3

Notes

An empty root list at any vertex produces three empty index vectors.

See also

eigenfields.m, cubic_roots.m, voitlander.m, Kernel utilities

Version 2.13, authors: Ilya Kuprov