Skip to content

Add AbstractCache and make_coerce to CTBase.Core#459

Merged
ocots merged 1 commit into
mainfrom
move/ctflows-to-ctbase-phase-a
Jun 23, 2026
Merged

Add AbstractCache and make_coerce to CTBase.Core#459
ocots merged 1 commit into
mainfrom
move/ctflows-to-ctbase-phase-a

Conversation

@ocots

@ocots ocots commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

Moves two generic, dependency-free building blocks out of CTFlows into CTBase.Core, so they can be shared across the control-toolbox ecosystem.

  • AbstractCache — new src/Core/caches.jl. Abstract base type for computation caches (pre-allocated buffers / prepared AD plans). Generic docstring (no CTFlows-specific references).
  • make_coerce — added to src/Core/function_utils.jl, next to to_out_of_place / matrix2vec. Shape-matching coercion helper: only for scalars, identity for arrays.

Both are exported from Core. AbstractTag already lives in Core/tags.jl, so no new tag type is added here — the CTFlows duplicate is dropped on the consumer side.

Context

This is the first step (phase A) of moving generic utilities from CTFlows into CTBase. Companion consumer PR in CTFlows.jl rewires CTFlows.Common to re-export these from CTBase.Core and removes the duplicated files. That CTFlows PR depends on this one being merged and a CTBase 0.21 beta being available.

Later phases (separate PRs) will move the Traits and Data modules.

Test plan

  • using CTBase loads; CTBase.Core.AbstractCache, CTBase.Core.make_coerce behave as expected.
  • CI green (Core tests, Aqua).

🤖 Generated with Claude Code

Move two generic, dependency-free building blocks out of CTFlows into
CTBase.Core so they can be shared across the control-toolbox ecosystem:

- `AbstractCache` (new `Core/caches.jl`): abstract base type for computation
  caches (e.g. prepared AD plans), with a generic docstring.
- `make_coerce` (in `Core/function_utils.jl`): shape-matching coercion helper
  (`only` for scalars, `identity` for arrays).

Both are exported from `Core`. `AbstractTag` already lived here, so the CTFlows
duplicate is simply dropped on the consumer side.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ocots
ocots merged commit 4813392 into main Jun 23, 2026
6 checks passed
@ocots
ocots deleted the move/ctflows-to-ctbase-phase-a branch June 23, 2026 10:35
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