Skip to content

Commit

Permalink
fix Vector addition
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Rang authored and V-Rang committed Mar 27, 2024
1 parent a4ea7a0 commit 2149f34
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hippylibX/algorithms/cgsolverSteihaug.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,14 @@ def set_TR(self,radius,B_op):
self.update_x = self.update_x_with_TR
self.B_op = B_op
self.B_op.init_vector(self.Bx,0)
def update_x_without_TR(self,x : dlx.la.Vector, alpha : float, d : dlx.la.Vector):
x.array[:] += alpha*d.array

def update_x_without_TR(self,x : dlx.la.Vector, alpha : float, d : petsc4py.PETSc.Vec):
# x.array[:] += alpha*d.array
temp_petsc_vec_x = dlx.la.create_petsc_vector_wrap(x)
temp_petsc_vec_x.axpy(alpha, self.d)
temp_petsc_vec_x.destroy()
return False

def update_x_with_TR(self,x,alpha,d):
x_bk = x.copy()
x.axpy(alpha,d)
Expand Down

0 comments on commit 2149f34

Please sign in to comment.