Skip to content

refactor: promote shared primitives to mathematical_optimization#1481

Open
mlubin wants to merge 1 commit into
NVIDIA:mainfrom
mlubin:refactor/promote-linear-algebra-namespace
Open

refactor: promote shared primitives to mathematical_optimization#1481
mlubin wants to merge 1 commit into
NVIDIA:mainfrom
mlubin:refactor/promote-linear-algebra-namespace

Conversation

@mlubin

@mlubin mlubin commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Moves linear algebra primitives and other shared utilities into the optimization namespace to reduce the need for using statements or namespace qualification introduced by #1446. Linear algebra goes into a new directory named cpp/src/linear_algebra and other utilities go into the pre-existing cpp/src/math_optimization directory.

No behavioral or API change; pure relocation.

@mlubin mlubin added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Jun 26, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@mlubin mlubin force-pushed the refactor/promote-linear-algebra-namespace branch 2 times, most recently from febdde9 to c7d9e22 Compare June 26, 2026 18:42
@mlubin mlubin changed the title refactor: promote shared linear-algebra primitives to mathematical_optimization refactor: promote shared primitives to mathematical_optimization Jun 26, 2026
@mlubin mlubin marked this pull request as ready for review June 26, 2026 20:02
@mlubin mlubin requested review from a team as code owners June 26, 2026 20:02
@mlubin mlubin requested review from Bubullzz, akifcorduk, chris-maes, nguidotti and ramakrishnap-nv and removed request for Bubullzz and chris-maes June 26, 2026 20:02
@mlubin

mlubin commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test c7d9e22

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1bb59844-473c-48e0-9a5e-6e5db7810667

📥 Commits

Reviewing files that changed from the base of the PR and between c7d9e22 and b132224.

