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 8
8
// ! affected by row operations
9
9
// ! @time O(n * m * min(cols, n))
10
10
// ! @space O(1)
11
- pii row_reduce (vector<vector< int > >& mat, int cols) {
11
+ pii row_reduce (vector<vi >& mat, int cols) {
12
12
int n = sz (mat), m = sz (mat[0 ]), rank = 0 ;
13
13
int det = 1 ;
14
14
for (int col = 0 ; col < cols && rank < n; col++) {
Original file line number Diff line number Diff line change 12
12
// ! @space O(m)
13
13
struct solve_linear_mod {
14
14
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) {
18
17
int n = sz (mat), m = sz (mat[0 ]);
19
18
rep (i, 0 , n) mat[i].push_back (rhs[i]);
20
19
tie (rank, det) = row_reduce (mat, m);
You can’t perform that action at this time.
0 commit comments