forked from cp-algorithms/cp-algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_rank_matrix.cpp
More file actions
55 lines (46 loc) · 865 Bytes
/
test_rank_matrix.cpp
File metadata and controls
55 lines (46 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <bits/stdc++.h>
using namespace std;
#include "matrix-rank.h"
typedef double dbl;
typedef vector<vector<dbl> > matrix;
void test1(){
matrix A(3);
A[0] = {1, 1, 0};
A[1] = {0, 1, 0};
A[2] = {1, 0, 0};
assert(compute_rank(A) == 2);
}
void test2(){
matrix A(3);
A[0] = {1, 1, 1};
A[1] = {0, 1, 1};
A[2] = {0, 0, 1};
assert(compute_rank(A) == 3);
}
void test3(){
matrix A(3);
A[0] = {0, 0, 0};
A[1] = {0, 0, 0};
A[2] = {0, 0, 0};
assert(compute_rank(A) == 0);
}
void test4(){
matrix A(3);
A[0] = {1, 1, 1};
A[1] = {1, 1, 1};
A[2] = {1, 1, 1};
assert(compute_rank(A) == 1);
}
void test5(){
matrix A(2);
A[0] = {1, 0, 1, 0};
A[1] = {0, 1, 0, 1};
assert(compute_rank(A) == 2);
}
int main(){
test1();
test2();
test3();
test4();
test5();
}