pymor.vectorarrays.list¶
Classes
|
|
Vector stored in a NumPy 1D-array. |
|
Interface for vectors used in conjunction with |
- class pymor.vectorarrays.list.ComplexifiedListVectorSpace[source]¶
Bases:
ListVectorSpaceMethods
Attributes
- vector_type[source]¶
alias of
ComplexifiedVector
- class pymor.vectorarrays.list.ComplexifiedVector(real_part, imag_part)[source]¶
Bases:
VectorAttributes
- class pymor.vectorarrays.list.ListVectorArray(space, impl, base=None, ind=None, _len=None)[source]¶
Bases:
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.Methods
amax,append,axpy,check_ind,check_ind_unique,conj,copy,dofs,empty,full,gramian,inner,len_ind,len_ind_unique,lincomb,norm,norm2,ones,pairwise_inner,random,scal,sup_norm,to_numpy,zerosAttributes
- impl_type[source]¶
alias of
ListVectorArrayImpl
- class pymor.vectorarrays.list.ListVectorArrayImpl(vectors, space)[source]¶
Bases:
VectorArrayImplMethods
amax,append,axpy,conj,copy,delete,dofs,gramian,imag,inner,lincomb,norm,norm2,pairwise_inner,real,scal,to_numpyAttributes
- class pymor.vectorarrays.list.ListVectorSpace[source]¶
Bases:
VectorSpaceVectorSpaceofListVectorArrays.Methods
from_numpy,full,full_vector,make_array,make_vector,ones,ones_vector,random,random_vector,space_from_dim,space_from_vector_obj,vector_from_numpy,zero_vector,zerosAttributes
- 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:
ListVectorSpaceMethods
full_vector,make_vector,ones_vector,space_from_dim,space_from_vector_obj,vector_from_numpy,zero_vectorfrom_numpy,full,make_array,ones,random,random_vector,zerosAttributes
- vector_type[source]¶
alias of
NumpyVector
- class pymor.vectorarrays.list.NumpyVector(array)[source]¶
Bases:
CopyOnWriteVectorVector stored in a NumPy 1D-array.
Attributes
- class pymor.vectorarrays.list.Vector[source]¶
Bases:
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.Attributes