Skip to content

Phase D: add CTBase.Differentiation submodule + DI extension (0.24) - #465

Merged
ocots merged 4 commits into
mainfrom
move/ctflows-to-ctbase-phase-d
Jun 25, 2026
Merged

Phase D: add CTBase.Differentiation submodule + DI extension (0.24)#465
ocots merged 4 commits into
mainfrom
move/ctflows-to-ctbase-phase-d

Conversation

@ocots

@ocots ocots commented Jun 25, 2026

Copy link
Copy Markdown
Member

Phase D — Differentiation moves into CTBase

Moves the AD-backend strategy layer from CTFlows into CTBase so the whole
ecosystem can share a single AD abstraction.

What's added

  • CTBase.Differentiation submodule: AbstractADBackend (strategy family)
    • DifferentiationInterface concrete strategy, build_ad_backend, ad_backend,
      and the contract methods gradient / derivative / differentiate /
      pushforward / hamiltonian_gradient / variable_gradient.
  • CTBaseDifferentiationInterface package extension implementing the contract
    via DifferentiationInterface.jl (anonymous-closure / ForwardDiff tag-ordering
    logic preserved verbatim).
  • __ad_backend() default (AutoForwardDiff) moved here from CTFlows.Common.

Manifest

  • ADTypes becomes a hard dependency (compat 1).
  • DifferentiationInterface added as weakdep + extension (compat 0.7).
  • Version → 0.24.0-beta; all weakdeps mirrored into [extras] for test-env robustness.

Tests & docs

  • New test/suite/differentiation/ (ad_backend, arg_placement, module) +
    extensions/test_differentiation_interface_extension.jl. Full suite green (3981).
  • New guide/differentiation.md (strategy-style), api_reference entry + extension,
    make.jl page; docs build green.

Part of the CTFlows→CTBase move (paired with CTModels compat widening and CTFlows #).

🤖 Generated with Claude Code

ocots and others added 3 commits June 25, 2026 17:03
AD backend strategy layer built on CTBase.Strategies: AbstractADBackend +
DifferentiationInterface concrete strategy, with the differentiation methods
(gradient, derivative, differentiate, pushforward, hamiltonian_gradient,
variable_gradient) provided by the CTBaseDifferentiationInterface extension.

- ADTypes becomes a hard dependency (default backend AutoForwardDiff).
- DifferentiationInterface added as weakdep + extension.
- __ad_backend default moved here from CTFlows.Common.
- Version bumped to 0.24.0-beta; weakdeps mirrored into [extras].

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Strategy-style guide (based on the Options/Strategies guides), api_reference
entry for the module + the CTBaseDifferentiationInterface extension, and the
make.jl page. Docs env gains ADTypes/DifferentiationInterface/ForwardDiff for
runnable examples.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rivative tests

Docstrings:
- AbstractADBackend: replace stale "two methods" note with the full contract
- Differentiation module: list ad_backend among the contract methods
- DifferentiationInterface ctor: document the mode kwarg and ad_backend aliases

Docs:
- differentiation.md: clarify ad_backend (core) vs the extension primitives
- index.md / getting-started.md: list Options, Strategies, Orchestration,
  Differentiation, Interpolation submodules and the DI extension

Tests:
- cover Differentiation.gradient/derivative (real computation via DI extension)
- add NotImplemented stub-error tests for gradient/derivative

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ocots
ocots merged commit 4c2b549 into main Jun 25, 2026
4 checks passed
@ocots
ocots deleted the move/ctflows-to-ctbase-phase-d branch June 25, 2026 18:58
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