@@ -317,6 +317,62 @@ highs_getBasisTransposeSolveSparse(Highs* h, dense_array_t<double> rhs) {
317317 return std::make_tuple (status, py::cast (solution_vector), solution_num_nz, py::cast (solution_index));
318318}
319319
320+ std::tuple<HighsStatus, dense_array_t <double >>
321+ highs_getReducedRow (Highs* h, HighsInt row) {
322+ HighsInt num_col = h->getNumCol ();
323+ HighsInt num_row = h->getNumRow ();
324+
325+ HighsStatus status = HighsStatus::kOk ;
326+ std::vector<double > solution_vector (num_col);
327+ double * solution_vector_ptr = static_cast <double *>(solution_vector.data ());
328+
329+ if (num_row > 0 ) status = h->getReducedRow (row, solution_vector_ptr);
330+ return std::make_tuple (status, py::cast (solution_vector));
331+ }
332+
333+ std::tuple<HighsStatus, dense_array_t <double >, HighsInt, dense_array_t <HighsInt>>
334+ highs_getReducedRowSparse (Highs* h, HighsInt row) {
335+ HighsInt num_col = h->getNumCol ();
336+ HighsInt num_row = h->getNumRow ();
337+
338+ HighsStatus status = HighsStatus::kOk ;
339+ HighsInt solution_num_nz = 0 ;
340+ std::vector<double > solution_vector (num_row);
341+ std::vector<HighsInt> solution_index (num_row);
342+ double * solution_vector_ptr = static_cast <double *>(solution_vector.data ());
343+ HighsInt* solution_index_ptr = static_cast <HighsInt*>(solution_index.data ());
344+
345+ if (num_row > 0 ) status = h->getReducedRow (row, solution_vector_ptr, &solution_num_nz, solution_index_ptr);
346+ return std::make_tuple (status, py::cast (solution_vector), solution_num_nz, py::cast (solution_index));
347+ }
348+
349+ std::tuple<HighsStatus, dense_array_t <double >>
350+ highs_getReducedColumn (Highs* h, HighsInt col) {
351+ HighsInt num_row = h->getNumRow ();
352+
353+ HighsStatus status = HighsStatus::kOk ;
354+ std::vector<double > solution_vector (num_row);
355+ double * solution_vector_ptr = static_cast <double *>(solution_vector.data ());
356+
357+ if (num_row > 0 ) status = h->getReducedColumn (col, solution_vector_ptr);
358+ return std::make_tuple (status, py::cast (solution_vector));
359+ }
360+
361+ std::tuple<HighsStatus, dense_array_t <double >, HighsInt, dense_array_t <HighsInt>>
362+ highs_getReducedColumnSparse (Highs* h, HighsInt col) {
363+ HighsInt num_row = h->getNumRow ();
364+
365+ HighsStatus status = HighsStatus::kOk ;
366+ HighsInt solution_num_nz = 0 ;
367+ std::vector<double > solution_vector (num_row);
368+ std::vector<HighsInt> solution_index (num_row);
369+ double * solution_vector_ptr = static_cast <double *>(solution_vector.data ());
370+ HighsInt* solution_index_ptr = static_cast <HighsInt*>(solution_index.data ());
371+
372+ if (num_row > 0 ) status = h->getReducedColumn (col, solution_vector_ptr, &solution_num_nz, solution_index_ptr);
373+ return std::make_tuple (status, py::cast (solution_vector), solution_num_nz, py::cast (solution_index));
374+ }
375+
320376HighsStatus highs_addRow (Highs* h, double lower, double upper,
321377 HighsInt num_new_nz, dense_array_t <HighsInt> indices,
322378 dense_array_t <double > values) {
@@ -1176,10 +1232,10 @@ PYBIND11_MODULE(_core, m, py::mod_gil_not_used()) {
11761232 .def (" getBasisSolveSparse" , &highs_getBasisSolveSparse)
11771233 .def (" getBasisTransposeSolve" , &highs_getBasisTransposeSolve)
11781234 .def (" getBasisTransposeSolveSparse" , &highs_getBasisTransposeSolveSparse)
1179- // .def("getReducedRow", &highs_getReducedRow)
1180- // .def("getReducedRowSparse", &highs_getReducedRowSparse)
1181- // .def("getReducedColumn", &highs_getReducedColumn)
1182- // .def("getReducedColumnSparse", &highs_getReducedColumnSparse)
1235+ .def (" getReducedRow" , &highs_getReducedRow)
1236+ .def (" getReducedRowSparse" , &highs_getReducedRowSparse)
1237+ .def (" getReducedColumn" , &highs_getReducedColumn)
1238+ .def (" getReducedColumnSparse" , &highs_getReducedColumnSparse)
11831239 .def (" getNumCol" , &Highs::getNumCol)
11841240 .def (" getNumRow" , &Highs::getNumRow)
11851241 .def (" getNumNz" , &Highs::getNumNz)
0 commit comments