Skip to content

Commit

Permalink
[vectorarrays] remove some unneeded copy() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrave committed Oct 14, 2016
1 parent 564f079 commit 0785883
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/pymor/algorithms/genericsolvers.py
Expand Up @@ -170,7 +170,7 @@ def apply_inverse(op, rhs, options=None):

if options['type'] == 'generic_lgmres':
for i in range(len(rhs)):
r, info = lgmres(op, rhs[i].copy(),
r, info = lgmres(op, rhs[i],
tol=options['tol'],
maxiter=options['maxiter'],
inner_m=options['inner_m'],
Expand All @@ -181,7 +181,7 @@ def apply_inverse(op, rhs, options=None):
R.append(r)
elif options['type'] == 'least_squares_generic_lsmr':
for i in range(len(rhs)):
r, info, itn, _, _, _, _, _ = lsmr(op, rhs[i].copy(),
r, info, itn, _, _, _, _, _ = lsmr(op, rhs[i],
damp=options['damp'],
atol=options['atol'],
btol=options['btol'],
Expand All @@ -195,7 +195,7 @@ def apply_inverse(op, rhs, options=None):
R.append(r)
elif options['type'] == 'least_squares_generic_lsqr':
for i in range(len(rhs)):
r, info, itn, _, _, _, _, _, _ = lsqr(op, rhs[i].copy(),
r, info, itn, _, _, _, _, _, _ = lsqr(op, rhs[i],
damp=options['damp'],
atol=options['atol'],
btol=options['btol'],
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/algorithms/image.py
Expand Up @@ -221,7 +221,7 @@ def estimate_image_hierarchical(operators=(), vectors=(), domain=None, extends=N
orthonormalize=False, product=product,
riesz_representatives=riesz_representatives)
else:
new_image = estimate_image(operators, [], domain[i].copy(), extends=True,
new_image = estimate_image(operators, [], domain[i], extends=True,
orthonormalize=False, product=product,
riesz_representatives=riesz_representatives)

Expand Down
2 changes: 1 addition & 1 deletion src/pymor/operators/basic.py
Expand Up @@ -101,7 +101,7 @@ def apply_inverse(self, V, mu=None, least_squares=False):
self.logger.warn('Least squares solver selected but "least_squares == False"')

try:
return genericsolvers.apply_inverse(assembled_op, V.copy(), options=options)
return genericsolvers.apply_inverse(assembled_op, V, options=options)
except InversionError as e:
if least_squares and options:
solver_type = options if isinstance(options, str) else options['type']
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/operators/numpy.py
Expand Up @@ -272,7 +272,7 @@ def projected_to_subbasis(self, dim_range=None, dim_source=None, name=None):
should be the same as ::
op.projected(r_basis[:dim_range].copy(), s_basis[:dim_source].copy(), prod)
op.projected(r_basis[:dim_range], s_basis[:dim_source], prod)
For a |NumpyMatrixOperator| this amounts to extracting the upper-left
(dim_range, dim_source) corner of the matrix it wraps.
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/parallel/basic.py
Expand Up @@ -21,7 +21,7 @@ def scatter_array(self, U, copy=True):
else:
slices = [U.empty() for _ in range(len(self))]
for s in slices:
s.append(U[:min(slice_len, len(U))].copy(), remove_from_other=True)
s.append(U[:min(slice_len, len(U))], remove_from_other=True)
remote_U = self.push(U.empty())
del U
self.map(_append_array_slice, slices, U=remote_U)
Expand Down

0 comments on commit 0785883

Please sign in to comment.