Skip to content

Commit d570816

Browse files
committed
Avoid superfluous copy of residual vector when applying preconditioner
The residual vector is changed from a jax-numpy array to a standard numpy array before the preconditioner is applied. Now numpy is told to avoid copying the residual data and instead re-use the buffer. This should avoid overhead, especially for large vectors.
1 parent 3639425 commit d570816

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

optimism/SparseCholesky.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def update(self, new_stiffness_func):
5151

5252
def apply(self, b):
5353
if type(b) == type(np.array([])):
54-
b = onp.array(b)
54+
b = onp.array(b, copy=False)
5555
return self.Precond(b)
5656

5757

0 commit comments

Comments
 (0)