Skip to content

Conversation

maggul
Copy link
Collaborator

@maggul maggul commented May 25, 2025

The pull request for the dominant eigenvalue estimator module.

@maggul maggul requested review from gardner48 and drreynolds July 18, 2025 22:27
@maggul maggul self-assigned this Jul 18, 2025
@maggul
Copy link
Collaborator Author

maggul commented Jul 18, 2025

I have addressed most of the comments and ready for the second round of reviews.

SUNDomEigEst_ARNOLDI Usage
-------------------------------

The header file to be included when using this module is ``sundomeigest/sundomeigest_arnoldi.h``.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gardner48, is this still a true statement after your adjustments in cmakes?

SUNDomEigEst_Power Usage
-----------------------------

The header file to be included when using this module is ``sundomeigest/sundomeigest_power.h``.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gardner48, is this still a true statement after your adjustments in cmakes?

Copy link
Collaborator

@drreynolds drreynolds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished re-reviewing documentation. I'll proceed to the source code next.

Comment on lines 200 to 204
Note that although a DEE creation routine requires :c:func:`SUNDomEigEst_SetATimes` with a valid
matrix-vector product function pointer, creating a DEE with :c:func:`LSRKStepSetDomEigFn`
uses an internal Jacobian-vector product estimation that is passed with the *arkode_mem* pointer.
Similarly, it estimates the eigenvalue as needed internally without requiring user to call
:c:func:`SUNDomEigEstimate` function.
Similarly, it estimates the eigenvalue as needed internally without requiring a call to
:c:func:`SUNDomEig_Estimate`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that I understand this paragraph. Is it saying that if a user provides a custom ARKDomEigFn (through calling LSRKStepSetDomEigFn) then the matrix-vector product is approximated internally by LSRKStep? I don't think that is correct.

Should this (and the previous paragraph) instead be something like:

":c:func:LSRKStepSetDomEigFn expects a user-provided spectral radius function pointer of type :c:func:ARKDomEigFn. If this is called with dom_eig set to NULL, then LSRKStep will construct a DEE for this purpose, that will internally approximate the Jacobian-vector product for the DEE using the supplied right-hand side function."

Comment on lines +212 to +213
has already been created. TODO: Add extra information about how we implement this function
after deciding on it by the group.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me what is needed for this "TODO". Generally, we describe the "mathematics" of the algorithms elsewhere in the documentation, and refer back to that here. If the question refers to what should be described about the algorithms, then my response is that inside the relevant file, all aspects of the algorithm should either be cited from publications or should be described in sufficient detail so that the inputs to each "set" routine make sense.

Given that you implemented these as standalone SUNDIALS utilities, the proper location to describe those algorithms is in doc/sundomeigest/SUNDomEigEst_Arnoldi.rst and doc/sundomeigest/SUNDomEigEst_Power.rst. I would then add a reference to those here similar to "Information on the SUNDomEigEstimator implementations provided by SUNDIALS may be found in :ref:SUNDomEigEst.Introduction."

**Arguments:**
* *arkode_mem* -- pointer to the LSRKStep memory block.
* *DEE_id* -- ID of the dominant eigenvalue estimator (of type c:enum::`SUNDomEigEstimator_ID`).
* *DEE* -- pointer to the SUNDIALS Dominant Eigenvalue Estimator (of type :c:type:`SUNDomEigEstimator`).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the SUNDomEigEstimator itself, not a pointer:

Suggested change
* *DEE* -- pointer to the SUNDIALS Dominant Eigenvalue Estimator (of type :c:type:`SUNDomEigEstimator`).
* *DEE* -- the SUNDIALS Dominant Eigenvalue Estimator to use (of type :c:type:`SUNDomEigEstimator`).

Comment on lines 233 to 235
Although, a DEE creation routine requires :c:func:`SUNDomEigEstSetATimes` with a valid
matrix-vector product function pointer, creating a DEE with :c:func:`LSRKStepDomEigEstCreate`
Note that although a DEE creation routine requires :c:func:`SUNDomEigEst_SetATimes` with a valid
matrix-vector product function pointer, setting a DEE with :c:func:`LSRKStepSetDomEigEstimator`
uses an internal Jacobian-vector product estimation that is passed with the *arkode_mem* pointer.
Similarly, it estimates the eigenvalue as needed internally without requiring user to call
:c:func:`SUNDomEigEstimate` function.
Similarly, it estimates the eigenvalue as needed internally without requiring a call to
:c:func:`SUNDomEig_Estimate`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend that this paragraph be removed entirely, since it's essentially identical to what is included for the previous function.

