@@ -44,14 +44,16 @@ def initialize_variables(data_input, component_amount, data_type, sparsity=1, sm
44
44
45
45
component_matrix_guess = np .random .rand (signal_length , component_amount )
46
46
weight_matrix_guess = np .random .rand (component_amount , moment_amount )
47
- stretching_matrix_guess = np .ones (component_amount , moment_amount ) + np .random .randn (component_amount ,
47
+ stretching_matrix_guess = np .ones (( component_amount , moment_amount ) ) + np .random .randn (component_amount ,
48
48
moment_amount ) * 1e-3
49
49
50
50
diagonals = [np .ones (moment_amount - 2 ), - 2 * np .ones (moment_amount - 2 ), np .ones (moment_amount - 2 )]
51
51
smoothness_term = .25 * scipy .sparse .diags (diagonals , [0 , 1 , 2 ], shape = (moment_amount - 2 , moment_amount ))
52
52
53
53
hessian_helper_matrix = scipy .sparse .block_diag ([smoothness_term .T @ smoothness_term ] * component_amount )
54
54
sequence = np .arange (moment_amount * component_amount ).reshape (component_amount , moment_amount ).T .flatten ()
55
+
56
+ hessian_helper_matrix = hessian_helper_matrix .tocsr ()
55
57
hessian_helper_matrix = hessian_helper_matrix [sequence , :][:, sequence ]
56
58
57
59
return {
@@ -102,7 +104,7 @@ def load_input_signals(file_path=None):
102
104
for item in directory_path .iterdir ():
103
105
if item .is_file ():
104
106
data = loadData (item .resolve ())
105
- if current_grid and current_grid != data [:, 0 ]:
107
+ if len ( current_grid ) != 0 and ( current_grid != data [:, 0 ]). any () :
106
108
print (f"{ item .name } was ignored as it is not on a compatible grid." )
107
109
continue
108
110
else :
0 commit comments