Skip to content
Open
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
1 change: 0 additions & 1 deletion lib/assembly/discrete_dense_boundary_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <iostream>
#include <stdexcept>
#include <array>
#include <numpy/npy_common.h>

namespace Bempp {

Expand Down
16 changes: 12 additions & 4 deletions python/bempp/api/linalg/iterative_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def residuals(self):
return self._residuals


def gmres(A, b, tol=1E-5, restart=None, maxiter=None, use_strong_form=False, return_residuals=False):
def gmres(A, b, tol=1E-5, restart=None, maxiter=None, use_strong_form=False, return_residuals=False, return_iterations=False):
"""Interface to the scipy.sparse.linalg.gmres function.

This function behaves like the scipy.sparse.linalg.gmres function. But
Expand Down Expand Up @@ -67,14 +67,18 @@ def gmres(A, b, tol=1E-5, restart=None, maxiter=None, use_strong_form=False, ret

res_fun = GridFunction(A.domain, coefficients=x.ravel())

if return_residuals:
if return_residuals and return_iterations:
return res_fun, info, callback.residuals, callback.count
elif return_iterations:
return res_fun, info, callback.count
elif return_residuals:
return res_fun, info, callback.residuals
else:
return res_fun, info


def cg(A, b, tol=1E-5, maxiter=None,
use_strong_form=False, return_residuals=False):
use_strong_form=False, return_residuals=False, return_iterations=False):
"""Interface to the scipy.sparse.linalg.cg function.

This function behaves like the scipy.sparse.linalg.cg function. But
Expand Down Expand Up @@ -113,7 +117,11 @@ def cg(A, b, tol=1E-5, maxiter=None,

res_fun = GridFunction(A.domain, coefficients=x.ravel())

if return_residuals:
if return_residuals and return_iterations:
return res_fun, info, callback.residuals, callback.count
elif return_iterations:
return res_fun, info, callback.count
elif return_residuals:
return res_fun, info, callback.residuals
else:
return res_fun, info