Example #1
0
def test_weight_scaling():
    weights = np.array([[0.1, 0.6, 0.3]])
    beta = np.array([[1.0, 2.0, 1.0]])
    correct = np.array([[0.3/0.55, 0.15/0.55, 0.1/0.55]])
    result = ext_weno.scaled_weights(1, 3,  1e-6, weights, beta)
    np.testing.assert_almost_equal(np.sum(result), 1.0)
    np.testing.assert_almost_equal(result, correct, 5)
Example #2
0
def compute_helper(now, padded, half_width, side_index, coeffs, smoothness, weights, eps):
    cells = len(now)
    weights = weights[:, side_index]
    coeffs = coeffs[:, side_index]
    beta = ext_weno.mult_with_smoothness(cells, half_width,
                                         padded, smoothness)
    s_weights = ext_weno.scaled_weights(cells, half_width,
                                        eps, weights, beta)
    small_polynomials = ext_weno.mult_with_coeffs(cells, half_width,
                                                  padded, coeffs)
    reconstruction = ext_weno.mult_polynomials(cells, half_width,
                                               s_weights, small_polynomials)
    return np.array(reconstruction)