MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / getSubVectorsTranspose

Function getSubVectorsTranspose

highs/lp_data/HighsLpUtils.cpp:3527–3662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3525}
3526
3527void getSubVectorsTranspose(const HighsIndexCollection& index_collection,
3528 const HighsInt data_dim, const double* data0,
3529 const double* data1, const double* data2,
3530 const HighsSparseMatrix& matrix,
3531 HighsInt& num_sub_vector, double* sub_vector_data0,
3532 double* sub_vector_data1, double* sub_vector_data2,
3533 HighsInt& sub_matrix_num_nz,
3534 HighsInt* sub_matrix_start,
3535 HighsInt* sub_matrix_index,
3536 double* sub_matrix_value) {
3537 // Ensure that if there's no data0 then it's not required in the
3538 // sub-vector
3539 if (data0 == nullptr) assert(sub_vector_data0 == nullptr);
3540 assert(ok(index_collection));
3541 HighsInt from_k;
3542 HighsInt to_k;
3543 limits(index_collection, from_k, to_k);
3544 // Surely this is checked elsewhere
3545 assert(0 <= from_k && to_k < data_dim);
3546 assert(from_k <= to_k);
3547 // "Out" means not in the set to be extracted
3548 // "In" means in the set to be extracted
3549 HighsInt out_from_vector;
3550 HighsInt out_to_vector;
3551 HighsInt in_from_vector;
3552 HighsInt in_to_vector = -1;
3553 HighsInt current_set_entry = 0;
3554 // Set up a mask so that entries to be got from the matrix can be
3555 // identified and have their correct index.
3556 vector<HighsInt> new_index;
3557 new_index.resize(data_dim);
3558
3559 num_sub_vector = 0;
3560 sub_matrix_num_nz = 0;
3561 if (!index_collection.is_mask_) {
3562 out_to_vector = -1;
3563 current_set_entry = 0;
3564 for (HighsInt k = from_k; k <= to_k; k++) {
3565 updateOutInIndex(index_collection, in_from_vector, in_to_vector,
3566 out_from_vector, out_to_vector, current_set_entry);
3567 if (k == from_k) {
3568 // Account for any initial vectors not being extracted
3569 for (HighsInt iVector = 0; iVector < in_from_vector; iVector++) {
3570 new_index[iVector] = -1;
3571 }
3572 }
3573 for (HighsInt iVector = in_from_vector; iVector <= in_to_vector;
3574 iVector++) {
3575 new_index[iVector] = num_sub_vector;
3576 num_sub_vector++;
3577 }
3578 for (HighsInt iVector = out_from_vector; iVector <= out_to_vector;
3579 iVector++) {
3580 new_index[iVector] = -1;
3581 }
3582 if (out_to_vector >= data_dim - 1) break;
3583 }
3584 } else {

Callers 2

getColsInterfaceMethod · 0.85
getRowsInterfaceMethod · 0.85

Calls 5

okFunction · 0.85
limitsFunction · 0.85
updateOutInIndexFunction · 0.85
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected