Product documentation — installation, licensing, and integration guides.
SolvLRDE
Examples
05 Banded + DAE

Journey 05 — Banded + DAE

solve_banded on tridiagonal MOL operators and reduce_dae for linear descriptor systems.

Prerequisites: Journey 04 works. Scenario: Exploit sparsity, and reduce a linear DAE to canonical form

Key APIs

  • solvlrde.banded_from_dense()
  • solvlrde.solve_banded()
  • solvlrde.reduce_dae()

Concepts to internalize

  • Banded layout — (kl+ku+1, n) LAPACK band storage.
  • MOL heat/diffusion — typical thermal and PDE workflows land here.
  • reduce_dae — returns reduced (A, b) for standard solve().

Important code

The guided tour script wraps this pattern. Copy the production shape into your pipeline:

ab = lrde.banded_from_dense(A, kl=1, ku=1)
result = lrde.solve_banded(ab, 1, 1, y0, T=T)
 
# DAE: M v' = -G v + f
A_red, b_red = lrde.reduce_dae(M, G, f)

Act-by-act walkthrough

Act 1 — Banded is for structured operators

Many linear operators - a 1-D heat equation discretized by method of lines, a chain of coupled masses - are banded. Passing the dense matrix wastes O(n^2) memory; the banded path takes the compact band layout and the sub/super bandwidths (kl, ku).

Act 2 — Dense vs banded agree

Solve the same heat problem two ways. banded_from_dense() builds the (kl+ku+1, n) layout; solve_banded() consumes it. The exact answer is exp(-pi^2 T) sin(pi x), so we can score both.

FieldValueNotes
dense_survivedTrue
banded_survivedTrue
dense_vs_banded_maxdiff0.000e+00
banded_vs_exact_maxerr3.580e-05
band_shape(3, 60)

Act 3 — DAE reduction

A linear descriptor system M v' = -G v (+ f) is not yet in y' = A y + b form. reduce_dae(M, G, f) returns (A, b) with A = -M^-1 G. M may be a 1-D diagonal or a full matrix. Here M = diag(2, 4), G = diag(2, 8) gives v' = diag(-1, -2) v.

FieldValueNotes
A_from_dae[[-1.0, -0.0], [-0.0, -2.0]]
b_from_daeNone
survivedTrue
statusok
y[0.367879, 0.135335]
n_talbot_used32
n_solves32
nu_used0.6
contour_scale12.8
wall_s0
expected[0.367879, 0.135335]
max_abs_error9.492e-11

Guided tour output

Verified console capture from 05_banded_dae.py:

Exploit sparsity, and reduce a linear DAE to canonical form

-- Act 1 - Banded is for structured operators --
  -> Many linear operators - a 1-D heat equation discretized by method of lines, a chain of coupled masses - are banded. Passing the dense matrix wastes O(n^2) memory; the banded path takes the compact band layout and the sub/super bandwidths (kl, ku).

-- Act 2 - Dense vs banded agree --
  -> Solve the same heat problem two ways. banded_from_dense() builds the (kl+ku+1, n) layout; solve_banded() consumes it. The exact answer is exp(-pi^2 T) sin(pi x), so we can score both.
  dense_survived: True
  banded_survived: True
  dense_vs_banded_maxdiff: 0.000e+00
  banded_vs_exact_maxerr: 3.580e-05
  band_shape: (3, 60)

-- Act 3 - DAE reduction --
  -> A linear descriptor system M v' = -G v (+ f) is not yet in y' = A y + b form. reduce_dae(M, G, f) returns (A, b) with A = -M^-1 G. M may be a 1-D diagonal or a full matrix. Here M = diag(2, 4), G = diag(2, 8) gives v' = diag(-1, -2) v.
  A_from_dae: [[-1.0, -0.0], [-0.0, -2.0]]
  b_from_dae: None
  survived: True
  status: ok
  y: [0.367879, 0.135335]
  n_talbot_used: 32
  n_solves: 32
  nu_used: 0.6
  contour_scale: 12.8
  wall_s: 0
  expected: [0.367879, 0.135335]
  max_abs_error: 9.492e-11

-- Run complete --
  next_journey: 06_limits.py

Run it

cd python
# Guided tour — narrated scenario walkthrough (recommended first run):
python examples/journeys/05_banded_dae.py
 
# Production one-liner — same API call you ship:
python examples/journeys/05_banded_dae.py

What comes next

Journey 06 states routing to SolvSRK/SolvJump and honest refusals.

Navigation

← Journey 04 — Time-independent cost · Journey 06 — Limits →