Skip to content

ab13dd segfaults for n=1 (single-state systems) #9

@jamestjsp

Description

@jamestjsp

Description

ab13dd crashes with segmentation fault when called with a single-state system (n=1).

Environment

  • Platform: macOS (darwin arm64)
  • Python: 3.14.2
  • slicot version: (installed from this repo)

Minimal Reproducer

import numpy as np
from slicot import ab13dd

# Single-state system: G(s) = 1/(s+1)
n, m, p = 1, 1, 1
A = np.asfortranarray([[-1.0]])
E = np.asfortranarray([[1.0]])
B = np.asfortranarray([[1.0]])
C = np.asfortranarray([[1.0]])
D = np.asfortranarray([[0.0]])
fpeak_in = np.asfortranarray([0.0, 1.0])

# This crashes with segfault
result = ab13dd('C', 'I', 'N', 'Z', n, m, p, fpeak_in, A, E, B, C, D, 0.0)

Expected Behavior

Should return (array([1., 1.]), array([0., 1.]), 0) (L-infinity norm of 1).

Actual Behavior

Segmentation fault in mb03xd called from ab13dd:

Fatal Python error: Segmentation fault
...
Binary file "slicot/_slicot.cpython-314-darwin.so", at mb03xd+0x528
Binary file "slicot/_slicot.cpython-314-darwin.so", at ab13dd+0x2b48

Workaround

Using n=2 or higher works correctly:

n, m, p = 2, 1, 1
A = np.asfortranarray([[-1.0, 0.0], [0.0, -2.0]])
E = np.asfortranarray([[1.0, 0.0], [0.0, 1.0]])
B = np.asfortranarray([[1.0], [1.0]])
C = np.asfortranarray([[1.0, 0.0]])
D = np.asfortranarray([[0.0]])
fpeak_in = np.asfortranarray([0.0, 1.0])
# This works
result = ab13dd('C', 'I', 'N', 'Z', n, m, p, fpeak_in, A, E, B, C, D, 0.0)

Impact

This issue affects python-control's linfnorm() and system_norm() functions when computing L-infinity norms of first-order systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions