-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathretrieveTransposeLinearOperatorFunction.py
More file actions
50 lines (37 loc) · 1.07 KB
/
retrieveTransposeLinearOperatorFunction.py
File metadata and controls
50 lines (37 loc) · 1.07 KB
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
import numpy as np
# Redéfinir D et Z
D = np.array([[1, 1, 0],
[0, 1, 0],
[0, 0, 1]])
Z = np.array([0, 1, 0, -1])
# Appliquer np.convolve sur les lignes de D et Z (mode='full' pour obtenir la convolution complète)
conv_results = []
for i in range(D.shape[0]):
print("D : ", D.T[i])
conv = np.convolve(D.T[i], Z, mode='full')
print("D*Z : ",conv)
conv_results.append(conv)
# Empiler les résultats colonne par colonne
y = np.column_stack(conv_results)
print("convolutions y = ")
print(y)
A = y@np.linalg.inv(D)
#A = np.array(([0,0,0],[1,0,0],[0,1,0],[-1,0,1],[0,-1,0],[0,0,-1]))
print("A : ")
print(A)
print("A.T : ")
print(A.T)
# Appliquer np.correlate sur les lignes de D et Z
correlation_results = []
for i in range(D.shape[0]):
print("y : ", y[:,i])
corr = np.correlate(y[:,i],Z, mode='valid')
print("Z*y : ",corr)
correlation_results.append(corr)
correlation_results = np.column_stack(correlation_results)
print("A^T @ y")
print(A.T @ y)
print("correlations : ")
print(correlation_results)
print("A@D")
print(A@D)