pymor.vectorarrays.block¶
Module Contents¶
- class pymor.vectorarrays.block.BlockVectorArray(space, impl, base=None, ind=None, _len=None)[source]¶
Bases:
pymor.vectorarrays.interface.VectorArrayVectorArraywhere each vector is a direct sum of sub-vectors.Given a list of equal length
VectorArraysblocks, thisVectorArrayrepresents the direct sums of the vectors contained in the arrays. The associatedVectorSpaceisBlockVectorSpace.BlockVectorArraycan be used in conjunction withBlockOperator.
- class pymor.vectorarrays.block.BlockVectorArrayImpl(blocks, space)[source]¶
Bases:
pymor.vectorarrays.interface.VectorArrayImplImplementation of a
VectorArray.The
VectorArraybase class defers all calls to interface methods to an internalimplobject of this type. Indexing, error checking or non-standard inner products are handled byVectorArray. Possible indices are passed to the methods ofVectorArrayImplasind,oindorxindparameters. These can either beNone, in case the array has not been indexed, asliceobject, or a Python list of non-negative numbers.Methods
- class pymor.vectorarrays.block.BlockVectorSpace(subspaces)[source]¶
Bases:
pymor.vectorarrays.interface.VectorSpaceVectorSpaceofBlockVectorArrays.A
BlockVectorSpaceis defined by theVectorSpacesof 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) == U.space.
- Parameters:
subspaces – The tuple defined above.
Methods
Create a
VectorArrayfrom aNumPy array.- noindex:
Create a
VectorArrayof null vectors.- from_numpy(data, ensure_copy=False)[source]¶
Create a
VectorArrayfrom aNumPy array.Note that this method will not be supported by all vector space implementations.
- Parameters:
data –
NumPyarray of shape(dim, len)wherelenis the number of vectors anddimtheir dimension.ensure_copy – If
False, modifying the returnedVectorArraymight alter the originalNumPy array. IfTruealways a copy of the array data is made.
- Returns:
A
VectorArraywithdataas data.
- make_array(obj)[source]¶
Create a
VectorArrayfrom raw data.This method is used in the implementation of
OperatorsandModelsto create newVectorArraysfrom 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.
- zeros(count=1, reserve=0)[source]¶
Create a
VectorArrayof null vectors.- Parameters:
count – The number of vectors.
reserve – Hint for the backend to which length the array will grow.
- Returns:
A
VectorArraycontainingcountvectors with each component zero.