pymor.vectorarrays.list¶
Module Contents¶
- class pymor.vectorarrays.list.ComplexifiedListVectorSpace[source]¶
Bases:
ListVectorSpaceVectorSpaceofListVectorArrays.Methods
- class pymor.vectorarrays.list.ComplexifiedVector(real_part, imag_part)[source]¶
Bases:
VectorInterface for vectors used in conjunction with
ListVectorArray.This interface must be satisfied by the individual entries of the vector
listmanaged byListVectorArray. All interface methods have a direct counterpart in theVectorArrayinterface.
- class pymor.vectorarrays.list.CopyOnWriteVector[source]¶
Bases:
VectorInterface for vectors used in conjunction with
ListVectorArray.This interface must be satisfied by the individual entries of the vector
listmanaged byListVectorArray. All interface methods have a direct counterpart in theVectorArrayinterface.Methods
- class pymor.vectorarrays.list.ListVectorArray(space, impl, base=None, ind=None, _len=None)[source]¶
Bases:
pymor.vectorarrays.interface.VectorArrayVectorArrayimplemented as a Python list of vectors.This
VectorArrayimplementation is the first choice when creating pyMOR wrappers for external solvers which are based on single vector objects. In order to do so, a wrapping subclass ofVectorhas to be provided on which the implementation ofListVectorArraywill operate. The associatedVectorSpaceis a subclass ofListVectorSpace.For an example, see
NumpyVectorandNumpyListVectorSpace,FenicsVectorandFenicsVectorSpace,NGSolveVectorandNGSolveVectorSpace.
- class pymor.vectorarrays.list.ListVectorArrayImpl(vectors, 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.list.ListVectorSpace[source]¶
Bases:
pymor.vectorarrays.interface.VectorSpaceVectorSpaceofListVectorArrays.Methods
- noindex:
Create a
VectorArrayof vectors with all DOFs set to the same value.- noindex:
Create a
VectorArrayof vectors with all DOFs set to one.Create a
VectorArrayof vectors with random entries.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.
- full(value, count=1, reserve=0)[source]¶
Create a
VectorArrayof vectors with all DOFs set to the same value.- Parameters:
value – The value each DOF should be set to.
count – The number of vectors.
reserve – Hint for the backend to which length the array will grow.
- Returns:
A
VectorArraycontainingcountvectors with each DOF set tovalue.
- 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.
- ones(count=1, reserve=0)[source]¶
Create a
VectorArrayof vectors with all DOFs set to one.This is a shorthand for
self.full(1., count, reserve).- Parameters:
count – The number of vectors.
reserve – Hint for the backend to which length the array will grow.
- Returns:
A
VectorArraycontainingcountvectors with each DOF set to one.
- random(count=1, distribution='uniform', reserve=0, **kwargs)[source]¶
Create a
VectorArrayof vectors with random entries.Supported random distributions:
'uniform': Uniform distribution in half-open interval [`low`, `high`). 'normal': Normal (Gaussian) distribution with mean `loc` and standard deviation `scale`.Note that not all random distributions are necessarily implemented by all
VectorSpaceimplementations.- Parameters:
count – The number of vectors.
distribution – Random distribution to use (
'uniform','normal').low – Lower bound for
'uniform'distribution (defaults to0).high – Upper bound for
'uniform'distribution (defaults to1).loc – Mean for
'normal'distribution (defaults to0).scale – Standard deviation for
'normal'distribution (defaults to1).reserve – Hint for the backend to which length the array will grow.
- 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.
- class pymor.vectorarrays.list.NumpyListVectorSpace(dim)[source]¶
Bases:
ListVectorSpaceVectorSpaceofListVectorArrays.Methods
- class pymor.vectorarrays.list.NumpyVector(array)[source]¶
Bases:
CopyOnWriteVectorVector stored in a NumPy 1D-array.
- class pymor.vectorarrays.list.Vector[source]¶
Bases:
pymor.core.base.BasicObjectInterface for vectors used in conjunction with
ListVectorArray.This interface must be satisfied by the individual entries of the vector
listmanaged byListVectorArray. All interface methods have a direct counterpart in theVectorArrayinterface.