-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Is it possible currently to specify an array for the result of A * x? In Krylov methods where many matrix-vector products will be computed, it's often possible to save time and memory by preallocating the result and overwriting it. Something like A.matvec(x, y), which should be equivalent to y = A * x. It's a little bit un-python-esque, but combined with LinearOperators, it's possible to define a custom operator that uses a preallocated array transparently, e.g.,
def OperatorWithPreallocation(A):
y = np.empty(A.shape[0])
def matvec(x):
A.matvec(x, y)
return y
...and then
B = OperatorWithPreallocation(A)
B * x # python-esque!Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels