-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathricl2.py
More file actions
36 lines (36 loc) · 757 Bytes
/
ricl2.py
File metadata and controls
36 lines (36 loc) · 757 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
import numpy as np
def calc(X,s,n,m):
de=0.0
for q in range(m-s+1):
sum=0.0
x2=np.zeros((n,n), dtype = float)
for i in range(n):
for j in range(n):
for k in range(q,s+q):
x2[i][j] = x2[i][j] + X[i][k] * X[j][k]
z=np.linalg.eigvals(x2)
print(z)
a=abs(np.amax(z))
b=abs(np.amin(z))
de=max(de,a-1)#,1-b)
return de
n=3
m=3
X=[]
ma=-1.0
s=2
for i in range(n):
a =[]
for j in range(m):
a.append(float(input()))
X.append(a)
for i in range(n):
for j in range(m):
if X[i][j]>ma:
ma=X[i][j]
de=calc(X,s,n,m)
if de<1 and de>0:
de=max(de,ma)
print(" matrix A satisfies the s-restricted isometry property with restricted isometry constant δk=", de)
else:
print(" matrix A doesn't satisfy the s-restricted isometry property")