|
90 | 90 |
|
91 | 91 | import abc
|
92 | 92 | import numpy as np
|
93 |
| -from romtools.trial_space.utils import * |
| 93 | +from romtools.trial_space.utils import tensor_to_matrix, matrix_to_tensor |
| 94 | +from romtools.trial_space.utils.truncater import * |
| 95 | +from romtools.trial_space.utils.shifter import * |
| 96 | +from romtools.trial_space.utils.scaler import * |
| 97 | +from romtools.trial_space.utils.splitter import * |
| 98 | +from romtools.trial_space.utils.orthogonalizer import * |
| 99 | + |
94 | 100 |
|
95 | 101 | class TrialSpace(abc.ABC):
|
96 | 102 | '''
|
@@ -242,7 +248,7 @@ def __init__(self,
|
242 | 248 |
|
243 | 249 | n_var = snapshots.shape[0]
|
244 | 250 | shifted_snapshots, self.__shift_vector = shifter(snapshots)
|
245 |
| - snapshot_matrix = utils.tensor_to_matrix(shifted_snapshots) |
| 251 | + snapshot_matrix = tensor_to_matrix(shifted_snapshots) |
246 | 252 | shifted_split_snapshots = splitter(snapshot_matrix)
|
247 | 253 |
|
248 | 254 | svd_picked = np.linalg.svd if svdFnc is None else svdFnc
|
@@ -318,14 +324,14 @@ def __init__(self, snapshots,
|
318 | 324 | n_var = snapshots.shape[0]
|
319 | 325 | shifted_snapshots, self.__shift_vector = shifter(snapshots)
|
320 | 326 | scaled_shifted_snapshots = scaler.pre_scaling(shifted_snapshots)
|
321 |
| - snapshot_matrix = utils.tensor_to_matrix(scaled_shifted_snapshots) |
| 327 | + snapshot_matrix = tensor_to_matrix(scaled_shifted_snapshots) |
322 | 328 | snapshot_matrix = splitter(snapshot_matrix)
|
323 | 329 |
|
324 | 330 | lsv, svals, _ = np.linalg.svd(snapshot_matrix, full_matrices=False)
|
325 | 331 | self.__basis = truncater(lsv, svals)
|
326 | 332 | self.__basis = matrix_to_tensor(n_var, self.__basis)
|
327 | 333 | self.__basis = scaler.post_scaling(self.__basis)
|
328 |
| - self.__basis = utils.tensor_to_matrix(self.__basis) |
| 334 | + self.__basis = tensor_to_matrix(self.__basis) |
329 | 335 | self.__basis = orthogonalizer(self.__basis)
|
330 | 336 | self.__basis = matrix_to_tensor(n_var, self.__basis)
|
331 | 337 | self.__dimension = self.__basis.shape[2]
|
|
0 commit comments