Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull requests removes the ind (o_ind, x_ind) arguments from the
VectorArrayInterface
andOperatorInterface
. Instead, VectorArrays now implement__getitem__
and, thus, can be indexed. Valid indices are positve or negative integers, slices, as well as lists and one-dimensional Numpy arrays of positive or negative integers (as usual, negative numbers count from the end of the array).In all cases, a new VectorArray of the same space is returned which acts as a view into the original array. As such, calling
scal
andaxpy
on the returned array will modify the original array. Apart from the fact, that views cannot beappend
ed to and no vectors can be removed, the view fully satisfies theVectorArrayInterface
. While the original array can be appended to, while views into it exist, removing vectors from an array with views will lead to undefined behavior of the views. In general, views should be seen as short-lived objects to facilitate indexing or pass a sub-array to an Operator.The new
is_view
attribute signifies whether an VectorArray is a view or not. Theremove
method has been replaced by__delitem__
which is more convenient when dealing with slices.Some smaller changes:
DiskVectorArray
to the graveyard, as updating the current implementationseems not worth the effort. I would hope to have a better implementation until the next release.
NumpyVectorArray.__init__
to only accept the array dataand an optional
copy
argument (I feel that the other arguments were confusing and unused).NumpyVectorArray
which make the codesomewhat more complicated but strongly improve performance for small arrays.
This pull request addresses #227.