From 9b3b9cd745e6d151a3a7e941771a0bd86b6d1545 Mon Sep 17 00:00:00 2001 From: Rajesh Gandham Date: Tue, 17 Jun 2025 12:59:01 -0700 Subject: [PATCH] Fix bug in optimization_problem_solution_t::copy_from --- cpp/src/linear_programming/solver_solution.cu | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpp/src/linear_programming/solver_solution.cu b/cpp/src/linear_programming/solver_solution.cu index 41cb9b47a4..1a73afe787 100644 --- a/cpp/src/linear_programming/solver_solution.cu +++ b/cpp/src/linear_programming/solver_solution.cu @@ -124,6 +124,12 @@ template void optimization_problem_solution_t::copy_from( const raft::handle_t* handle_ptr, const optimization_problem_solution_t& other) { + // Resize to make sure they are of same size + primal_solution_.resize(other.primal_solution_.size(), handle_ptr->get_stream()); + dual_solution_.resize(other.dual_solution_.size(), handle_ptr->get_stream()); + reduced_cost_.resize(other.reduced_cost_.size(), handle_ptr->get_stream()); + + // Copy the data raft::copy(primal_solution_.data(), other.primal_solution_.data(), primal_solution_.size(),