Skip to content

TVdP tree node type#39

Closed
perazz wants to merge 1 commit intomainfrom
tvdp-tree-node-type
Closed

TVdP tree node type#39
perazz wants to merge 1 commit intomainfrom
tvdp-tree-node-type

Conversation

@perazz
Copy link
Owner

@perazz perazz commented Feb 14, 2026

Summary

  • Introduce fitpack_tree_node derived type with 4 integer fields (info, up, left, right) replacing 4 parallel integer arrays for the triply-linked binary tree used by the Theil-Van de Panne (TVdP) convexity-constrained spline fitting procedure (Book §7.2, Fig. 7.1)
  • Refactor fpcosp to allocate the tree locally as an automatic array, removing 4 array arguments from its signature
  • Update all 4 helper routines (fpadno, fpdeno, fpfrno, fpseno) to take a single tree(maxtr) array instead of 4 separate arrays
  • Update callers cocosp and fpcoco to remove tree workspace slicing from iwrk, reducing iwrk requirement by 4*maxtr integers

Test plan

  • fpm build --flag "-Wall -Wextra" — clean, no warnings
  • fpm test — 49 passed, 0 failed (the concon/cocosp tests exercise this code path)

Replace 4 parallel integer arrays (info, up, left, right) with a single
fitpack_tree_node derived type for the triply-linked binary tree used by
the Theil-Van de Panne convexity-constrained spline fitting procedure.

- Add fitpack_tree_node type with 4 integer fields
- Refactor fpcosp: tree is now a local automatic array (4 fewer arguments)
- Refactor fpadno, fpdeno, fpfrno, fpseno to take tree(maxtr)
- Update callers cocosp and fpcoco: remove tree workspace from iwrk
- Reduce iwrk requirement by 4*maxtr integers
@perazz perazz closed this Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant