Ich habe einen Code von Haar Tranform Matrix von Matlab zu Python erstellt es ist ein Erfolg bei der Eingabe der Wert von n für 2 und 4, aber wenn ich versuche, 8 gibt es einen FehlerHaar Transform Matrize von Matlab zu Python
"Traceback (letzter Aufruf zuletzt): Datei" Python ", Zeile 20, in ValueError: Form zu groß, um eine Matrix zu sein."
hier ist mein Code
import numpy as np
import math
n=8
# check input parameter and make sure it's the power of 2
Level1 = math.log(n, 2)
Level = int(Level1)+1
#Initialization
H = [1]
NC = 1/math.sqrt(2) #normalization constant
LP = [1, 1]
HP = [1,-1]
for i in range(1,Level):
H = np.dot(NC, [np.matrix(np.kron(H, LP)), np.matrix(np.kron(np.eye(len(H)), HP))])
print H
Bitte Überlegen Sie, ob Sie Interpunktion in Ihrer Prosa verwenden –