-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnullspaces.py
59 lines (53 loc) · 1.49 KB
/
nullspaces.py
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
56
57
58
59
import numpy.linalg as linalg
import numpy as np
from create_matrix import left_matrix,right_matrix
from reduce_obj import *
M = np.transpose(left_matrix(12))
N = np.transpose(right_matrix(12))
# print(M-N)
T = M-N
op = [[]]
m = [T]
def test(op,new_op):
if len(op) != len(new_op):
return True
else:
for k in range(len(op)):
if op[k] != new_op[k]:
return True
return False
def reduction(m,op):
if np.any(T):
new_m = []
new_op = []
for k in range(len(m)):
M = m[k]
singular_rows = singular_rows(M)
if singular_rows:
row = singular_rows[0]
i,j = get_singular_row_tuple(row)
new_array = reduce(M,i,j,row)
new_op_seq = op[k] + [row]
new_m.append(new_array)
new_op.append(new_op_seq)
if not singular_rows:
transitive_tuples = transitive_tuples(M)
for tuple in transitive_tuples:
pass
else:
return T,op
# reductions = [[]]
# print(T)
# while np.any(T):
# T = clean(T)
# print("cleaned")
# print(T)
# if T.shape != singular_reduction(T).shape :
# T = singular_reduction(T)
# print("sing")
# elif T.shape != transitive_reduction(T).shape:
# T = transitive_reduction(T)
# print("trans")
# else:
# break
# print(T)