@@ -63,7 +63,8 @@ Status Markowitz::ComputeRowAndColumnPermutation(
63
63
// Initialize residual_matrix_non_zero_ with the submatrix left after we
64
64
// removed the singleton and residual singleton columns.
65
65
residual_matrix_non_zero_.InitializeFromMatrixSubset (
66
- basis_matrix, *row_perm, *col_perm, &singleton_column_, &singleton_row_);
66
+ basis_matrix, row_perm->const_view (), col_perm->const_view (),
67
+ &singleton_column_, &singleton_row_);
67
68
68
69
// Perform Gaussian elimination.
69
70
const int end_index = std::min (num_rows.value (), num_cols.value ());
@@ -216,9 +217,9 @@ void Markowitz::ExtractSingletonColumns(
216
217
basis_matrix.num_rows ().value ());
217
218
}
218
219
219
- bool Markowitz::IsResidualSingletonColumn (const ColumnView& column,
220
- const RowPermutation& row_perm,
221
- RowIndex* row) {
220
+ bool Markowitz::IsResidualSingletonColumn (
221
+ const ColumnView& column, StrictITISpan<RowIndex, const RowIndex> row_perm,
222
+ RowIndex* row) {
222
223
int residual_degree = 0 ;
223
224
for (const auto e : column) {
224
225
if (row_perm[e.row ()] != kInvalidRow ) continue ;
@@ -238,7 +239,9 @@ void Markowitz::ExtractResidualSingletonColumns(
238
239
for (ColIndex col (0 ); col < num_cols; ++col) {
239
240
if ((*col_perm)[col] != kInvalidCol ) continue ;
240
241
const ColumnView column = basis_matrix.column (col);
241
- if (!IsResidualSingletonColumn (column, *row_perm, &row)) continue ;
242
+ if (!IsResidualSingletonColumn (column, row_perm->const_view (), &row)) {
243
+ continue ;
244
+ }
242
245
(*col_perm)[col] = ColIndex (*index );
243
246
(*row_perm)[row] = RowIndex (*index );
244
247
lower_.AddDiagonalOnlyColumn (1.0 );
@@ -569,8 +572,10 @@ void MatrixNonZeroPattern::Reset(RowIndex num_rows, ColIndex num_cols) {
569
572
}
570
573
571
574
void MatrixNonZeroPattern::InitializeFromMatrixSubset (
572
- const CompactSparseMatrixView& basis_matrix, const RowPermutation& row_perm,
573
- const ColumnPermutation& col_perm, std::vector<ColIndex>* singleton_columns,
575
+ const CompactSparseMatrixView& basis_matrix,
576
+ StrictITISpan<RowIndex, const RowIndex> row_perm,
577
+ StrictITISpan<ColIndex, const ColIndex> col_perm,
578
+ std::vector<ColIndex>* singleton_columns,
574
579
std::vector<RowIndex>* singleton_rows) {
575
580
const ColIndex num_cols = basis_matrix.num_cols ();
576
581
const RowIndex num_rows = basis_matrix.num_rows ();
0 commit comments