📒 Files selected for processing (86)
  • cpp/src/CMakeLists.txt
  • cpp/src/barrier/barrier.cu
  • cpp/src/barrier/barrier.hpp
  • cpp/src/barrier/conjugate_gradient.hpp
  • cpp/src/barrier/cusparse_view.cu
  • cpp/src/barrier/cusparse_view.hpp
  • cpp/src/barrier/device_sparse_matrix.cu
  • cpp/src/barrier/device_sparse_matrix.cuh
  • cpp/src/barrier/iterative_refinement.hpp
  • cpp/src/barrier/pinned_host_allocator.cu
  • cpp/src/barrier/pinned_host_allocator.hpp
  • cpp/src/barrier/sparse_cholesky.cuh
  • cpp/src/barrier/translate_soc.hpp
  • cpp/src/branch_and_bound/branch_and_bound.cpp
  • cpp/src/branch_and_bound/branch_and_bound.hpp
  • cpp/src/branch_and_bound/deterministic_workers.hpp
  • cpp/src/branch_and_bound/diving_heuristics.cpp
  • cpp/src/branch_and_bound/mip_node.hpp
  • cpp/src/branch_and_bound/pseudo_costs.cpp
  • cpp/src/branch_and_bound/pseudo_costs.hpp
  • cpp/src/branch_and_bound/symmetry.hpp
  • cpp/src/branch_and_bound/worker.hpp
  • cpp/src/branch_and_bound/worker_pool.hpp
  • cpp/src/cuts/cuts.cpp
  • cpp/src/cuts/cuts.hpp
  • cpp/src/dual_simplex/CMakeLists.txt
  • cpp/src/dual_simplex/basis_solves.cpp
  • cpp/src/dual_simplex/basis_solves.hpp
  • cpp/src/dual_simplex/basis_updates.hpp
  • cpp/src/dual_simplex/bound_flipping_ratio_test.cpp
  • cpp/src/dual_simplex/bound_flipping_ratio_test.hpp
  • cpp/src/dual_simplex/crossover.cpp
  • cpp/src/dual_simplex/crossover.hpp
  • cpp/src/dual_simplex/folding.cpp
  • cpp/src/dual_simplex/folding.hpp
  • cpp/src/dual_simplex/initial_basis.cpp
  • cpp/src/dual_simplex/initial_basis.hpp
  • cpp/src/dual_simplex/phase1.cpp
  • cpp/src/dual_simplex/phase1.hpp
  • cpp/src/dual_simplex/phase2.cpp
  • cpp/src/dual_simplex/phase2.hpp
  • cpp/src/dual_simplex/presolve.cpp
  • cpp/src/dual_simplex/presolve.hpp
  • cpp/src/dual_simplex/primal.cpp
  • cpp/src/dual_simplex/primal.hpp
  • cpp/src/dual_simplex/right_looking_lu.cpp
  • cpp/src/dual_simplex/right_looking_lu.hpp
  • cpp/src/dual_simplex/scaling.cpp
  • cpp/src/dual_simplex/scaling.hpp
  • cpp/src/dual_simplex/simplex_solver_settings.hpp
  • cpp/src/dual_simplex/singletons.cpp
  • cpp/src/dual_simplex/singletons.hpp
  • cpp/src/dual_simplex/solution.hpp
  • cpp/src/dual_simplex/solve.cpp
  • cpp/src/dual_simplex/solve.hpp
  • cpp/src/dual_simplex/triangle_solve.hpp
  • cpp/src/dual_simplex/user_problem.hpp
  • cpp/src/linear_algebra/CMakeLists.txt
  • cpp/src/linear_algebra/dense_matrix.hpp
  • cpp/src/linear_algebra/dense_vector.hpp
  • cpp/src/linear_algebra/sort_csr.cuh
  • cpp/src/linear_algebra/sparse_matrix.cpp
  • cpp/src/linear_algebra/sparse_matrix.hpp
  • cpp/src/linear_algebra/sparse_vector.cpp
  • cpp/src/linear_algebra/sparse_vector.hpp
  • cpp/src/linear_algebra/vector_math.cpp
  • cpp/src/linear_algebra/vector_math.cuh
  • cpp/src/linear_algebra/vector_math.hpp
  • cpp/src/math_optimization/CMakeLists.txt
  • cpp/src/math_optimization/tic_toc.cpp
  • cpp/src/math_optimization/tic_toc.hpp
  • cpp/src/math_optimization/types.hpp
  • cpp/src/mip_heuristics/diversity/lns/rins.cu
  • cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh
  • cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu
  • cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu
  • cpp/src/mip_heuristics/presolve/semi_continuous.cu
  • cpp/src/mip_heuristics/problem/problem.cu
  • cpp/src/mip_heuristics/solve.cu
  • cpp/src/pdlp/solve.cu
  • cpp/src/pdlp/translate.hpp
  • cpp/tests/dual_simplex/unit_tests/right_looking_ldlt.cpp
  • cpp/tests/dual_simplex/unit_tests/solve.cpp
  • cpp/tests/dual_simplex/unit_tests/solve_barrier.cu
  • cpp/tests/mip/cuts_test.cu
  • cpp/tests/socp/general_quadratic_test.cu
💤 Files with no reviewable changes (1)
  • cpp/src/dual_simplex/CMakeLists.txt
