Test explicit evaluation of trace operator for correctness.
(basis, N, dealias, dtype, layout)
| 136 | @pytest.mark.parametrize('dtype', dtype_range) |
| 137 | @pytest.mark.parametrize('layout', ['c', 'g']) |
| 138 | def test_trace_explicit(basis, N, dealias, dtype, layout): |
| 139 | """Test explicit evaluation of trace operator for correctness.""" |
| 140 | c, d, b, r = basis(N, dealias, dtype) |
| 141 | # Random tensor field |
| 142 | f = d.TensorField((c,c), bases=b) |
| 143 | f.fill_random(layout='g') |
| 144 | # Evaluate trace |
| 145 | f.change_layout(layout) |
| 146 | g = d3.trace(f).evaluate() |
| 147 | assert np.allclose(g[layout], np.trace(f[layout])) |
| 148 | |
| 149 | |
| 150 | @pytest.mark.parametrize('basis', [build_FF, build_FC, build_CC, build_FFF, build_FFC]) |
nothing calls this directly
no test coverage detected