krypy.recycling.factories
- deflation vector factories¶
-
class
krypy.recycling.factories.
RitzFactory
(subset_evaluator, subsets_generator=None, mode='ritz', print_results=None)¶ Bases:
krypy.recycling.factories._DeflationVectorFactory
Factory of Ritz vectors for automatic recycling.
Parameters: - subset_evaluator – an instance of
_RitzSubsetEvaluator
that evaluates a proposed subset of Ritz vectors for deflation. - subsets_generator – (optional) an instance of
_RitzSubsetsGenerator
that generates lists of subsets of Ritz vectors for deflation. - print_results –
(optional) may be one of the following:
- None: nothing is printed.
- ’number’: the number of selected deflation vectors is printed.
- ’values’: the Ritz values corresponding to the selected Ritz vectors are printed.
- ’timings’: the timings of all evaluated subsets of Ritz vectors are printed.
-
get
(deflated_solver)¶ Get deflation vectors.
Returns: numpy.array of shape (N,k)
- subset_evaluator – an instance of
-
class
krypy.recycling.factories.
RitzFactorySimple
(mode='ritz', n_vectors=0, which='sm')¶ Bases:
krypy.recycling.factories._DeflationVectorFactory
Selects a fixed number of Ritz or harmonic Ritz vectors with respect to a prescribed criterion.
Parameters: - mode – See
mode
parameter ofRitz
. - n_vectors – number of vectors that are chosen. Actual number of
deflation vectors may be lower if the number of Ritz pairs is less
than
n_vectors
. - which –
the
n_vectors
Ritz vectors are chosen such that the corresponding Ritz values are the ones withlm
: largest magnitude.sm
: smallest magnitude.lr
: largest real part.sr
: smallest real part.li
: largest imaginary part.si
: smallest imaginary part.smallest_res
: smallest Ritz residual norms.
-
get
(solver)¶ Get deflation vectors.
Returns: numpy.array of shape (N,k)
- mode – See
-
class
krypy.recycling.factories.
UnionFactory
(factories)¶ Bases:
krypy.recycling.factories._DeflationVectorFactory
Combine a list of factories.
Parameters: factories – a list of factories derived from _DeflationVectorFactory
.-
get
(solver)¶ Get deflation vectors.
Returns: numpy.array of shape (N,k)
-