✅ Files skipped from review due to trivial changes (28)
  • cpp/src/dual_simplex/singletons.hpp
  • cpp/src/barrier/pinned_host_allocator.hpp
  • cpp/src/CMakeLists.txt
  • cpp/src/dual_simplex/triangle_solve.hpp
  • cpp/src/dual_simplex/scaling.hpp
  • cpp/src/dual_simplex/folding.hpp
  • cpp/src/dual_simplex/solution.hpp
  • cpp/src/dual_simplex/folding.cpp
  • cpp/src/dual_simplex/basis_solves.cpp
  • cpp/src/mip_heuristics/presolve/semi_continuous.cu
  • cpp/src/dual_simplex/initial_basis.hpp
  • cpp/src/branch_and_bound/diving_heuristics.cpp
  • cpp/src/dual_simplex/basis_solves.hpp
  • cpp/src/dual_simplex/crossover.hpp
  • cpp/tests/dual_simplex/unit_tests/right_looking_ldlt.cpp
  • cpp/src/dual_simplex/phase2.cpp
  • cpp/src/dual_simplex/bound_flipping_ratio_test.hpp
  • cpp/src/dual_simplex/basis_updates.hpp
  • cpp/src/dual_simplex/presolve.cpp
  • cpp/src/dual_simplex/phase2.hpp
  • cpp/src/dual_simplex/presolve.hpp
  • cpp/src/math_optimization/tic_toc.cpp
  • cpp/src/branch_and_bound/mip_node.hpp
  • cpp/src/dual_simplex/right_looking_lu.hpp
  • cpp/src/dual_simplex/right_looking_lu.cpp
  • cpp/src/dual_simplex/simplex_solver_settings.hpp
  • cpp/src/dual_simplex/scaling.cpp
  • cpp/src/linear_algebra/sparse_vector.cpp
🚧 Files skipped from review as they are similar to previous changes (54)
  • cpp/src/math_optimization/CMakeLists.txt
  • cpp/src/dual_simplex/primal.hpp
  • cpp/src/dual_simplex/user_problem.hpp
  • cpp/src/branch_and_bound/worker_pool.hpp
  • cpp/src/linear_algebra/CMakeLists.txt
  • cpp/src/mip_heuristics/diversity/lns/rins.cu
  • cpp/src/barrier/cusparse_view.hpp
  • cpp/src/dual_simplex/phase1.cpp
  • cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu
  • cpp/src/dual_simplex/phase1.hpp
  • cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh
  • cpp/src/dual_simplex/initial_basis.cpp
  • cpp/src/dual_simplex/singletons.cpp
  • cpp/src/linear_algebra/sparse_matrix.cpp
  • cpp/src/dual_simplex/primal.cpp
  • cpp/src/math_optimization/types.hpp
  • cpp/src/dual_simplex/solve.hpp
  • cpp/src/branch_and_bound/worker.hpp
  • cpp/src/dual_simplex/bound_flipping_ratio_test.cpp
  • cpp/src/barrier/barrier.hpp
  • cpp/src/barrier/pinned_host_allocator.cu
  • cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu
  • cpp/src/math_optimization/tic_toc.hpp
  • cpp/src/branch_and_bound/branch_and_bound.hpp
  • cpp/src/barrier/cusparse_view.cu
  • cpp/src/linear_algebra/sort_csr.cuh
  • cpp/src/barrier/conjugate_gradient.hpp
  • cpp/src/linear_algebra/dense_matrix.hpp
  • cpp/src/branch_and_bound/deterministic_workers.hpp
  • cpp/tests/mip/cuts_test.cu
  • cpp/src/barrier/device_sparse_matrix.cu
  • cpp/tests/socp/general_quadratic_test.cu
  • cpp/tests/dual_simplex/unit_tests/solve.cpp
  • cpp/src/mip_heuristics/problem/problem.cu
  • cpp/src/branch_and_bound/branch_and_bound.cpp
  • cpp/src/linear_algebra/dense_vector.hpp
  • cpp/src/dual_simplex/crossover.cpp
  • cpp/tests/dual_simplex/unit_tests/solve_barrier.cu
  • cpp/src/branch_and_bound/pseudo_costs.cpp
  • cpp/src/mip_heuristics/solve.cu
  • cpp/src/linear_algebra/sparse_matrix.hpp
  • cpp/src/linear_algebra/vector_math.hpp
  • cpp/src/branch_and_bound/symmetry.hpp
  • cpp/src/linear_algebra/sparse_vector.hpp
  • cpp/src/branch_and_bound/pseudo_costs.hpp
  • cpp/src/barrier/device_sparse_matrix.cuh
  • cpp/src/linear_algebra/vector_math.cpp
  • cpp/src/linear_algebra/vector_math.cuh
  • cpp/src/barrier/translate_soc.hpp
  • cpp/src/pdlp/solve.cu
  • cpp/src/cuts/cuts.cpp
  • cpp/src/barrier/barrier.cu
  • cpp/src/barrier/sparse_cholesky.cuh
  • cpp/src/cuts/cuts.hpp

