Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/dolfinx_adjoint/blocks/_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ def _vector(
Returns:
A distributed vector.
"""
vtype: (
type[dolfinx.cpp.la.Vector_float32]
| type[dolfinx.cpp.la.Vector_float64]
| type[dolfinx.cpp.la.Vector_complex64]
| type[dolfinx.cpp.la.Vector_complex128]
| type[dolfinx.cpp.la.Vector_int8]
| type[dolfinx.cpp.la.Vector_int32]
| type[dolfinx.cpp.la.Vector_int64]
)
if np.issubdtype(dtype, np.float32):
vtype = dolfinx.cpp.la.Vector_float32
elif np.issubdtype(dtype, np.float64):
Expand Down
2 changes: 1 addition & 1 deletion src/dolfinx_adjoint/types/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _ad_dot(self, other: typing.Self, options: typing.Optional[dict] = None):
options = {} if options is None else options
riesz_representation = options.get("riesz_representation", "l2")
if riesz_representation == "l2":
return dolfinx.cpp.la.inner_product(self.x._cpp_object, other.x._cpp_object)
return dolfinx.cpp.la.inner_product(self.x._cpp_object, other.x._cpp_object) # type: ignore[arg-type]
elif riesz_representation == "L2":
form_compiler_options = options.get("form_compiler_options", None)
jit_options = options.get("jit_options", None)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_poisson_mother.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def reference_solution(
J_org = mesh.comm.allreduce(dolfinx.fem.assemble_scalar(dolfinx.fem.form(J_compiled)), op=MPI.SUM)
steps = [step_length * (1 / 2) ** i for i in range(num_steps)]

dJac_dm = dolfinx.cpp.la.inner_product(Jac_vec._cpp_object, dm.x._cpp_object)
Hm_dm = dolfinx.cpp.la.inner_product(Hm_vec._cpp_object, dm.x._cpp_object)
dJac_dm = dolfinx.cpp.la.inner_product(Jac_vec._cpp_object, dm.x._cpp_object) # type: ignore[arg-type]
Hm_dm = dolfinx.cpp.la.inner_product(Hm_vec._cpp_object, dm.x._cpp_object) # type: ignore[arg-type]

errors = []
errors_der = []
Expand Down