[fdfd.operators] fix eh_full for non-None mu

This commit is contained in:
Jan Petykiewicz 2026-04-17 23:15:33 -07:00
commit 0afe2297b0
4 changed files with 178 additions and 4 deletions

View file

@ -70,6 +70,15 @@ def test_eh_full_matches_sparse_operator_with_mu() -> None:
assert_fields_match(functional_h, matrix_h)
def test_eh_full_matches_sparse_operator_without_mu() -> None:
matrix_result = operators.eh_full(OMEGA, DXES, vec(EPSILON)) @ numpy.concatenate([vec(E_FIELD), vec(H_FIELD)])
matrix_e, matrix_h = (unvec(part, SHAPE) for part in numpy.split(matrix_result, 2))
functional_e, functional_h = functional.eh_full(OMEGA, DXES, EPSILON)(E_FIELD, H_FIELD)
assert_fields_match(functional_e, matrix_e)
assert_fields_match(functional_h, matrix_h)
def test_e2h_matches_sparse_operator_with_mu() -> None:
matrix_result = apply_matrix(
operators.e2h(OMEGA, DXES, vec(MU)),
@ -80,6 +89,16 @@ def test_e2h_matches_sparse_operator_with_mu() -> None:
assert_fields_match(functional_result, matrix_result)
def test_e2h_matches_sparse_operator_without_mu() -> None:
matrix_result = apply_matrix(
operators.e2h(OMEGA, DXES),
E_FIELD,
)
functional_result = functional.e2h(OMEGA, DXES)(E_FIELD)
assert_fields_match(functional_result, matrix_result)
def test_m2j_matches_sparse_operator_without_mu() -> None:
matrix_result = apply_matrix(
operators.m2j(OMEGA, DXES),