Skip to content

I added multidimensionality functions to the tvrdiff method by callin…#188

Merged
pavelkomarov merged 4 commits intoflorisvb:masterfrom
mariaprot:tvrdiff
Mar 12, 2026
Merged

I added multidimensionality functions to the tvrdiff method by callin…#188
pavelkomarov merged 4 commits intoflorisvb:masterfrom
mariaprot:tvrdiff

Conversation

@mariaprot
Copy link
Contributor

@mariaprot mariaprot commented Feb 20, 2026

…g it recursively. Some changes might need to be made in terms of making the code less verbose, in particular, replacing moveaxis() with apply_along_axis()

This is part of #76.

…g it recursively. Some changes might need to be made in terms of making the code less verbose, in particular, replacing moveaxis() with apply_along_axis()
- **dxdt_hat** (np.array) -- estimated derivative of x
"""

x0 = np.moveaxis(x, axis, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of np.moveaxis with creating a new data array, I think np.apply_along_axis is more automatic and shorter. Strive to do things in as few calls as possible, because each addition becomes something more to parse when people read and manage the code later.

pavelkomarov and others added 3 commits March 12, 2026 15:58
Use the standard ndindex direct-indexer pattern (same as polydiff, rtsdiff, etc.)
instead of Maria's two-function recursive dispatch. The 1D cvxpy solve is per-vector
with no batching opportunity, so the loop is the right structure.

Also adds tvrdiff to the multidimensionality test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pavelkomarov
Copy link
Collaborator

It works:

Screenshot 2026-03-12 at 16 40 04

@pavelkomarov pavelkomarov merged commit 431ff17 into florisvb:master Mar 12, 2026
1 check passed
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.

2 participants