Comment on lines +305 to +306
.. note:: If LSRKStepSetNumSucceedingWarmups routine is not called, then the default ``num_succ_warmups`` is set to :math:`0`.
Calling this function with ``num_succ_warmups < 0`` resets the default.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd indent this so that the "Note" is included as part of this function's documentation:

Suggested change
.. note:: If LSRKStepSetNumSucceedingWarmups routine is not called, then the default ``num_succ_warmups`` is set to :math:`0`.
Calling this function with ``num_succ_warmups < 0`` resets the default.
.. note:: If LSRKStepSetNumSucceedingWarmups routine is not called, then the default ``num_succ_warmups`` is set to :math:`0`.
Calling this function with ``num_succ_warmups < 0`` resets the default.

Comment on lines +93 to +95
A ``num_warmups`` argument that is :math:` < 0` will result in the default
value (100). This default value is particularly chosen to minimize the memory
footprint by lowering the required ``kry_dim``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment regarding whether these warmups are performed before every "Estimate" call, or only once.

``SUNDomEigEstimator``.

**Arguments:**
* *q* -- a template vector.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is q really just a template vector, or it it actually very first initial guess at the dominant eigenvector? If it's the initial guess, then that should be explained here, as well as a warning that users should ensure that this is not exactly a non-dominant eigenvector of the Jacobian (e.g., they can use a random vector).

Comment on lines 20 to 22
There are ``SUNDomEigEstimator`` examples that may be installed for each
implementation; these make use of the functions in ``test_sundomeigest.c``.
These example functions show simple usage of the ``SUNDomEigEstimator`` family
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are unit tests, not examples (they are in /test/unit_tests/sundomeigest instead of /examples).

We typically do not document unit tests, but if you think that this documentation page would be particularly helpful for users, then we should discuss the optimal placement of this page in the documentation (and correspondingly, the location of the examples/tests it describes).

Comment on lines +98 to +101
Preprocessing warmups for power iteration refer to running power iteration without
checking for convergence. This can help reduce some computational overhead.
A ``num_warmups`` argument that is :math:` < 0` will result in the default
value (0). This default is chosen to minimize complexity for the general user.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, please comment on whether these warmup iterations occur before every estimate, or just once before the first estimate.

Comment on lines +149 to +151
* ``max_num_iters`` - maximum number of power iterations so far,

* ``min_num_iters`` - minimum number of power iterations so far,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* ``max_num_iters`` - maximum number of power iterations so far,
* ``min_num_iters`` - minimum number of power iterations so far,
* ``max_num_iters`` - maximum number of power iterations in any single estimate so far,
* ``min_num_iters`` - minimum number of power iterations in any single estimate so far,

@gardner48 gardner48 merged commit 428af86 into develop Jul 21, 2025
1 check was pending
@gardner48 gardner48 deleted the feature/dom-eig branch July 21, 2025 20:26
gardner48 added a commit that referenced this pull request Jul 21, 2025
Add dominant eigenvalue estimator class

---------

Co-authored-by: Daniel R. Reynolds <reynolds@smu.edu>
Co-authored-by: Daniel R. Reynolds <dreynolds@umbc.edu>
Co-authored-by: Balos, Cody, J <balos1@llnl.gov>
Co-authored-by: David J. Gardner <gardner48@llnl.gov>
gardner48 added a commit that referenced this pull request Jul 21, 2025
Add dominant eigenvalue estimator class

---------

Co-authored-by: Daniel R. Reynolds <reynolds@smu.edu>
Co-authored-by: Daniel R. Reynolds <dreynolds@umbc.edu>
Co-authored-by: Balos, Cody, J <balos1@llnl.gov>
Co-authored-by: David J. Gardner <gardner48@llnl.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants