@@ -32,16 +32,38 @@ SUNDomEigEstimator core functions
32
32
-----------------------------------------------------
33
33
34
34
The core dominant eigenvalue estimator functions consist of several **required **
35
- functions: :c:func: `SUNDomEigEst_SetATimes ` provides a :c:type: `SUNATimesFn ` function pointer,
35
+ functions: :c:func: `SUNDomEigEst_NewEmpty ` creates a new empty ``SUNDomEigEstimator ``
36
+ object, :c:func: `SUNDomEigEst_SetATimes ` provides a :c:type: `SUNATimesFn ` function pointer,
36
37
as well as a ``void* `` pointer to a data structure used by this routine,
37
38
:c:func: `SUNDomEigEst_Initialize ` initializes the estimator object once all estimator-specific
38
39
options have been set, :c:func: `SUNDomEigEst_ComputeHess ` computes Hessenberg matrix
39
- (if the estimator requires), :c:func: `SUNDomEig_Estimate ` estimates the dominant eigenvalue, and
40
- :c:func: `SUNDomEigEstFree ` destroys an estimator object.
40
+ (if the estimator requires), :c:func: `SUNDomEig_Estimate ` estimates the dominant eigenvalue,
41
+ :c:func: `SUNDomEigEst_FreeEmpty ` an empty estimator and :c:func: `SUNDomEigEst_Destroy ` destroys
42
+ an estimator object.
41
43
42
44
The remaining **optional ** function, :c:func: `SUNDomEigEst_PreProcess ` preprocesses the estimator object
43
45
to "warm-up" the estimator for a more appropriate initial vector before starting iterations.
44
46
47
+
48
+ .. c :function :: SUNDomEigEstimator SUNDomEigEst_NewEmpty (SUNContext sunctx)
49
+
50
+ *Required.*
51
+
52
+ This function allocates a new ``SUNDomEigEstimator`` object and
53
+ initializes its content pointer and the function pointers in the operations
54
+ structure to ``NULL``.
55
+
56
+ **Arguments:**
57
+
58
+ * *sunctx* -- the :c:type:`SUNContext` object (see :numref: `SUNDIALS.SUNContext `)
59
+
60
+ **Return value:**
61
+
62
+ If successful, this function returns a ``SUNDomEigEstimator`` object.
63
+ If an error occurs when allocating the object, then this routine will
64
+ return ``NULL``.
65
+
66
+
45
67
.. c:function:: SUNErrCode SUNDomEigEst_SetATimes(SUNDomEigEstimator DEE, void* A_data, SUNATimesFn ATimes)
46
68
47
69
*Required.*
@@ -104,10 +126,8 @@ to "warm-up" the estimator for a more appropriate initial vector before starting
104
126
105
127
**Return value:**
106
128
107
- Zero for a successful call, a positive value for a recoverable failure,
108
- and a negative value for an unrecoverable failure. Ideally this should
109
- return one of the generic error codes listed in
110
- :numref:`SUNDomEigEst.ErrorCodes`.
129
+ `SUN_SUCCESS` for a successful call, or a relevant error code from
130
+ :numref:`SUNDomEigEst.ErrorCodes` upon failure.
111
131
112
132
**Usage:**
113
133
@@ -147,20 +167,36 @@ to "warm-up" the estimator for a more appropriate initial vector before starting
147
167
retval = SUNDomEig_Estimate(DEE, dom_eig);
148
168
149
169
170
+ .. c :function :: SUNErrCode SUNDomEigEst_FreeEmpty (SUNDomEigEstimator DEE)
150
171
151
- .. c :function :: SUNErrCode SUNDomEigEstFree (SUNDomEigEstimator DEE)
172
+ This routine frees the ``SUNDomEigEstimator`` object, under the
173
+ assumption that any implementation-specific data that was allocated
174
+ within the underlying content structure has already been freed.
175
+ It will additionally test whether the ops pointer is ``NULL``,
176
+ and, if it is not, it will free it as well.
177
+
178
+ **Arguments:**
179
+
180
+ * *DEE* -- a SUNDomEigEstimator object
181
+
182
+ **Return value:**
183
+
184
+ A :c:type:`SUNErrCode`.
185
+
186
+
187
+ .. c:function:: SUNErrCode SUNDomEigEst_Destroy(SUNDomEigEstimator* DEEptr)
152
188
153
189
Frees memory allocated by the dominant eigenvalue estimatimator.
154
190
155
191
**Arguments:**
156
192
157
- * *DEE * -- a SUNDomEigEst object.
193
+ * *DEEptr * -- a SUNDomEigEst object pointer .
158
194
159
195
**Usage:**
160
196
161
197
.. code-block:: c
162
198
163
- retval = SUNDomEigEstFree( DEE);
199
+ retval = SUNDomEigEst_Destroy(& DEE);
164
200
165
201
166
202
.. _SUNDomEigEst.SetFn :
@@ -199,7 +235,7 @@ function pointer ``NULL`` instead of supplying a dummy routine.
199
235
200
236
.. c :function :: SUNErrCode SUNDomEigEst_SetTol (SUNDomEigEstimator DEE, sunrealtype tol)
201
237
202
- This *optional* routine sets the estimator tolerance.
238
+ This *optional* routine sets the estimator's :ref:`relative tolerance <pi_rel_tol>` .
203
239
204
240
**Arguments:**
205
241
@@ -545,7 +581,7 @@ The virtual table structure is defined as
545
581
546
582
.. c :member :: SUNErrCode (*free)(SUNDomEigEstimator)
547
583
548
- The function implementing :c:func: `SUNDomEigEstFree `
584
+ The function implementing :c:func: `SUNDomEigEst_Destroy `
549
585
550
586
The generic SUNDomEigEst class defines and implements the dominant eigenvalue estimator
551
587
operations defined in :numref: `SUNDomEigEst.CoreFn ` -- :numref: `SUNDomEigEst.GetFn `.
@@ -566,75 +602,6 @@ operation:
566
602
}
567
603
568
604
569
- .. _SUNDomEigEst.API.Custom :
570
-
571
- Implementing a custom SUNDomEigEstimator module
572
- --------------------------------------------------
573
-
574
- A particular implementation of the ``SUNDomEigEstimator `` module must:
575
-
576
- * Specify the *content * field of the SUNDomEigEst module.
577
-
578
- * Define and implement the required dominant eigenvalue estimator operations.
579
-
580
- .. note ::
581
-
582
- The names of these routines should be unique to that
583
- implementation in order to permit using more than one
584
- SUNDomEigEst module (each with different ``SUNDomEigEstimator ``
585
- internal data representations) in the same code.
586
-
587
- * Define and implement user-callable constructor and destructor
588
- routines to create and free a ``SUNDomEigEstimator`` with
589
- the new *content* field and with *ops* pointing to the
590
- new dominant eigenvalue estimator operations.
591
-
592
- We note that the function pointers for all unsupported optional
593
- routines should be set to ``NULL`` in the *ops* structure. This
594
- allows the SUNDIALS package that is using the SUNDomEigEst object
595
- to know whether the associated functionality is supported.
596
-
597
- To aid in the creation of custom ``SUNDomEigEstimator`` modules the generic
598
- ``SUNDomEigEstimator`` module provides the utility function
599
- :c:func:`SUNDomEigEst_NewEmpty`. When used in custom ``SUNDomEigEstimator``
600
- constructors this function will ease the introduction of any new optional dominant
601
- eigenvalue estimator operations to the ``SUNDomEigEstimator`` API by ensuring that only required
602
- operations need to be set.
603
-
604
- .. c:function:: SUNDomEigEstimator SUNDomEigEst_NewEmpty(SUNContext sunctx)
605
-
606
- This function allocates a new generic ``SUNDomEigEstimator`` object and
607
- initializes its content pointer and the function pointers in the operations
608
- structure to ``NULL``.
609
-
610
- **Arguments:**
611
-
612
- * *sunctx* -- the :c:type:`SUNContext` object (see :numref: `SUNDIALS.SUNContext `)
613
-
614
- **Return value:**
615
-
616
- If successful, this function returns a ``SUNDomEigEstimator`` object.
617
- If an error occurs when allocating the object, then this routine will
618
- return ``NULL``.
619
-
620
-
621
- .. c:function:: SUNErrCode SUNDomEigEst_FreeEmpty(SUNDomEigEstimator DEE)
622
-
623
- This routine frees the generic ``SUNDomEigEstimator`` object, under the
624
- assumption that any implementation-specific data that was allocated
625
- within the underlying content structure has already been freed.
626
- It will additionally test whether the ops pointer is ``NULL``,
627
- and, if it is not, it will free it as well.
628
-
629
- **Arguments:**
630
-
631
- * *DEE* -- a SUNDomEigEstimator object
632
-
633
- **Return value:**
634
-
635
- A :c:type:`SUNErrCode`.
636
-
637
-
638
605
Additionally, a ``SUNDomEigEstimator `` implementation *may * do the following:
639
606
640
607
* Define and implement additional user-callable "set" routines
0 commit comments