Code: Alles auswählen
def init_vector(matrix):
a_matrix= zeros(matrix.shape[0], matrix.shape[1])
#a_matrix=np.matrix([a]).astype(float)
#b_matrix=zeros(matrix.shape[0], matrix.shape[1])
for i in range(matrix.shape[0]):
for j in range(matrix.shape[1]):
a_matrix[i,j]=randint(-10,10)
#b_matrix[i,j]=randint(-10,10)
w=widgets.Textarea(
description='Multwert',
value = str(a_matrix),
)
display(w)
return a_matrix
Dann habe ich eine Liste x=[]
Diese Matrix wird in die Liste gelesen.
Code: Alles auswählen
if len(i_progr.init_vector(m_1)) > 1:
x.extend(i_progr.init_vector(m_1))
w=widgets.Textarea(
description='typinfo',
value = str(type(x[0])),
)
display(w)
else:
x.append(i_progr.init_vector(m_1))
w=widgets.Textarea(
description='typinfo',
value = str(type(x[0])),
)
display(w)
Wenn ich zwei Matrizen zurückgebe erhalte ich das richtige Ergebnis:
x[0]= matrix1
x[1]= matrix2