File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
library/math/matrix_related Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change 88// ! affected by row operations
99// ! @time O(n * m * min(cols, n))
1010// ! @space O(1)
11- pii row_reduce (vector<vector< int > >& mat, int cols) {
11+ pii row_reduce (vector<vi >& mat, int cols) {
1212 int n = sz (mat), m = sz (mat[0 ]), rank = 0 ;
1313 int det = 1 ;
1414 for (int col = 0 ; col < cols && rank < n; col++) {
Original file line number Diff line number Diff line change 1212// ! @space O(m)
1313struct solve_linear_mod {
1414 int rank, det;
15- vector<int > sol;
16- solve_linear_mod (vector<vector<int >>& mat,
17- const vector<int >& rhs) {
15+ vi sol;
16+ solve_linear_mod (vector<vi>& mat, const vi& rhs) {
1817 int n = sz (mat), m = sz (mat[0 ]);
1918 rep (i, 0 , n) mat[i].push_back (rhs[i]);
2019 tie (rank, det) = row_reduce (mat, m);
You can’t perform that action at this time.
0 commit comments