Skip to content

Adds indexing atom implementation and other bindings#20

Merged
dance858 merged 6 commits intomainfrom
indexing
Jan 14, 2026
Merged

Adds indexing atom implementation and other bindings#20
dance858 merged 6 commits intomainfrom
indexing

Conversation

@Transurgeon
Copy link
Collaborator

No description provided.

Transurgeon and others added 6 commits January 12, 2026 18:35
Implements efficient indexing operator that handles both CVXPY's
`index` (slice-based) and `special_index` (array/boolean) atoms.

- Forward: O(n_selected) gather operation
- Jacobian: Pre-computed row mapping for fast memcpy per row
- Hessian: Pre-allocated scatter buffer with accumulation for
  repeated indices (equivalent to np.add.at)

Enables NLP tests like test_hs071 and test_rosenbrock that use
x[0], x[1] style indexing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reshape with order='F' is a pass-through since the underlying data
layout is unchanged - only shape interpretation differs.

Note: Only Fortran order is supported. C order would require data
permutation which is not yet implemented.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enables test_socp and test_portfolio_socp to pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Exposes the existing rel_entr C implementation (for equal-sized args)
through Python bindings. The scalar argument variants declared in the
header are not yet implemented in C.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add has_duplicates flag to detect repeated indices at construction
- Hessian eval: fast path (direct write) when no duplicates, avoiding
  O(child_size) memset; slow path (zero + accumulate) for duplicates
- Remove jac_row_starts and jac_row_lengths arrays from index_expr
- Simplify jacobian_init: use CSR p array directly instead of helpers
- Simplify eval_jacobian: compute row lengths on the fly (trivial cost)
- Convert &array[i] to array + i style for consistency with codebase
- Update CLAUDE.md with improved build instructions and atom lists

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dance858
Copy link
Collaborator

Awesome! Merging this after some small stylistic edits.

@dance858 dance858 merged commit ddcea3d into main Jan 14, 2026
0 of 9 checks passed
@dance858 dance858 deleted the indexing branch February 1, 2026 23:16
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