diff --git a/cpp/src/linear_programming/solver_solution.cu b/cpp/src/linear_programming/solver_solution.cu index 41cb9b47a..1a73afe78 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(),