Module Contents

class pymor.vectorarrays.block.BlockVectorArray(space, impl, base=None, ind=None, _len=None)[source]

Bases: pymor.vectorarrays.interface.VectorArray

VectorArray where each vector is a direct sum of sub-vectors.

Given a list of equal length VectorArrays blocks, this VectorArray represents the direct sums of the vectors contained in the arrays. The associated VectorSpace is BlockVectorSpace.

BlockVectorArray can be used in conjunction with BlockOperator.



Return a copy of a single block or a sequence of blocks.



block(self, ind)[source]

Return a copy of a single block or a sequence of blocks.

property blocks(self)[source]
property num_blocks(self)[source]
class pymor.vectorarrays.block.BlockVectorArrayImpl(blocks, space)[source]

Bases: pymor.vectorarrays.interface.VectorArrayImpl

Implementation of a VectorArray.

The VectorArray base class defers all calls to interface methods to an internal impl object of this type. Indexing, error checking or non-standard inner products are handled by VectorArray. Possible indices are passed to the methods of VectorArrayImpl as ind, oind or xind parameters. These can either be None, in case the array has not been indexed, a slice object, or a Python list of non-negative numbers.

amax(self, ind)[source]
append(self, other, remove_from_other, oind)[source]
axpy(self, alpha, x, ind, xind)[source]
axpy_copy(self, alpha, x, ind, xind)[source]
conj(self, ind)[source]
copy(self, deep, ind)[source]
delete(self, ind)[source]
dofs(self, dof_indices, ind)[source]
imag(self, ind)[source]
inner(self, other, ind, oind)[source]
lincomb(self, coefficients, ind)[source]
norm2(self, ind)[source]
pairwise_inner(self, other, ind, oind)[source]
real(self, ind)[source]
scal(self, alpha, ind)[source]
scal_copy(self, alpha, ind)[source]
to_numpy(self, ensure_copy, ind)[source]
class pymor.vectorarrays.block.BlockVectorSpace(subspaces)[source]

Bases: pymor.vectorarrays.interface.VectorSpace

VectorSpace of BlockVectorArrays.

A BlockVectorSpace is defined by the VectorSpaces of the individual subblocks which constitute a given array. In particular for a given :class`BlockVectorArray` U, we have the identity

(U.blocks[0].space, U.blocks[1].space, ..., U.blocks[-1].space) ==



The tuple defined above.




Create a VectorArray from a NumPy array


Create a VectorArray from raw data.



Create a VectorArray of null vectors

property dim(self)[source]
from_numpy(self, data, ensure_copy=False)[source]

Create a VectorArray from a NumPy array

Note that this method will not be supported by all vector space implementations.



NumPy array of shape (len, dim) where len is the number of vectors and dim their dimension.


If False, modifying the returned VectorArray might alter the original NumPy array. If True always a copy of the array data is made.


A VectorArray with data as data.

make_array(cls, obj)[source]

Create a VectorArray from raw data.

This method is used in the implementation of Operators and Models to create new VectorArrays from raw data of the underlying solver backends. The ownership of the data is transferred to the newly created array.

The exact signature of this method depends on the wrapped solver backend.

make_block_diagonal_array(self, obj)[source]
zeros(self, count=1, reserve=0)[source]

Create a VectorArray of null vectors



The number of vectors.


Hint for the backend to which length the array will grow.


A VectorArray containing count vectors with each component zero.