MATLAB examples

These examples use the MATLAB UDX interface (+udx package) from the main UDX repository. They assume you have built the MATLAB client library and configured Julia paths.

The full script lives in the UDX tree as []Matlab/examples/example_rur.m](https://gitlab.inria.fr/frdev/udx/-/blob/main/Matlab/examples/examplerur.m?reftype=heads).

Polynomial system: RUR, isolation, and solutions

This workflow:

  1. Adds the MATLAB interface and libudx client paths
  2. Configures Julia and optional xterm
  3. Starts a Julia connection (PACE)
  4. Builds a sparse multivariate system {coefficients, exponents}
  5. Calls udx.rur, udx.isolate_uni on the first RUR polynomial, and udx.compute_system_solutions_from_rur
  6. Cleans up with udx.cleanup
% Polynomial system solving with Julia/PACE 

% Paths (adjust for your installation)
addpath('/path/to/libudx');              % parent folder of libudxInterface
addpath('/path/to/UDX/Matlab/');         % parent of +udx

udx.setup('/opt/homebrew/bin/julia', '/opt/X11/bin/xterm');

udx.list_processes();

channel = udx.start_jl_connection('threads', 8, 'use_xterm', true);

udx.list_processes();

% Coefficients for 3 polynomials in x, y, z
coefs = {[119400, -194190, -358200, 181800, -900, -10411, 194190, -116980, -5700, 106509], ...
         [-358200, 90900, 388380, -116980, 119400, -90900, 900, 10411, -1000, 44330], ...
         [-1340, 810, 9292, -5233, -9381, 8133, -1994, -28303, 415, 14063]};

% Exponent vectors [a,b,c] for monomials x^a * y^b * z^c (same order as coefs)
exps = {{[3, 0, 0], [2, 0, 0], [1, 2, 0], [1, 1, 1], [1, 0, 2], [1, 0, 0], [0, 2, 0], [0, 1, 1], [0, 0, 2], [0, 0, 0]}, ...
        {[2, 1, 0], [2, 0, 1], [1, 1, 0], [1, 0, 1], [0, 3, 0], [0, 2, 1], [0, 1, 2], [0, 1, 0], [0, 0, 3], [0, 0, 1]}, ...
        {[14, 1, 0], [14, 0, 1], [13, 1, 0], [13, 0, 1], [12, 3, 0], [12, 2, 1], [12, 1, 2], [12, 1, 0], [12, 0, 3], [12, 0, 1]}};

syst = cell(1, 3);
for i = 1:3
    syst{i} = {coefs{i}, exps{i}};
end

rur_pols = udx.rur(channel, syst);

intervals_rur = udx.isolate_uni(channel, rur_pols{1});

solutions = udx.compute_system_solutions_from_rur(channel, syst);

udx.cleanup();
udx.list_processes();

Notes

  • use_xterm, false — Julia runs in the background without an xterm window.
  • RUR polynomials returned to MATLAB use double-precision rationals; for full precision in the solver path, prefer compute_system_solutions_from_rur, which recomputes the RUR on the Julia side.