Skip to content
Snippets Groups Projects
test_list_schedulers.py 65.2 KiB
Newer Older
  • Learn to ignore specific revisions
  •     input_samples = [Constant(waveform[i]) for i in range(points)]
        sim = Simulation(schedule.sfg, input_samples)
    
        exp_res = np.fft.fft(waveform)
        res = sim.results
        for i in range(points):
    
            assert np.all(np.isclose(a, b))
    
    def _validate_recreated_sfg_ldlt_matrix_inverse(
        schedule: Schedule, N: int, delays: list[int] | None = None
    ) -> None:
        if delays is None:
            num_of_outputs = N * (N + 1) // 2
            delays = [0 for i in range(num_of_outputs)]
    
    
        A = np.random.default_rng().random((N, N))
    
        A = np.dot(A, A.T)
    
        # iterate through the upper diagonal and construct the input to the SFG
        input_signals = []
        for i in range(N):
            for j in range(i, N):
                input_signals.append(Constant(A[i, j]))
    
        A_inv = np.linalg.inv(A)
        sim = Simulation(schedule.sfg, input_signals)
    
    
        # iterate through the upper diagonal and check
        count = 0
        for i in range(N):
            for j in range(i, N):
    
                assert np.all(
                    np.isclose(sim.results[str(count)][delays[count] :], A_inv[i, j])
                )