📝 Walkthrough

Walkthrough

The PR adds linear_algebra and math_optimization sources to the build, moves shared timing and scalar utilities into cuopt::mathematical_optimization, and updates barrier, dual simplex, cuts, branch-and-bound, MIP, PDLP, and tests to the relocated APIs.

Changes

Namespace and utility migration

Layer / File(s) Summary
Math optimization build and timing
cpp/src/CMakeLists.txt, cpp/src/math_optimization/*
The build registers the new math-optimization sources, and tic/toc plus the shared scalar types are declared under cuopt::mathematical_optimization.
Linear algebra API relocation
cpp/src/linear_algebra/*
The linear-algebra build, headers, and implementations move into cuopt::mathematical_optimization, and the dense, sparse, vector, norm, and CSR-sorting APIs switch to the new non-simplex types.
Barrier solver core
cpp/src/barrier/barrier.*, cpp/src/barrier/conjugate_gradient.hpp, cpp/src/barrier/iterative_refinement.hpp
Barrier solver entry points, conjugate-gradient helpers, iterative refinement, and residual logging switch to the relocated vector math and timing helpers, and the public create_Q signature uses the unqualified CSC matrix type.
Barrier matrix adapters
cpp/src/barrier/cusparse_view.*, cpp/src/barrier/device_sparse_matrix.*, cpp/src/barrier/pinned_host_allocator.*
The CSC/CSR device wrappers and pinned-host allocator retarget their matrix types and namespace scopes to the new linear-algebra headers.
Barrier factorization and SOC translation
cpp/src/barrier/sparse_cholesky.cuh, cpp/src/barrier/translate_soc.hpp, cpp/tests/socp/general_quadratic_test.cu
Sparse Cholesky and SOC translation switch their matrix, sparse-vector, and timing types to the relocated APIs, and the SOC test updates its matrix and inf references.
Dual simplex migration
cpp/src/dual_simplex/*, cpp/tests/dual_simplex/unit_tests/*
Dual simplex headers, implementations, CMake wiring, and unit tests replace dual_simplex includes with the new headers and switch public CSR and timing references to the new namespaces.
Branch-and-bound migration
cpp/src/branch_and_bound/*
Branch-and-bound, pseudo-cost, symmetry, worker, and deterministic coordinator code update their CSR matrix, inf, and tic/toc usage to the relocated headers.
Cuts and cut generation
cpp/src/cuts/*, cpp/tests/mip/cuts_test.cu
Cut interfaces, generators, and the cuts test switch to the new CSR and sparse-vector types, and variable_bounds_t changes its infinity-branch logic.
MIP heuristics and PDLP
cpp/src/mip_heuristics/*, cpp/src/pdlp/*
MIP heuristics and PDLP translation/solve code replace the old sort, timing, matrix, and norm helpers with the relocated APIs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • NVIDIA/cuopt#500: Both PRs touch the barrier solver’s quadratic-objective plumbing, including barrier_solver_t::create_Q(...) in cpp/src/barrier/barrier.hpp.
  • NVIDIA/cuopt#1290: Both PRs touch the SOCP/quadratic-to-cone conversion path in cpp/src/barrier/translate_soc.hpp.
  • NVIDIA/cuopt#1446: Both PRs cover the same barrier and linear-algebra namespace reorganization across cpp/src/barrier/* and cpp/src/linear_algebra/*.

Suggested reviewers

  • bdice
  • kaatish
  • nguidotti
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely summarizes the namespace refactor and shared primitive promotion described by the diff.
Description check ✅ Passed The description matches the change set, describing the relocation of shared linear algebra and utility code into the optimization namespace.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cpp/src/linear_algebra/vector_math.cuh (1)

100-113: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Use cuda::std::abs in the device lambda.

The new transform uses unqualified abs, while the existing device reducer above uses cuda::std::abs; making this explicit avoids host/device overload surprises for floating-point f_t.

Proposed fix
-    [] __host__ __device__(f_t val) { return abs(val); },
+    [] __host__ __device__(f_t val) { return cuda::std::abs(val); },

As per coding guidelines, “Prevent numerical instability (overflow, underflow, precision loss) producing wrong results.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/src/linear_algebra/vector_math.cuh` around lines 100 - 113, The device
lambda in vector_norm_inf currently uses unqualified abs, which can pick the
wrong overload for floating-point device code. Update the transform_reduce
lambda to use cuda::std::abs consistently with the rest of the file, and keep
the change localized to vector_norm_inf so the maximum absolute value reduction
remains explicit and device-safe.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cpp/src/linear_algebra/vector_math.cuh`:
- Around line 100-113: The device lambda in vector_norm_inf currently uses
unqualified abs, which can pick the wrong overload for floating-point device
code. Update the transform_reduce lambda to use cuda::std::abs consistently with
the rest of the file, and keep the change localized to vector_norm_inf so the
maximum absolute value reduction remains explicit and device-safe.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: cf69ebbe-a488-4896-8cda-48cf83f0eb13

📥 Commits

Reviewing files that changed from the base of the PR and between 4e87bf7 and c7d9e22.

📒 Files selected for processing (86)
  • cpp/src/CMakeLists.txt
  • cpp/src/barrier/barrier.cu
  • cpp/src/barrier/barrier.hpp
  • cpp/src/barrier/conjugate_gradient.hpp
  • cpp/src/barrier/cusparse_view.cu
  • cpp/src/barrier/cusparse_view.hpp
  • cpp/src/barrier/device_sparse_matrix.cu
  • cpp/src/barrier/device_sparse_matrix.cuh
  • cpp/src/barrier/iterative_refinement.hpp
  • cpp/src/barrier/pinned_host_allocator.cu
  • cpp/src/barrier/pinned_host_allocator.hpp
  • cpp/src/barrier/sparse_cholesky.cuh
  • cpp/src/barrier/translate_soc.hpp
  • cpp/src/branch_and_bound/branch_and_bound.cpp
  • cpp/src/branch_and_bound/branch_and_bound.hpp
  • cpp/src/branch_and_bound/deterministic_workers.hpp
  • cpp/src/branch_and_bound/diving_heuristics.cpp
  • cpp/src/branch_and_bound/mip_node.hpp
  • cpp/src/branch_and_bound/pseudo_costs.cpp
  • cpp/src/branch_and_bound/pseudo_costs.hpp
  • cpp/src/branch_and_bound/symmetry.hpp
  • cpp/src/branch_and_bound/worker.hpp
  • cpp/src/branch_and_bound/worker_pool.hpp
  • cpp/src/cuts/cuts.cpp
  • cpp/src/cuts/cuts.hpp
  • cpp/src/dual_simplex/CMakeLists.txt
  • cpp/src/dual_simplex/basis_solves.cpp
  • cpp/src/dual_simplex/basis_solves.hpp
  • cpp/src/dual_simplex/basis_updates.hpp
  • cpp/src/dual_simplex/bound_flipping_ratio_test.cpp
  • cpp/src/dual_simplex/bound_flipping_ratio_test.hpp
  • cpp/src/dual_simplex/crossover.cpp
  • cpp/src/dual_simplex/crossover.hpp
  • cpp/src/dual_simplex/folding.cpp
  • cpp/src/dual_simplex/folding.hpp
  • cpp/src/dual_simplex/initial_basis.cpp
  • cpp/src/dual_simplex/initial_basis.hpp
  • cpp/src/dual_simplex/phase1.cpp
  • cpp/src/dual_simplex/phase1.hpp
  • cpp/src/dual_simplex/phase2.cpp
  • cpp/src/dual_simplex/phase2.hpp
  • cpp/src/dual_simplex/presolve.cpp
  • cpp/src/dual_simplex/presolve.hpp
  • cpp/src/dual_simplex/primal.cpp
  • cpp/src/dual_simplex/primal.hpp
  • cpp/src/dual_simplex/right_looking_lu.cpp
  • cpp/src/dual_simplex/right_looking_lu.hpp
  • cpp/src/dual_simplex/scaling.cpp
  • cpp/src/dual_simplex/scaling.hpp
  • cpp/src/dual_simplex/simplex_solver_settings.hpp
  • cpp/src/dual_simplex/singletons.cpp
  • cpp/src/dual_simplex/singletons.hpp
  • cpp/src/dual_simplex/solution.hpp
  • cpp/src/dual_simplex/solve.cpp
  • cpp/src/dual_simplex/solve.hpp
  • cpp/src/dual_simplex/triangle_solve.hpp
  • cpp/src/dual_simplex/user_problem.hpp
  • cpp/src/linear_algebra/CMakeLists.txt
  • cpp/src/linear_algebra/dense_matrix.hpp
  • cpp/src/linear_algebra/dense_vector.hpp
  • cpp/src/linear_algebra/sort_csr.cuh
  • cpp/src/linear_algebra/sparse_matrix.cpp
  • cpp/src/linear_algebra/sparse_matrix.hpp
  • cpp/src/linear_algebra/sparse_vector.cpp
  • cpp/src/linear_algebra/sparse_vector.hpp
  • cpp/src/linear_algebra/vector_math.cpp
  • cpp/src/linear_algebra/vector_math.cuh
  • cpp/src/linear_algebra/vector_math.hpp
  • cpp/src/math_optimization/CMakeLists.txt
  • cpp/src/math_optimization/tic_toc.cpp
  • cpp/src/math_optimization/tic_toc.hpp
  • cpp/src/math_optimization/types.hpp
  • cpp/src/mip_heuristics/diversity/lns/rins.cu
  • cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh
  • cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu
  • cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu
  • cpp/src/mip_heuristics/presolve/semi_continuous.cu
  • cpp/src/mip_heuristics/problem/problem.cu
  • cpp/src/mip_heuristics/solve.cu
  • cpp/src/pdlp/solve.cu
  • cpp/src/pdlp/translate.hpp
  • cpp/tests/dual_simplex/unit_tests/right_looking_ldlt.cpp
  • cpp/tests/dual_simplex/unit_tests/solve.cpp
  • cpp/tests/dual_simplex/unit_tests/solve_barrier.cu
  • cpp/tests/mip/cuts_test.cu
  • cpp/tests/socp/general_quadratic_test.cu
💤 Files with no reviewable changes (1)
  • cpp/src/dual_simplex/CMakeLists.txt

…timization

Move general-purpose sparse/dense linear-algebra types and helpers out of the
algorithm-specific simplex/barrier/mip namespaces into the parent
cuopt::mathematical_optimization namespace, under a new cpp/src/linear_algebra/
directory. These symbols (csc_matrix_t, csr_matrix_t, sparse_vector_t,
vector_norm*/dot, matrix(_transpose)_vector_multiply, dense_vector_t,
dense_matrix_t, sort_csr) are not tied to any one algorithm and are already
consumed across simplex, barrier, pdlp, and mip.

sort_csr is additionally decoupled from mip_heuristics by including the public
optimization_problem.hpp directly. Explicit template instantiations and
out-of-line member definitions for these templates (hosted in barrier/*.cu) are
moved into the parent namespace alongside the templates.

No behavioral or API change; pure relocation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
@mlubin mlubin force-pushed the refactor/promote-linear-algebra-namespace branch from c7d9e22 to b132224 Compare June 26, 2026 20:24
@mlubin

mlubin commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b132224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants