From 53209e0ec87d5aef07a8ac42d1a9c468b8dab9b0 Mon Sep 17 00:00:00 2001 From: maggul Date: Thu, 4 Jun 2026 19:55:32 -0500 Subject: [PATCH 01/23] added an init_guess_set flag --- include/sundomeigest/sundomeigest_arnoldi.h | 2 + include/sundomeigest/sundomeigest_power.h | 2 + .../arnoldi/sundomeigest_arnoldi.c | 72 +++++++++++-------- src/sundomeigest/power/sundomeigest_power.c | 60 +++++++++------- 4 files changed, 81 insertions(+), 55 deletions(-) diff --git a/include/sundomeigest/sundomeigest_arnoldi.h b/include/sundomeigest/sundomeigest_arnoldi.h index b46dec25b8..a75b4fb078 100644 --- a/include/sundomeigest/sundomeigest_arnoldi.h +++ b/include/sundomeigest/sundomeigest_arnoldi.h @@ -54,6 +54,8 @@ struct SUNDomEigEstimatorContent_Arnoldi_ long int num_ATimes; /* Number of ATimes calls */ + sunbooleantype init_guess_set; /* flag to check if the initial guess is set */ + SUNRhsFn rhsfn; /* User provided RHS function */ void* rhs_data; /* RHS function data */ long int nfevals; /* Number of RHS evaluations */ diff --git a/include/sundomeigest/sundomeigest_power.h b/include/sundomeigest/sundomeigest_power.h index d9df90215d..52d5dd8439 100644 --- a/include/sundomeigest/sundomeigest_power.h +++ b/include/sundomeigest/sundomeigest_power.h @@ -50,6 +50,8 @@ struct SUNDomEigEstimatorContent_Power_ long int num_ATimes; /* Number of ATimes calls */ + sunbooleantype init_guess_set; /* flag to check if the initial guess is set */ + sunrealtype rel_tol; /* Convergence criteria for the power iteration */ sunrealtype res; /* Residual from the last Estimate call */ diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index b39ace99b7..e5c669579f 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -134,30 +134,31 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, DEE->content = content; /* Fill content */ - content->ATimes = NULL; - content->ATdata = NULL; - content->V = NULL; - content->q = NULL; - content->rhs_linY = NULL; - content->rhs_linT = ZERO; - content->Fy = NULL; - content->work = NULL; - content->kry_dim = kry_dim; - content->num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; - content->num_iters = 0; - content->num_ATimes = 0; - content->warmup_to_tol = SUNFALSE; - content->tol_warmup = DEE_TOL_OF_WARMUPS_ARNOLDI_DEFAULT; - content->rhsfn = NULL; - content->rhs_data = NULL; - content->nfevals = 0; - content->LAPACK_A = NULL; - content->LAPACK_wr = NULL; - content->LAPACK_wi = NULL; - content->LAPACK_work = NULL; - content->LAPACK_lwork = 0; - content->LAPACK_arr = NULL; - content->Hes = NULL; + content->ATimes = NULL; + content->ATdata = NULL; + content->V = NULL; + content->q = NULL; + content->rhs_linY = NULL; + content->rhs_linT = ZERO; + content->Fy = NULL; + content->work = NULL; + content->kry_dim = kry_dim; + content->num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; + content->num_iters = 0; + content->num_ATimes = 0; + content->init_guess_set = SUNFALSE; + content->warmup_to_tol = SUNFALSE; + content->tol_warmup = DEE_TOL_OF_WARMUPS_ARNOLDI_DEFAULT; + content->rhsfn = NULL; + content->rhs_data = NULL; + content->nfevals = 0; + content->LAPACK_A = NULL; + content->LAPACK_wr = NULL; + content->LAPACK_wi = NULL; + content->LAPACK_work = NULL; + content->LAPACK_lwork = 0; + content->LAPACK_arr = NULL; + content->Hes = NULL; /* Allocate content */ content->q = N_VClone(q); @@ -322,14 +323,22 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) SUNAssert(Arnoldi_CONTENT(DEE)->Hes[k], SUN_ERR_MALLOC_FAIL); } - sunrealtype normq = N_VDotProd(Arnoldi_CONTENT(DEE)->q, - Arnoldi_CONTENT(DEE)->q); - SUNCheckLastErr(); + /* Initialize the vector V[0] if not already initialized */ + if (!PI_CONTENT(DEE)->init_guess_set) + { + sunrealtype normq = N_VDotProd(Arnoldi_CONTENT(DEE)->q, + Arnoldi_CONTENT(DEE)->q); + SUNCheckLastErr(); - normq = SUNRsqrt(normq); + normq = SUNRsqrt(normq); - N_VScale(ONE / normq, Arnoldi_CONTENT(DEE)->q, Arnoldi_CONTENT(DEE)->V[0]); - SUNCheckLastErr(); + N_VScale(ONE / normq, Arnoldi_CONTENT(DEE)->q, + Arnoldi_CONTENT(DEE)->V[0]); + SUNCheckLastErr(); + + /* Reset the initial guess flag to its default value */ + Arnoldi_CONTENT(DEE)->init_guess_set = SUNFALSE; + } return SUN_SUCCESS; } @@ -395,6 +404,9 @@ SUNErrCode SUNDomEigEstimator_SetInitialGuess_Arnoldi(SUNDomEigEstimator DEE, N_VScale(ONE / normq, q, Arnoldi_CONTENT(DEE)->V[0]); SUNCheckLastErr(); + /* set the initial guess flag to true */ + Arnoldi_CONTENT(DEE)->init_guess_set = SUNTRUE; + return SUN_SUCCESS; } diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 2ff6995ea1..c5c49d9aa7 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -133,25 +133,26 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, DEE->content = content; /* Fill content */ - content->ATimes = NULL; - content->ATdata = NULL; - content->V = NULL; - content->q = NULL; - content->q_prev = NULL; - content->rhs_linY = NULL; - content->rhs_linT = ZERO; - content->Fy = NULL; - content->work = NULL; - content->is_complex = SUNTRUE; - content->max_iters = max_iters; - content->num_warmups = DEE_NUM_OF_WARMUPS_PI_DEFAULT; - content->rel_tol = rel_tol; - content->res = ZERO; - content->rhsfn = NULL; - content->rhs_data = NULL; - content->nfevals = 0; - content->num_iters = 0; - content->num_ATimes = 0; + content->ATimes = NULL; + content->ATdata = NULL; + content->V = NULL; + content->q = NULL; + content->q_prev = NULL; + content->rhs_linY = NULL; + content->rhs_linT = ZERO; + content->Fy = NULL; + content->work = NULL; + content->is_complex = SUNTRUE; + content->max_iters = max_iters; + content->num_warmups = DEE_NUM_OF_WARMUPS_PI_DEFAULT; + content->rel_tol = rel_tol; + content->res = ZERO; + content->rhsfn = NULL; + content->rhs_data = NULL; + content->nfevals = 0; + content->num_iters = 0; + content->num_ATimes = 0; + content->init_guess_set = SUNFALSE; /* Allocate content */ content->q = N_VClone(q); @@ -284,14 +285,20 @@ SUNErrCode SUNDomEigEstimator_Initialize_Power(SUNDomEigEstimator DEE) SUNAssert(PI_CONTENT(DEE)->q_prev == NULL, SUN_ERR_ARG_CORRUPT); } - /* Initialize the vector V */ - sunrealtype normq = N_VDotProd(PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->q); - SUNCheckLastErr(); + /* Initialize the vector V if not already initialized */ + if (!PI_CONTENT(DEE)->init_guess_set) + { + sunrealtype normq = N_VDotProd(PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->q); + SUNCheckLastErr(); - normq = SUNRsqrt(normq); + normq = SUNRsqrt(normq); - N_VScale(ONE / normq, PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->V); - SUNCheckLastErr(); + N_VScale(ONE / normq, PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->V); + SUNCheckLastErr(); + + /* Reset the initial guess flag to its default value */ + PI_CONTENT(DEE)->init_guess_set = SUNFALSE; + } return SUN_SUCCESS; } @@ -365,6 +372,9 @@ SUNErrCode SUNDomEigEstimator_SetInitialGuess_Power(SUNDomEigEstimator DEE, N_VScale(ONE / normq, q, PI_CONTENT(DEE)->V); SUNCheckLastErr(); + /* set the initial guess flag to true */ + PI_CONTENT(DEE)->init_guess_set = SUNTRUE; + return SUN_SUCCESS; } From 566a0ec09fd7bdc329d4ce54e7a0309ab7fe13e6 Mon Sep 17 00:00:00 2001 From: maggul Date: Thu, 4 Jun 2026 20:10:06 -0500 Subject: [PATCH 02/23] Arnoldi_CONTENT fix --- src/sundomeigest/arnoldi/sundomeigest_arnoldi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index e5c669579f..2600b7d09a 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -324,7 +324,7 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) } /* Initialize the vector V[0] if not already initialized */ - if (!PI_CONTENT(DEE)->init_guess_set) + if (!(Arnoldi_CONTENT(DEE)->init_guess_set)) { sunrealtype normq = N_VDotProd(Arnoldi_CONTENT(DEE)->q, Arnoldi_CONTENT(DEE)->q); From 9cddf35daccddf3c3aa7c0f6be2f720d016fe538 Mon Sep 17 00:00:00 2001 From: maggul Date: Thu, 4 Jun 2026 23:01:26 -0500 Subject: [PATCH 03/23] formatting --- src/sundomeigest/arnoldi/sundomeigest_arnoldi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 2600b7d09a..ca3d22aa3c 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -327,13 +327,12 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) if (!(Arnoldi_CONTENT(DEE)->init_guess_set)) { sunrealtype normq = N_VDotProd(Arnoldi_CONTENT(DEE)->q, - Arnoldi_CONTENT(DEE)->q); + Arnoldi_CONTENT(DEE)->q); SUNCheckLastErr(); normq = SUNRsqrt(normq); - N_VScale(ONE / normq, Arnoldi_CONTENT(DEE)->q, - Arnoldi_CONTENT(DEE)->V[0]); + N_VScale(ONE / normq, Arnoldi_CONTENT(DEE)->q, Arnoldi_CONTENT(DEE)->V[0]); SUNCheckLastErr(); /* Reset the initial guess flag to its default value */ From 6d1d4410c0e4044ee079d9a49e22d15e86cecd50 Mon Sep 17 00:00:00 2001 From: maggul Date: Thu, 4 Jun 2026 23:33:46 -0500 Subject: [PATCH 04/23] swig --- .../fmod_int32/fsundomeigest_arnoldi_mod.c | 24 ++++++++++ .../fmod_int32/fsundomeigest_arnoldi_mod.f90 | 44 +++++++++++++++++++ .../fmod_int64/fsundomeigest_arnoldi_mod.c | 24 ++++++++++ .../fmod_int64/fsundomeigest_arnoldi_mod.f90 | 44 +++++++++++++++++++ .../fmod_int32/fsundomeigest_power_mod.c | 24 ++++++++++ .../fmod_int32/fsundomeigest_power_mod.f90 | 44 +++++++++++++++++++ .../fmod_int64/fsundomeigest_power_mod.c | 24 ++++++++++ .../fmod_int64/fsundomeigest_power_mod.f90 | 44 +++++++++++++++++++ 8 files changed, 272 insertions(+) diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c index 37994780aa..f915fc2df9 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c @@ -636,6 +636,30 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(SwigClas } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return ); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->init_guess_set = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + result = (int) ((arg1)->init_guess_set); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(SwigClassWrapper const *farg1, SUNRhsFn farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; SUNRhsFn arg2 = (SUNRhsFn) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 index 8edafe1f65..2d0b898cf8 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 @@ -68,6 +68,8 @@ module fsundomeigest_arnoldi_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get + procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set + procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get procedure :: set_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set procedure :: get_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_get procedure :: set_rhs_data => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_data_set @@ -350,6 +352,23 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set") use, intrinsic :: ISO_C_BINDING @@ -1027,6 +1046,31 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(self, init_guess_set) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT), intent(in) :: init_guess_set +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = init_guess_set +call swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) +swig_result = fresult +end function + subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(self, rhsfn) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c index 6cc33c49a7..09026e091b 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c @@ -636,6 +636,30 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(SwigClas } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return ); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->init_guess_set = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + result = (int) ((arg1)->init_guess_set); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(SwigClassWrapper const *farg1, SUNRhsFn farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; SUNRhsFn arg2 = (SUNRhsFn) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 index 85861d0a3c..cb52b46270 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 @@ -68,6 +68,8 @@ module fsundomeigest_arnoldi_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get + procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set + procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get procedure :: set_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set procedure :: get_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_get procedure :: set_rhs_data => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_data_set @@ -350,6 +352,23 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set") use, intrinsic :: ISO_C_BINDING @@ -1027,6 +1046,31 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(self, init_guess_set) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT), intent(in) :: init_guess_set +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = init_guess_set +call swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) +swig_result = fresult +end function + subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(self, rhsfn) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c index 324db92a27..11a12c880d 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c @@ -612,6 +612,30 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Power__num_ATimes_get(SwigClassW } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return ); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->init_guess_set = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + result = (int) ((arg1)->init_guess_set); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__rel_tol_set(SwigClassWrapper const *farg1, double const *farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; sunrealtype arg2 ; diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 index 41b78edd03..4f5bb5593a 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 @@ -66,6 +66,8 @@ module fsundomeigest_power_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Power__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get + procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set + procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get procedure :: set_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_set procedure :: get_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_get procedure :: set_res => swigf_SUNDomEigEstimatorContent_Power__res_set @@ -326,6 +328,23 @@ function swigc_SUNDomEigEstimatorContent_Power__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + subroutine swigc_SUNDomEigEstimatorContent_Power__rel_tol_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__rel_tol_set") use, intrinsic :: ISO_C_BINDING @@ -938,6 +957,31 @@ function swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set(self, init_guess_set) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT), intent(in) :: init_guess_set +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = init_guess_set +call swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) +swig_result = fresult +end function + subroutine swigf_SUNDomEigEstimatorContent_Power__rel_tol_set(self, rel_tol) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c index 324db92a27..11a12c880d 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c @@ -612,6 +612,30 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Power__num_ATimes_get(SwigClassW } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return ); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->init_guess_set = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + result = (int) ((arg1)->init_guess_set); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__rel_tol_set(SwigClassWrapper const *farg1, double const *farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; sunrealtype arg2 ; diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 index 41b78edd03..4f5bb5593a 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 @@ -66,6 +66,8 @@ module fsundomeigest_power_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Power__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get + procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set + procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get procedure :: set_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_set procedure :: get_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_get procedure :: set_res => swigf_SUNDomEigEstimatorContent_Power__res_set @@ -326,6 +328,23 @@ function swigc_SUNDomEigEstimatorContent_Power__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + subroutine swigc_SUNDomEigEstimatorContent_Power__rel_tol_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__rel_tol_set") use, intrinsic :: ISO_C_BINDING @@ -938,6 +957,31 @@ function swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set(self, init_guess_set) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT), intent(in) :: init_guess_set +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = init_guess_set +call swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) +swig_result = fresult +end function + subroutine swigf_SUNDomEigEstimatorContent_Power__rel_tol_set(self, rel_tol) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self From 6bb6b0dabf3edbc36ac00cc91a62883280f0de66 Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 08:54:37 -0500 Subject: [PATCH 05/23] CHANGELOG and RecentChanges update --- CHANGELOG.md | 4 ++++ doc/shared/RecentChanges.rst | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ed1a1fde8..f8f01c4a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ Fixed a minor bug where STS methods were limited to one fewer than the maximum allowed number of stages. STS can now use the full maximum number of stages. +Fixed a bug that caused SUNDomEigEstimator_Initialize to overwrite the +user-provided initial guess from SUNDomEigEstimator_SetInitialGuess. These +routines are now order-independent. + Fixed memory leaks in CVODES, IDAS, and KINSOL in the unlikely event of a failed `malloc`. diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index 39bc58019a..6f5dade7af 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -42,6 +42,10 @@ Fixed a minor bug where STS methods were limited to one fewer than the maximum allowed number of stages. STS can now use the full maximum number of stages. +Fixed a bug that caused SUNDomEigEstimator_Initialize to overwrite the +user-provided initial guess from SUNDomEigEstimator_SetInitialGuess. These +routines are now order-independent. + Fixed memory leaks in CVODES, IDAS, and KINSOL in the unlikely event of a failed ``malloc``. From 082461d0bd0d86b7af303abb4336aa3ff98ce80b Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 16:30:10 -0500 Subject: [PATCH 06/23] alternative/clean approach --- include/sundomeigest/sundomeigest_arnoldi.h | 2 - include/sundomeigest/sundomeigest_power.h | 2 - .../fmod_int32/fsundomeigest_arnoldi_mod.c | 24 ------ .../fmod_int32/fsundomeigest_arnoldi_mod.f90 | 2 - .../fmod_int64/fsundomeigest_arnoldi_mod.c | 24 ------ .../fmod_int64/fsundomeigest_arnoldi_mod.f90 | 2 - .../arnoldi/sundomeigest_arnoldi.c | 75 ++++++++----------- .../fmod_int32/fsundomeigest_power_mod.c | 24 ------ .../fmod_int32/fsundomeigest_power_mod.f90 | 2 - .../fmod_int64/fsundomeigest_power_mod.c | 24 ------ .../fmod_int64/fsundomeigest_power_mod.f90 | 2 - src/sundomeigest/power/sundomeigest_power.c | 64 +++++++--------- 12 files changed, 59 insertions(+), 188 deletions(-) diff --git a/include/sundomeigest/sundomeigest_arnoldi.h b/include/sundomeigest/sundomeigest_arnoldi.h index a75b4fb078..b46dec25b8 100644 --- a/include/sundomeigest/sundomeigest_arnoldi.h +++ b/include/sundomeigest/sundomeigest_arnoldi.h @@ -54,8 +54,6 @@ struct SUNDomEigEstimatorContent_Arnoldi_ long int num_ATimes; /* Number of ATimes calls */ - sunbooleantype init_guess_set; /* flag to check if the initial guess is set */ - SUNRhsFn rhsfn; /* User provided RHS function */ void* rhs_data; /* RHS function data */ long int nfevals; /* Number of RHS evaluations */ diff --git a/include/sundomeigest/sundomeigest_power.h b/include/sundomeigest/sundomeigest_power.h index 52d5dd8439..d9df90215d 100644 --- a/include/sundomeigest/sundomeigest_power.h +++ b/include/sundomeigest/sundomeigest_power.h @@ -50,8 +50,6 @@ struct SUNDomEigEstimatorContent_Power_ long int num_ATimes; /* Number of ATimes calls */ - sunbooleantype init_guess_set; /* flag to check if the initial guess is set */ - sunrealtype rel_tol; /* Convergence criteria for the power iteration */ sunrealtype res; /* Residual from the last Estimate call */ diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c index f915fc2df9..37994780aa 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c @@ -636,30 +636,6 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(SwigClas } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - int arg2 ; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return ); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - arg2 = (int)(*farg2); - if (arg1) (arg1)->init_guess_set = arg2; -} - - -SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(SwigClassWrapper const *farg1) { - int fresult ; - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - int result; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return 0); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - result = (int) ((arg1)->init_guess_set); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(SwigClassWrapper const *farg1, SUNRhsFn farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; SUNRhsFn arg2 = (SUNRhsFn) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 index 2d0b898cf8..3dbb622594 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 @@ -68,8 +68,6 @@ module fsundomeigest_arnoldi_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get - procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set - procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get procedure :: set_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set procedure :: get_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_get procedure :: set_rhs_data => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_data_set diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c index 09026e091b..6cc33c49a7 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c @@ -636,30 +636,6 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(SwigClas } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - int arg2 ; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return ); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - arg2 = (int)(*farg2); - if (arg1) (arg1)->init_guess_set = arg2; -} - - -SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(SwigClassWrapper const *farg1) { - int fresult ; - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - int result; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::init_guess_set", return 0); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - result = (int) ((arg1)->init_guess_set); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(SwigClassWrapper const *farg1, SUNRhsFn farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; SUNRhsFn arg2 = (SUNRhsFn) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 index cb52b46270..5f1305dfd1 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 @@ -68,8 +68,6 @@ module fsundomeigest_arnoldi_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get - procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set - procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get procedure :: set_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set procedure :: get_rhsfn => swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_get procedure :: set_rhs_data => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_data_set diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index ca3d22aa3c..569ca582af 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -134,40 +134,39 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, DEE->content = content; /* Fill content */ - content->ATimes = NULL; - content->ATdata = NULL; - content->V = NULL; - content->q = NULL; - content->rhs_linY = NULL; - content->rhs_linT = ZERO; - content->Fy = NULL; - content->work = NULL; - content->kry_dim = kry_dim; - content->num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; - content->num_iters = 0; - content->num_ATimes = 0; - content->init_guess_set = SUNFALSE; - content->warmup_to_tol = SUNFALSE; - content->tol_warmup = DEE_TOL_OF_WARMUPS_ARNOLDI_DEFAULT; - content->rhsfn = NULL; - content->rhs_data = NULL; - content->nfevals = 0; - content->LAPACK_A = NULL; - content->LAPACK_wr = NULL; - content->LAPACK_wi = NULL; - content->LAPACK_work = NULL; - content->LAPACK_lwork = 0; - content->LAPACK_arr = NULL; - content->Hes = NULL; + content->ATimes = NULL; + content->ATdata = NULL; + content->V = NULL; + content->q = NULL; + content->rhs_linY = NULL; + content->rhs_linT = ZERO; + content->Fy = NULL; + content->work = NULL; + content->kry_dim = kry_dim; + content->num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; + content->num_iters = 0; + content->num_ATimes = 0; + content->warmup_to_tol = SUNFALSE; + content->tol_warmup = DEE_TOL_OF_WARMUPS_ARNOLDI_DEFAULT; + content->rhsfn = NULL; + content->rhs_data = NULL; + content->nfevals = 0; + content->LAPACK_A = NULL; + content->LAPACK_wr = NULL; + content->LAPACK_wi = NULL; + content->LAPACK_work = NULL; + content->LAPACK_lwork = 0; + content->LAPACK_arr = NULL; + content->Hes = NULL; /* Allocate content */ content->q = N_VClone(q); SUNCheckLastErrNull(); - N_VScale(ONE, q, content->q); + content->V = N_VCloneVectorArray(kry_dim + 1, q); SUNCheckLastErrNull(); - content->V = N_VCloneVectorArray(kry_dim + 1, q); + N_VScale(ONE, q, content->V[0]); SUNCheckLastErrNull(); return (DEE); @@ -323,21 +322,14 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) SUNAssert(Arnoldi_CONTENT(DEE)->Hes[k], SUN_ERR_MALLOC_FAIL); } - /* Initialize the vector V[0] if not already initialized */ - if (!(Arnoldi_CONTENT(DEE)->init_guess_set)) - { - sunrealtype normq = N_VDotProd(Arnoldi_CONTENT(DEE)->q, - Arnoldi_CONTENT(DEE)->q); - SUNCheckLastErr(); - - normq = SUNRsqrt(normq); + sunrealtype normV = N_VDotProd(Arnoldi_CONTENT(DEE)->V[0], + Arnoldi_CONTENT(DEE)->V[0]); + SUNCheckLastErr(); - N_VScale(ONE / normq, Arnoldi_CONTENT(DEE)->q, Arnoldi_CONTENT(DEE)->V[0]); - SUNCheckLastErr(); + normV = SUNRsqrt(normV); - /* Reset the initial guess flag to its default value */ - Arnoldi_CONTENT(DEE)->init_guess_set = SUNFALSE; - } + N_VScale(ONE / normV, Arnoldi_CONTENT(DEE)->V[0], Arnoldi_CONTENT(DEE)->V[0]); + SUNCheckLastErr(); return SUN_SUCCESS; } @@ -403,9 +395,6 @@ SUNErrCode SUNDomEigEstimator_SetInitialGuess_Arnoldi(SUNDomEigEstimator DEE, N_VScale(ONE / normq, q, Arnoldi_CONTENT(DEE)->V[0]); SUNCheckLastErr(); - /* set the initial guess flag to true */ - Arnoldi_CONTENT(DEE)->init_guess_set = SUNTRUE; - return SUN_SUCCESS; } diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c index 11a12c880d..324db92a27 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c @@ -612,30 +612,6 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Power__num_ATimes_get(SwigClassW } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { - struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; - int arg2 ; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return ); - arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - arg2 = (int)(*farg2); - if (arg1) (arg1)->init_guess_set = arg2; -} - - -SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get(SwigClassWrapper const *farg1) { - int fresult ; - struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; - int result; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return 0); - arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - result = (int) ((arg1)->init_guess_set); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__rel_tol_set(SwigClassWrapper const *farg1, double const *farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; sunrealtype arg2 ; diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 index 4f5bb5593a..b8de71ce15 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 @@ -66,8 +66,6 @@ module fsundomeigest_power_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Power__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get - procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set - procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get procedure :: set_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_set procedure :: get_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_get procedure :: set_res => swigf_SUNDomEigEstimatorContent_Power__res_set diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c index 11a12c880d..324db92a27 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c @@ -612,30 +612,6 @@ SWIGEXPORT long _wrap_SUNDomEigEstimatorContent_Power__num_ATimes_get(SwigClassW } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set(SwigClassWrapper const *farg1, int const *farg2) { - struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; - int arg2 ; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return ); - arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - arg2 = (int)(*farg2); - if (arg1) (arg1)->init_guess_set = arg2; -} - - -SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get(SwigClassWrapper const *farg1) { - int fresult ; - struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; - int result; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::init_guess_set", return 0); - arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - result = (int) ((arg1)->init_guess_set); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__rel_tol_set(SwigClassWrapper const *farg1, double const *farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; sunrealtype arg2 ; diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 index 4f5bb5593a..b8de71ce15 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 @@ -66,8 +66,6 @@ module fsundomeigest_power_mod procedure :: get_rhs_linT => swigf_SUNDomEigEstimatorContent_Power__rhs_linT_get procedure :: set_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_set procedure :: get_num_ATimes => swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get - procedure :: set_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set - procedure :: get_init_guess_set => swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get procedure :: set_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_set procedure :: get_rel_tol => swigf_SUNDomEigEstimatorContent_Power__rel_tol_get procedure :: set_res => swigf_SUNDomEigEstimatorContent_Power__res_set diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index c5c49d9aa7..3b5d793a0c 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -133,35 +133,34 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, DEE->content = content; /* Fill content */ - content->ATimes = NULL; - content->ATdata = NULL; - content->V = NULL; - content->q = NULL; - content->q_prev = NULL; - content->rhs_linY = NULL; - content->rhs_linT = ZERO; - content->Fy = NULL; - content->work = NULL; - content->is_complex = SUNTRUE; - content->max_iters = max_iters; - content->num_warmups = DEE_NUM_OF_WARMUPS_PI_DEFAULT; - content->rel_tol = rel_tol; - content->res = ZERO; - content->rhsfn = NULL; - content->rhs_data = NULL; - content->nfevals = 0; - content->num_iters = 0; - content->num_ATimes = 0; - content->init_guess_set = SUNFALSE; + content->ATimes = NULL; + content->ATdata = NULL; + content->V = NULL; + content->q = NULL; + content->q_prev = NULL; + content->rhs_linY = NULL; + content->rhs_linT = ZERO; + content->Fy = NULL; + content->work = NULL; + content->is_complex = SUNTRUE; + content->max_iters = max_iters; + content->num_warmups = DEE_NUM_OF_WARMUPS_PI_DEFAULT; + content->rel_tol = rel_tol; + content->res = ZERO; + content->rhsfn = NULL; + content->rhs_data = NULL; + content->nfevals = 0; + content->num_iters = 0; + content->num_ATimes = 0; /* Allocate content */ content->q = N_VClone(q); SUNCheckLastErrNull(); - N_VScale(ONE, q, content->q); + content->V = N_VClone(q); SUNCheckLastErrNull(); - content->V = N_VClone(q); + N_VScale(ONE, q, content->V); SUNCheckLastErrNull(); return (DEE); @@ -285,20 +284,14 @@ SUNErrCode SUNDomEigEstimator_Initialize_Power(SUNDomEigEstimator DEE) SUNAssert(PI_CONTENT(DEE)->q_prev == NULL, SUN_ERR_ARG_CORRUPT); } - /* Initialize the vector V if not already initialized */ - if (!PI_CONTENT(DEE)->init_guess_set) - { - sunrealtype normq = N_VDotProd(PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->q); - SUNCheckLastErr(); - - normq = SUNRsqrt(normq); + /* Initialize the vector V */ + sunrealtype normV = N_VDotProd(PI_CONTENT(DEE)->V, PI_CONTENT(DEE)->V); + SUNCheckLastErr(); - N_VScale(ONE / normq, PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->V); - SUNCheckLastErr(); + normV = SUNRsqrt(normV); - /* Reset the initial guess flag to its default value */ - PI_CONTENT(DEE)->init_guess_set = SUNFALSE; - } + N_VScale(ONE / normV, PI_CONTENT(DEE)->V, PI_CONTENT(DEE)->V); + SUNCheckLastErr(); return SUN_SUCCESS; } @@ -372,9 +365,6 @@ SUNErrCode SUNDomEigEstimator_SetInitialGuess_Power(SUNDomEigEstimator DEE, N_VScale(ONE / normq, q, PI_CONTENT(DEE)->V); SUNCheckLastErr(); - /* set the initial guess flag to true */ - PI_CONTENT(DEE)->init_guess_set = SUNTRUE; - return SUN_SUCCESS; } From 1c35800dd565455c09417221579147af88c558ba Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 16:34:03 -0500 Subject: [PATCH 07/23] revert f90 files --- .../fmod_int32/fsundomeigest_arnoldi_mod.f90 | 42 ------------------- .../fmod_int64/fsundomeigest_arnoldi_mod.f90 | 42 ------------------- .../fmod_int32/fsundomeigest_power_mod.f90 | 42 ------------------- .../fmod_int64/fsundomeigest_power_mod.f90 | 42 ------------------- 4 files changed, 168 deletions(-) diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 index 3dbb622594..8edafe1f65 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 @@ -350,23 +350,6 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT), intent(in) :: farg2 -end subroutine - -function swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: fresult -end function - subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set") use, intrinsic :: ISO_C_BINDING @@ -1044,31 +1027,6 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(self) & swig_result = fresult end function -subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(self, init_guess_set) -use, intrinsic :: ISO_C_BINDING -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -integer(C_INT), intent(in) :: init_guess_set -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: farg2 - -farg1 = self%swigdata -farg2 = init_guess_set -call swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) -end subroutine - -function swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(self) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -integer(C_INT) :: fresult -type(SwigClassWrapper) :: farg1 - -farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) -swig_result = fresult -end function - subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(self, rhsfn) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 index 5f1305dfd1..85861d0a3c 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 @@ -350,23 +350,6 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT), intent(in) :: farg2 -end subroutine - -function swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: fresult -end function - subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set") use, intrinsic :: ISO_C_BINDING @@ -1044,31 +1027,6 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__num_ATimes_get(self) & swig_result = fresult end function -subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(self, init_guess_set) -use, intrinsic :: ISO_C_BINDING -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -integer(C_INT), intent(in) :: init_guess_set -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: farg2 - -farg1 = self%swigdata -farg2 = init_guess_set -call swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_set(farg1, farg2) -end subroutine - -function swigf_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(self) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -integer(C_INT) :: fresult -type(SwigClassWrapper) :: farg1 - -farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__init_guess_set_get(farg1) -swig_result = fresult -end function - subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__rhsfn_set(self, rhsfn) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 index b8de71ce15..41b78edd03 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 @@ -326,23 +326,6 @@ function swigc_SUNDomEigEstimatorContent_Power__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT), intent(in) :: farg2 -end subroutine - -function swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: fresult -end function - subroutine swigc_SUNDomEigEstimatorContent_Power__rel_tol_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__rel_tol_set") use, intrinsic :: ISO_C_BINDING @@ -955,31 +938,6 @@ function swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get(self) & swig_result = fresult end function -subroutine swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set(self, init_guess_set) -use, intrinsic :: ISO_C_BINDING -class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -integer(C_INT), intent(in) :: init_guess_set -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: farg2 - -farg1 = self%swigdata -farg2 = init_guess_set -call swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) -end subroutine - -function swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get(self) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -integer(C_INT) :: fresult -type(SwigClassWrapper) :: farg1 - -farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) -swig_result = fresult -end function - subroutine swigf_SUNDomEigEstimatorContent_Power__rel_tol_set(self, rel_tol) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 index b8de71ce15..41b78edd03 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 @@ -326,23 +326,6 @@ function swigc_SUNDomEigEstimatorContent_Power__num_ATimes_get(farg1) & integer(C_LONG) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT), intent(in) :: farg2 -end subroutine - -function swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__init_guess_set_get") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: fresult -end function - subroutine swigc_SUNDomEigEstimatorContent_Power__rel_tol_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__rel_tol_set") use, intrinsic :: ISO_C_BINDING @@ -955,31 +938,6 @@ function swigf_SUNDomEigEstimatorContent_Power__num_ATimes_get(self) & swig_result = fresult end function -subroutine swigf_SUNDomEigEstimatorContent_Power__init_guess_set_set(self, init_guess_set) -use, intrinsic :: ISO_C_BINDING -class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -integer(C_INT), intent(in) :: init_guess_set -type(SwigClassWrapper) :: farg1 -integer(C_INT) :: farg2 - -farg1 = self%swigdata -farg2 = init_guess_set -call swigc_SUNDomEigEstimatorContent_Power__init_guess_set_set(farg1, farg2) -end subroutine - -function swigf_SUNDomEigEstimatorContent_Power__init_guess_set_get(self) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -integer(C_INT) :: fresult -type(SwigClassWrapper) :: farg1 - -farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Power__init_guess_set_get(farg1) -swig_result = fresult -end function - subroutine swigf_SUNDomEigEstimatorContent_Power__rel_tol_set(self, rel_tol) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self From ef88d88099edec40162bd074714814221a15cf77 Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 18:48:03 -0500 Subject: [PATCH 08/23] move normalization of the initial vector to constructor --- .../arnoldi/sundomeigest_arnoldi.c | 19 ++++++++----------- src/sundomeigest/power/sundomeigest_power.c | 19 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 569ca582af..872a0f160c 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -166,8 +166,14 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, content->V = N_VCloneVectorArray(kry_dim + 1, q); SUNCheckLastErrNull(); - N_VScale(ONE, q, content->V[0]); - SUNCheckLastErrNull(); + /* Initialize the vector V[0] */ + sunrealtype normq = N_VDotProd(q, q); + SUNCheckLastErr(); + + normq = SUNRsqrt(normq); + + N_VScale(ONE / normq, q, content->V[0]); + SUNCheckLastErr(); return (DEE); } @@ -322,15 +328,6 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) SUNAssert(Arnoldi_CONTENT(DEE)->Hes[k], SUN_ERR_MALLOC_FAIL); } - sunrealtype normV = N_VDotProd(Arnoldi_CONTENT(DEE)->V[0], - Arnoldi_CONTENT(DEE)->V[0]); - SUNCheckLastErr(); - - normV = SUNRsqrt(normV); - - N_VScale(ONE / normV, Arnoldi_CONTENT(DEE)->V[0], Arnoldi_CONTENT(DEE)->V[0]); - SUNCheckLastErr(); - return SUN_SUCCESS; } diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 3b5d793a0c..0bed8f153f 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -160,8 +160,14 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, content->V = N_VClone(q); SUNCheckLastErrNull(); - N_VScale(ONE, q, content->V); - SUNCheckLastErrNull(); + /* Initialize the vector V */ + sunrealtype normq = N_VDotProd(q, q); + SUNCheckLastErr(); + + normq = SUNRsqrt(normq); + + N_VScale(ONE / normq, q, PI_CONTENT(DEE)->V); + SUNCheckLastErr(); return (DEE); } @@ -284,15 +290,6 @@ SUNErrCode SUNDomEigEstimator_Initialize_Power(SUNDomEigEstimator DEE) SUNAssert(PI_CONTENT(DEE)->q_prev == NULL, SUN_ERR_ARG_CORRUPT); } - /* Initialize the vector V */ - sunrealtype normV = N_VDotProd(PI_CONTENT(DEE)->V, PI_CONTENT(DEE)->V); - SUNCheckLastErr(); - - normV = SUNRsqrt(normV); - - N_VScale(ONE / normV, PI_CONTENT(DEE)->V, PI_CONTENT(DEE)->V); - SUNCheckLastErr(); - return SUN_SUCCESS; } From c4ede99cdc3bcca3b9730f3234fb7448cc25c1bc Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 19:37:11 -0500 Subject: [PATCH 09/23] NULL returning error check --- src/sundomeigest/arnoldi/sundomeigest_arnoldi.c | 4 ++-- src/sundomeigest/power/sundomeigest_power.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 872a0f160c..1f0cdd7c9b 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -168,12 +168,12 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, /* Initialize the vector V[0] */ sunrealtype normq = N_VDotProd(q, q); - SUNCheckLastErr(); + SUNCheckLastErrNull(); normq = SUNRsqrt(normq); N_VScale(ONE / normq, q, content->V[0]); - SUNCheckLastErr(); + SUNCheckLastErrNull(); return (DEE); } diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 0bed8f153f..7b8b5eb905 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -162,12 +162,12 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, /* Initialize the vector V */ sunrealtype normq = N_VDotProd(q, q); - SUNCheckLastErr(); + SUNCheckLastErrNull(); normq = SUNRsqrt(normq); N_VScale(ONE / normq, q, PI_CONTENT(DEE)->V); - SUNCheckLastErr(); + SUNCheckLastErrNull(); return (DEE); } From ac800dc382930113f09264595068e91c83b68e6f Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 20:50:38 -0500 Subject: [PATCH 10/23] work is used in the RHS as input and the output now which will be fixed in the next commit --- include/sundomeigest/sundomeigest_arnoldi.h | 2 +- include/sundomeigest/sundomeigest_power.h | 2 +- .../arnoldi/sundomeigest_arnoldi.c | 103 ++++++------ src/sundomeigest/power/sundomeigest_power.c | 151 ++++++++++-------- 4 files changed, 142 insertions(+), 116 deletions(-) diff --git a/include/sundomeigest/sundomeigest_arnoldi.h b/include/sundomeigest/sundomeigest_arnoldi.h index b46dec25b8..0a2aafa9d7 100644 --- a/include/sundomeigest/sundomeigest_arnoldi.h +++ b/include/sundomeigest/sundomeigest_arnoldi.h @@ -43,7 +43,7 @@ struct SUNDomEigEstimatorContent_Arnoldi_ /* Krylov subspace vectors */ N_Vector* V; - N_Vector q, rhs_linY, Fy, work; + N_Vector rhs_linY, Fy, work; int kry_dim; /* Krylov subspace dimension */ int num_warmups; /* Number of preprocessing iterations */ diff --git a/include/sundomeigest/sundomeigest_power.h b/include/sundomeigest/sundomeigest_power.h index d9df90215d..8d3978d4bd 100644 --- a/include/sundomeigest/sundomeigest_power.h +++ b/include/sundomeigest/sundomeigest_power.h @@ -41,7 +41,7 @@ struct SUNDomEigEstimatorContent_Power_ SUNATimesFn ATimes; /* User provided ATimes function */ void* ATdata; /* ATimes function data*/ - N_Vector V, q, q_prev, rhs_linY, Fy, work; /* workspace vectors */ + N_Vector V, v_prev, rhs_linY, Fy, work; /* workspace vectors */ int num_warmups; /* Number of preprocessing iterations */ long int max_iters; /* Maximum number of power iterations */ diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 569ca582af..4c67bfee08 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -137,7 +137,6 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, content->ATimes = NULL; content->ATdata = NULL; content->V = NULL; - content->q = NULL; content->rhs_linY = NULL; content->rhs_linT = ZERO; content->Fy = NULL; @@ -160,7 +159,7 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, content->Hes = NULL; /* Allocate content */ - content->q = N_VClone(q); + content->work = N_VClone(q); SUNCheckLastErrNull(); content->V = N_VCloneVectorArray(kry_dim + 1, q); @@ -254,7 +253,6 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) SUNAssert(Arnoldi_CONTENT(DEE)->ATimes, SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); - SUNAssert(Arnoldi_CONTENT(DEE)->q, SUN_ERR_ARG_CORRUPT); if (Arnoldi_CONTENT(DEE)->LAPACK_A == NULL) { @@ -286,9 +284,12 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) sunindextype info = 0; sunindextype lwork = -1; sunrealtype work = SUN_RCONST(0.0); + sunrealtype* A = Arnoldi_CONTENT(DEE)->LAPACK_A; + sunrealtype* wr = Arnoldi_CONTENT(DEE)->LAPACK_wr; + sunrealtype* wi = Arnoldi_CONTENT(DEE)->LAPACK_wi; + N_Vector V = Arnoldi_CONTENT(DEE)->V[0]; - xgeev_f77(&jobvl, &jobvr, &N, Arnoldi_CONTENT(DEE)->LAPACK_A, &lda, - Arnoldi_CONTENT(DEE)->LAPACK_wr, Arnoldi_CONTENT(DEE)->LAPACK_wi, + xgeev_f77(&jobvl, &jobvr, &N, A, &lda, wr, wi, NULL, &ldvl, NULL, &ldvr, &work, &lwork, &info); /* The workspace size is returned as the first entry of the work array */ @@ -322,13 +323,12 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) SUNAssert(Arnoldi_CONTENT(DEE)->Hes[k], SUN_ERR_MALLOC_FAIL); } - sunrealtype normV = N_VDotProd(Arnoldi_CONTENT(DEE)->V[0], - Arnoldi_CONTENT(DEE)->V[0]); + sunrealtype normV = N_VDotProd(V, V); SUNCheckLastErr(); normV = SUNRsqrt(normV); - N_VScale(ONE / normV, Arnoldi_CONTENT(DEE)->V[0], Arnoldi_CONTENT(DEE)->V[0]); + N_VScale(ONE / normV, V, V); SUNCheckLastErr(); return SUN_SUCCESS; @@ -410,41 +410,53 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, SUNAssert(lambdaI, SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE)->ATimes, SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); - SUNAssert(Arnoldi_CONTENT(DEE)->q, SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE)->Hes, SUN_ERR_ARG_CORRUPT); int retval; + int *num_warmups = &(Arnoldi_CONTENT(DEE)->num_warmups); sunindextype n = Arnoldi_CONTENT(DEE)->kry_dim; - sunrealtype normq; - Arnoldi_CONTENT(DEE)->num_ATimes = 0; - Arnoldi_CONTENT(DEE)->num_iters = 0; + sunrealtype normAv; + long int *num_ATimes = &(Arnoldi_CONTENT(DEE)->num_ATimes); + long int *num_iters = &(Arnoldi_CONTENT(DEE)->num_iters); + *num_ATimes = 0; + *num_iters = 0; + + N_Vector *V = Arnoldi_CONTENT(DEE)->V; + N_Vector Av = Arnoldi_CONTENT(DEE)->work; + + sunrealtype** Hes = Arnoldi_CONTENT(DEE)->Hes; + + SUNATimesFn ATimes = Arnoldi_CONTENT(DEE)->ATimes; + void *ATdata = Arnoldi_CONTENT(DEE)->ATdata; + + sunrealtype* A = Arnoldi_CONTENT(DEE)->LAPACK_A; + sunrealtype* wr = Arnoldi_CONTENT(DEE)->LAPACK_wr; + sunrealtype* wi = Arnoldi_CONTENT(DEE)->LAPACK_wi; + sunrealtype** arr = Arnoldi_CONTENT(DEE)->LAPACK_arr; sunrealtype res; sunrealtype new_lambda = ZERO; sunrealtype old_lambda = ZERO; /* Set the initial q = A^{num_warmups}q/||A^{num_warmups}q|| */ - for (int i = 0; i < Arnoldi_CONTENT(DEE)->num_warmups; i++) + for (int i = 0; i < *num_warmups; i++) { - retval = Arnoldi_CONTENT(DEE)->ATimes(Arnoldi_CONTENT(DEE)->ATdata, - Arnoldi_CONTENT(DEE)->V[0], - Arnoldi_CONTENT(DEE)->q); - Arnoldi_CONTENT(DEE)->num_ATimes++; - Arnoldi_CONTENT(DEE)->num_iters++; + retval = ATimes(ATdata, V[0], Av); + (*num_ATimes)++; + (*num_iters)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } if (Arnoldi_CONTENT(DEE)->warmup_to_tol) { - new_lambda = N_VDotProd(Arnoldi_CONTENT(DEE)->V[0], - Arnoldi_CONTENT(DEE)->q); //Rayleigh quotient + new_lambda = N_VDotProd(V[0], Av); //Rayleigh quotient SUNCheckLastErr(); } - normq = N_VDotProd(Arnoldi_CONTENT(DEE)->q, Arnoldi_CONTENT(DEE)->q); + normAv = N_VDotProd(Av, Av); SUNCheckLastErr(); - normq = SUNRsqrt(normq); - N_VScale(ONE / normq, Arnoldi_CONTENT(DEE)->q, Arnoldi_CONTENT(DEE)->V[0]); + normAv = SUNRsqrt(normAv); + N_VScale(ONE / normAv, Av, V[0]); SUNCheckLastErr(); if (Arnoldi_CONTENT(DEE)->warmup_to_tol) @@ -461,20 +473,18 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, for (int i = 0; i < n; i++) { /* Compute the next Krylov vector */ - retval = Arnoldi_CONTENT(DEE)->ATimes(Arnoldi_CONTENT(DEE)->ATdata, - Arnoldi_CONTENT(DEE)->V[i], - Arnoldi_CONTENT(DEE)->V[i + 1]); - Arnoldi_CONTENT(DEE)->num_ATimes++; - Arnoldi_CONTENT(DEE)->num_iters++; + retval = ATimes(ATdata, V[i], V[i + 1]); + (*num_ATimes)++; + (*num_iters)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } - SUNCheckCall(SUNModifiedGS(Arnoldi_CONTENT(DEE)->V, - Arnoldi_CONTENT(DEE)->Hes, i + 1, (int)n, - &(Arnoldi_CONTENT(DEE)->Hes[i + 1][i]))); + SUNCheckCall(SUNModifiedGS(V, + Hes, i + 1, (int)n, + &(Hes[i + 1][i]))); /* Unitize the computed orthogonal vector */ - N_VScale(SUN_RCONST(1.0) / Arnoldi_CONTENT(DEE)->Hes[i + 1][i], - Arnoldi_CONTENT(DEE)->V[i + 1], Arnoldi_CONTENT(DEE)->V[i + 1]); + N_VScale(SUN_RCONST(1.0) / Hes[i + 1][i], + V[i + 1], V[i + 1]); SUNCheckLastErr(); } @@ -484,7 +494,7 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, { for (int i = 0; i < n; i++) { - Arnoldi_CONTENT(DEE)->LAPACK_A[k] = Arnoldi_CONTENT(DEE)->Hes[i][j]; + A[k] = Hes[i][j]; k++; } } @@ -506,8 +516,8 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, sunindextype ldvr = n; sunindextype info; sunindextype lwork = Arnoldi_CONTENT(DEE)->LAPACK_lwork; - xgeev_f77(&jobvl, &jobvr, &n, Arnoldi_CONTENT(DEE)->LAPACK_A, &lda, - Arnoldi_CONTENT(DEE)->LAPACK_wr, Arnoldi_CONTENT(DEE)->LAPACK_wi, + xgeev_f77(&jobvl, &jobvr, &n, A, &lda, + wr, wi, NULL, &ldvl, NULL, &ldvr, Arnoldi_CONTENT(DEE)->LAPACK_work, &lwork, &info); @@ -516,24 +526,24 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, /* order the eigenvalues by their magnitude */ for (int i = 0; i < n; i++) { - Arnoldi_CONTENT(DEE)->LAPACK_arr[i][0] = Arnoldi_CONTENT(DEE)->LAPACK_wr[i]; - Arnoldi_CONTENT(DEE)->LAPACK_arr[i][1] = Arnoldi_CONTENT(DEE)->LAPACK_wi[i]; + arr[i][0] = wr[i]; + arr[i][1] = wi[i]; } /* Sort the array using qsort */ - qsort(Arnoldi_CONTENT(DEE)->LAPACK_arr, n, - sizeof(Arnoldi_CONTENT(DEE)->LAPACK_arr[0]), sundomeigest_Compare); + qsort(arr, n, + sizeof(arr[0]), sundomeigest_Compare); /* Substitute the ordered eigenvalues back in LAPACK_w* */ for (int i = 0; i < n; i++) { - Arnoldi_CONTENT(DEE)->LAPACK_wr[i] = Arnoldi_CONTENT(DEE)->LAPACK_arr[i][0]; - Arnoldi_CONTENT(DEE)->LAPACK_wi[i] = Arnoldi_CONTENT(DEE)->LAPACK_arr[i][1]; + wr[i] = arr[i][0]; + wi[i] = arr[i][1]; } /* Copy the dominant eigenvalue */ - *lambdaR = Arnoldi_CONTENT(DEE)->LAPACK_wr[0]; - *lambdaI = Arnoldi_CONTENT(DEE)->LAPACK_wi[0]; + *lambdaR = wr[0]; + *lambdaI = wi[0]; return SUN_SUCCESS; } @@ -610,11 +620,6 @@ SUNErrCode SUNDomEigEstimator_Destroy_Arnoldi(SUNDomEigEstimator* DEEptr) if (DEE->content) { /* delete items from within the content structure */ - if (Arnoldi_CONTENT(DEE)->q) - { - N_VDestroy(Arnoldi_CONTENT(DEE)->q); - Arnoldi_CONTENT(DEE)->q = NULL; - } if (Arnoldi_CONTENT(DEE)->rhs_linY) { N_VDestroy(Arnoldi_CONTENT(DEE)->rhs_linY); diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 3b5d793a0c..bd069e42e3 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -136,8 +136,7 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, content->ATimes = NULL; content->ATdata = NULL; content->V = NULL; - content->q = NULL; - content->q_prev = NULL; + content->v_prev = NULL; content->rhs_linY = NULL; content->rhs_linT = ZERO; content->Fy = NULL; @@ -154,7 +153,7 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, content->num_ATimes = 0; /* Allocate content */ - content->q = N_VClone(q); + content->work = N_VClone(q); SUNCheckLastErrNull(); content->V = N_VClone(q); @@ -242,13 +241,13 @@ SUNErrCode SUNDomEigEstimator_SetIsReal_Power(SUNDomEigEstimator DEE, /* set the complex flag to the opposite of the real flag */ PI_CONTENT(DEE)->is_complex = !real; - /* q_prev is allocated in SUNDomEigEstimator_Initialize_Power, which is expected to be + /* v_prev is allocated in SUNDomEigEstimator_Initialize_Power, which is expected to be called after this routine. If the user calls this routine after initialization, we need - to free q_prev here. */ - if (!(PI_CONTENT(DEE)->is_complex) && PI_CONTENT(DEE)->q_prev) + to free v_prev here. */ + if (!(PI_CONTENT(DEE)->is_complex) && PI_CONTENT(DEE)->v_prev) { - N_VDestroy(PI_CONTENT(DEE)->q_prev); - PI_CONTENT(DEE)->q_prev = NULL; + N_VDestroy(PI_CONTENT(DEE)->v_prev); + PI_CONTENT(DEE)->v_prev = NULL; } return SUN_SUCCESS; @@ -277,11 +276,10 @@ SUNErrCode SUNDomEigEstimator_Initialize_Power(SUNDomEigEstimator DEE) SUNAssert(PI_CONTENT(DEE)->ATimes, SUN_ERR_ARG_CORRUPT); SUNAssert(PI_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); - SUNAssert(PI_CONTENT(DEE)->q, SUN_ERR_ARG_CORRUPT); if (PI_CONTENT(DEE)->is_complex) { - SUNAssert(PI_CONTENT(DEE)->q_prev == NULL, SUN_ERR_ARG_CORRUPT); + SUNAssert(PI_CONTENT(DEE)->v_prev == NULL, SUN_ERR_ARG_CORRUPT); } /* Initialize the vector V */ @@ -380,12 +378,31 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, SUNAssert(lambdaI, SUN_ERR_ARG_CORRUPT); SUNAssert(PI_CONTENT(DEE)->ATimes, SUN_ERR_ARG_CORRUPT); SUNAssert(PI_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); - SUNAssert(PI_CONTENT(DEE)->q, SUN_ERR_ARG_CORRUPT); SUNAssert((PI_CONTENT(DEE)->max_iters >= 0), SUN_ERR_ARG_CORRUPT); - if (PI_CONTENT(DEE)->is_complex && (PI_CONTENT(DEE)->q_prev == NULL)) + + N_Vector Av = PI_CONTENT(DEE)->work; + N_Vector V = PI_CONTENT(DEE)->V; + N_Vector v_prev = PI_CONTENT(DEE)->v_prev; + + sunbooleantype is_complex = PI_CONTENT(DEE)->is_complex; + + int num_warmups = PI_CONTENT(DEE)->num_warmups; + + long int *num_ATimes = &(PI_CONTENT(DEE)->num_ATimes); + long int *num_iters = &(PI_CONTENT(DEE)->num_iters); + long int max_iters = PI_CONTENT(DEE)->max_iters; + + sunrealtype rel_tol = PI_CONTENT(DEE)->rel_tol; + sunrealtype *res = &(PI_CONTENT(DEE)->res); + + void *ATdata = PI_CONTENT(DEE)->ATdata; + + SUNATimesFn ATimes = PI_CONTENT(DEE)->ATimes; + + if (is_complex && (v_prev == NULL)) { - /* allocate q_prev vector */ - PI_CONTENT(DEE)->q_prev = N_VClone(PI_CONTENT(DEE)->q); + /* allocate v_prev vector */ + v_prev = N_VClone(Av); SUNCheckLastErr(); } @@ -394,56 +411,55 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, int retval; sunbooleantype converged; - sunrealtype normq; - PI_CONTENT(DEE)->num_ATimes = 0; - PI_CONTENT(DEE)->num_iters = 0; + sunrealtype normw; + *num_ATimes = 0; + *num_iters = 0; /* Set the initial q = A^{num_warmups}q/||A^{num_warmups}q|| */ - for (int i = 0; i < PI_CONTENT(DEE)->num_warmups; i++) + for (int i = 0; i < num_warmups; i++) { - retval = PI_CONTENT(DEE)->ATimes(PI_CONTENT(DEE)->ATdata, - PI_CONTENT(DEE)->V, PI_CONTENT(DEE)->q); - PI_CONTENT(DEE)->num_ATimes++; - PI_CONTENT(DEE)->num_iters++; + retval = ATimes(ATdata, + V, Av); + (*num_ATimes)++; + (*num_iters)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } - normq = N_VDotProd(PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->q); + normw = N_VDotProd(Av, Av); SUNCheckLastErr(); - normq = SUNRsqrt(normq); - N_VScale(ONE / normq, PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->V); + normw = SUNRsqrt(normw); + N_VScale(ONE / normw, Av, V); SUNCheckLastErr(); } - for (int k = 0; k < PI_CONTENT(DEE)->max_iters; k++) + for (int k = 0; k < max_iters; k++) { - if (PI_CONTENT(DEE)->is_complex) + if (is_complex) { - N_VScale(ONE, PI_CONTENT(DEE)->V, PI_CONTENT(DEE)->q_prev); + N_VScale(ONE, V, v_prev); SUNCheckLastErr(); } - retval = PI_CONTENT(DEE)->ATimes(PI_CONTENT(DEE)->ATdata, - PI_CONTENT(DEE)->V, PI_CONTENT(DEE)->q); - PI_CONTENT(DEE)->num_ATimes++; - PI_CONTENT(DEE)->num_iters++; + retval = ATimes(ATdata, + V, Av); + (*num_ATimes)++; + (*num_iters)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } - newlambdaR = N_VDotProd(PI_CONTENT(DEE)->V, - PI_CONTENT(DEE)->q); //Rayleigh quotient + newlambdaR = N_VDotProd(V, Av); //Rayleigh quotient SUNCheckLastErr(); - PI_CONTENT(DEE)->res = SUNRabs(newlambdaR - oldlambdaR); + *res = SUNRabs(newlambdaR - oldlambdaR); converged = - (PI_CONTENT(DEE)->res <= PI_CONTENT(DEE)->rel_tol * SUNRabs(newlambdaR)); + (*res <= rel_tol * SUNRabs(newlambdaR)); - if (converged && !PI_CONTENT(DEE)->is_complex) { break; } + if (converged && !is_complex) { break; } - normq = N_VDotProd(PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->q); + normw = N_VDotProd(Av, Av); SUNCheckLastErr(); - normq = SUNRsqrt(normq); - N_VScale(ONE / normq, PI_CONTENT(DEE)->q, PI_CONTENT(DEE)->V); + normw = SUNRsqrt(normw); + N_VScale(ONE / normw, Av, V); SUNCheckLastErr(); if (converged) { break; } @@ -451,11 +467,11 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, oldlambdaR = newlambdaR; } - if (PI_CONTENT(DEE)->is_complex) + if (is_complex) { - retval = sundomeigestimator_complex_dom_eigs_from_PI(DEE, newlambdaR, normq, - PI_CONTENT(DEE)->q_prev, - PI_CONTENT(DEE)->V, + retval = sundomeigestimator_complex_dom_eigs_from_PI(DEE, newlambdaR, normw, + v_prev, + V, lambdaR, lambdaI); if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } } @@ -558,11 +574,17 @@ SUNErrCode sundomeigestimator_complex_dom_eigs_from_PI( SUNFunctionBegin(DEE->sunctx); int retval; + N_Vector Av = PI_CONTENT(DEE)->work; + SUNATimesFn ATimes = PI_CONTENT(DEE)->ATimes; + void* ATdata = PI_CONTENT(DEE)->ATdata; + sunrealtype rel_tol = PI_CONTENT(DEE)->rel_tol; + long int *num_ATimes = &(PI_CONTENT(DEE)->num_ATimes); + sunrealtype cos_qs, gram_det, det_G_inv, h11, h12, h22, p11, p12, p21, p22; /* The threshold for identifying real or complex DEE is experimentally - determined based on the relative tolerance PI_CONTENT(DEE)->rel_tol */ + determined based on the relative tolerance rel_tol */ sunrealtype gram_det_tol = SUNMAX(SUN_RCONST(10.0) * SUN_UNIT_ROUNDOFF, - SUN_RCONST(10.0) * PI_CONTENT(DEE)->rel_tol); + SUN_RCONST(10.0) * rel_tol); cos_qs = N_VDotProd(v_prev, v); SUNCheckLastErr(); @@ -591,14 +613,13 @@ SUNErrCode sundomeigestimator_complex_dom_eigs_from_PI( h11 = lambdaR; - retval = PI_CONTENT(DEE)->ATimes(PI_CONTENT(DEE)->ATdata, v, - PI_CONTENT(DEE)->q); - PI_CONTENT(DEE)->num_ATimes++; + retval = ATimes(ATdata, v, Av); + (*num_ATimes)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } - h12 = N_VDotProd(v_prev, PI_CONTENT(DEE)->q); + h12 = N_VDotProd(v_prev, Av); SUNCheckLastErr(); - h22 = N_VDotProd(v, PI_CONTENT(DEE)->q); + h22 = N_VDotProd(v, Av); SUNCheckLastErr(); p11 = det_G_inv * (h11 - cos_qs * h21); @@ -643,15 +664,10 @@ SUNErrCode SUNDomEigEstimator_Destroy_Power(SUNDomEigEstimator* DEEptr) if (DEE->content) { /* delete items from within the content structure */ - if (PI_CONTENT(DEE)->q) - { - N_VDestroy(PI_CONTENT(DEE)->q); - PI_CONTENT(DEE)->q = NULL; - } - if (PI_CONTENT(DEE)->q_prev) + if (PI_CONTENT(DEE)->v_prev) { - N_VDestroy(PI_CONTENT(DEE)->q_prev); - PI_CONTENT(DEE)->q_prev = NULL; + N_VDestroy(PI_CONTENT(DEE)->v_prev); + PI_CONTENT(DEE)->v_prev = NULL; } if (PI_CONTENT(DEE)->V) { @@ -733,9 +749,15 @@ SUNErrCode dee_DQJtimes_Power(void* voidstarDEE, N_Vector v, N_Vector Jv) N_Vector work = PI_CONTENT(DEE)->work; N_Vector Fy = PI_CONTENT(DEE)->Fy; - retval = PI_CONTENT(DEE)->rhsfn(PI_CONTENT(DEE)->rhs_linT, y, Fy, - PI_CONTENT(DEE)->rhs_data); - PI_CONTENT(DEE)->nfevals++; + SUNRhsFn rhsfn = PI_CONTENT(DEE)->rhsfn; + void *rhs_data = PI_CONTENT(DEE)->rhs_data; + + sunrealtype rhs_linT = PI_CONTENT(DEE)->rhs_linT; + + long int *nfevals = &(PI_CONTENT(DEE)->nfevals); + + retval = rhsfn(rhs_linT, y, Fy, rhs_data); + (*nfevals)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } /* Initialize perturbation */ @@ -751,9 +773,8 @@ SUNErrCode dee_DQJtimes_Power(void* voidstarDEE, N_Vector v, N_Vector Jv) N_VLinearSum(sig, v, ONE, y, work); /* Set Jv = f(tn, y+sig*v) */ - retval = PI_CONTENT(DEE)->rhsfn(PI_CONTENT(DEE)->rhs_linT, work, Jv, - PI_CONTENT(DEE)->rhs_data); - PI_CONTENT(DEE)->nfevals++; + retval = rhsfn(rhs_linT, work, Jv, rhs_data); + (*nfevals)++; if (retval == 0) { break; } if (retval < 0) { return SUN_ERR_USER_FCN_FAIL; } From b9e4b3d0db285d43116354a7c65278b639ea5055 Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 21:45:40 -0500 Subject: [PATCH 11/23] ->Av vector allocation for the DQJ call conflict: Arnoldi allocates one less vector memory but Power must keep all --- include/sundomeigest/sundomeigest_power.h | 2 +- .../arnoldi/sundomeigest_arnoldi.c | 8 +--- src/sundomeigest/power/sundomeigest_power.c | 47 ++++++++++++------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/include/sundomeigest/sundomeigest_power.h b/include/sundomeigest/sundomeigest_power.h index 8d3978d4bd..f9e10a4b74 100644 --- a/include/sundomeigest/sundomeigest_power.h +++ b/include/sundomeigest/sundomeigest_power.h @@ -41,7 +41,7 @@ struct SUNDomEigEstimatorContent_Power_ SUNATimesFn ATimes; /* User provided ATimes function */ void* ATdata; /* ATimes function data*/ - N_Vector V, v_prev, rhs_linY, Fy, work; /* workspace vectors */ + N_Vector V, Av, v_prev, rhs_linY, Fy, work; /* workspace vectors */ int num_warmups; /* Number of preprocessing iterations */ long int max_iters; /* Maximum number of power iterations */ diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 4c67bfee08..02e3ee921a 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -158,10 +158,6 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, content->LAPACK_arr = NULL; content->Hes = NULL; - /* Allocate content */ - content->work = N_VClone(q); - SUNCheckLastErrNull(); - content->V = N_VCloneVectorArray(kry_dim + 1, q); SUNCheckLastErrNull(); @@ -422,7 +418,7 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, *num_iters = 0; N_Vector *V = Arnoldi_CONTENT(DEE)->V; - N_Vector Av = Arnoldi_CONTENT(DEE)->work; + N_Vector Av = V[1]; sunrealtype** Hes = Arnoldi_CONTENT(DEE)->Hes; @@ -792,4 +788,4 @@ SUNErrCode dee_DQJtimes_Arnoldi(void* voidstarDEE, N_Vector v, N_Vector Jv) N_VLinearSum(siginv, Jv, -siginv, Fy, Jv); return SUN_SUCCESS; -} \ No newline at end of file +} diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index bd069e42e3..d399cdc6e4 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -136,6 +136,7 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, content->ATimes = NULL; content->ATdata = NULL; content->V = NULL; + content->Av = NULL; content->v_prev = NULL; content->rhs_linY = NULL; content->rhs_linT = ZERO; @@ -153,7 +154,10 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, content->num_ATimes = 0; /* Allocate content */ - content->work = N_VClone(q); + content->Av = N_VClone(q); + SUNCheckLastErrNull(); + + content->v_prev = N_VClone(q); SUNCheckLastErrNull(); content->V = N_VClone(q); @@ -241,15 +245,22 @@ SUNErrCode SUNDomEigEstimator_SetIsReal_Power(SUNDomEigEstimator DEE, /* set the complex flag to the opposite of the real flag */ PI_CONTENT(DEE)->is_complex = !real; - /* v_prev is allocated in SUNDomEigEstimator_Initialize_Power, which is expected to be - called after this routine. If the user calls this routine after initialization, we need - to free v_prev here. */ - if (!(PI_CONTENT(DEE)->is_complex) && PI_CONTENT(DEE)->v_prev) + /* v_prev is allocated in the constructor. If the user calls this routine later, + we need to free v_prev here. */ + if (real && PI_CONTENT(DEE)->v_prev != NULL) { N_VDestroy(PI_CONTENT(DEE)->v_prev); PI_CONTENT(DEE)->v_prev = NULL; } + /* If the user requests complex eigenvalues, we need to allocate v_prev. */ + if (!real && PI_CONTENT(DEE)->v_prev == NULL) + { + /* allocate v_prev vector */ + PI_CONTENT(DEE)->v_prev = N_VClone(PI_CONTENT(DEE)->Av); + SUNCheckLastErr(); + } + return SUN_SUCCESS; } @@ -276,6 +287,7 @@ SUNErrCode SUNDomEigEstimator_Initialize_Power(SUNDomEigEstimator DEE) SUNAssert(PI_CONTENT(DEE)->ATimes, SUN_ERR_ARG_CORRUPT); SUNAssert(PI_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); + SUNAssert(PI_CONTENT(DEE)->Av, SUN_ERR_ARG_CORRUPT); if (PI_CONTENT(DEE)->is_complex) { @@ -380,12 +392,17 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, SUNAssert(PI_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); SUNAssert((PI_CONTENT(DEE)->max_iters >= 0), SUN_ERR_ARG_CORRUPT); - N_Vector Av = PI_CONTENT(DEE)->work; + sunbooleantype is_complex = PI_CONTENT(DEE)->is_complex; + + if (is_complex) + { + SUNAssert(PI_CONTENT(DEE)->v_prev, SUN_ERR_ARG_CORRUPT); + } + + N_Vector Av = PI_CONTENT(DEE)->Av; N_Vector V = PI_CONTENT(DEE)->V; N_Vector v_prev = PI_CONTENT(DEE)->v_prev; - sunbooleantype is_complex = PI_CONTENT(DEE)->is_complex; - int num_warmups = PI_CONTENT(DEE)->num_warmups; long int *num_ATimes = &(PI_CONTENT(DEE)->num_ATimes); @@ -399,13 +416,6 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, SUNATimesFn ATimes = PI_CONTENT(DEE)->ATimes; - if (is_complex && (v_prev == NULL)) - { - /* allocate v_prev vector */ - v_prev = N_VClone(Av); - SUNCheckLastErr(); - } - sunrealtype newlambdaR = ZERO; sunrealtype oldlambdaR = ZERO; @@ -574,7 +584,7 @@ SUNErrCode sundomeigestimator_complex_dom_eigs_from_PI( SUNFunctionBegin(DEE->sunctx); int retval; - N_Vector Av = PI_CONTENT(DEE)->work; + N_Vector Av = PI_CONTENT(DEE)->Av; SUNATimesFn ATimes = PI_CONTENT(DEE)->ATimes; void* ATdata = PI_CONTENT(DEE)->ATdata; sunrealtype rel_tol = PI_CONTENT(DEE)->rel_tol; @@ -664,6 +674,11 @@ SUNErrCode SUNDomEigEstimator_Destroy_Power(SUNDomEigEstimator* DEEptr) if (DEE->content) { /* delete items from within the content structure */ + if (PI_CONTENT(DEE)->Av) + { + N_VDestroy(PI_CONTENT(DEE)->Av); + PI_CONTENT(DEE)->Av = NULL; + } if (PI_CONTENT(DEE)->v_prev) { N_VDestroy(PI_CONTENT(DEE)->v_prev); From 8efd163c81bce3ff333267bfb9c0af7c506c5bd4 Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 22:07:47 -0500 Subject: [PATCH 12/23] formatting --- .../arnoldi/sundomeigest_arnoldi.c | 50 ++++++++----------- src/sundomeigest/power/sundomeigest_power.c | 49 ++++++++---------- 2 files changed, 43 insertions(+), 56 deletions(-) diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 2c27f4c6ec..6e0c80ad55 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -286,13 +286,13 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) sunindextype info = 0; sunindextype lwork = -1; sunrealtype work = SUN_RCONST(0.0); - sunrealtype* A = Arnoldi_CONTENT(DEE)->LAPACK_A; - sunrealtype* wr = Arnoldi_CONTENT(DEE)->LAPACK_wr; - sunrealtype* wi = Arnoldi_CONTENT(DEE)->LAPACK_wi; - N_Vector V = Arnoldi_CONTENT(DEE)->V[0]; + sunrealtype* A = Arnoldi_CONTENT(DEE)->LAPACK_A; + sunrealtype* wr = Arnoldi_CONTENT(DEE)->LAPACK_wr; + sunrealtype* wi = Arnoldi_CONTENT(DEE)->LAPACK_wi; + N_Vector V = Arnoldi_CONTENT(DEE)->V[0]; - xgeev_f77(&jobvl, &jobvr, &N, A, &lda, wr, wi, - NULL, &ldvl, NULL, &ldvr, &work, &lwork, &info); + xgeev_f77(&jobvl, &jobvr, &N, A, &lda, wr, wi, NULL, &ldvl, NULL, &ldvr, + &work, &lwork, &info); /* The workspace size is returned as the first entry of the work array */ Arnoldi_CONTENT(DEE)->LAPACK_lwork = (sunindextype)work; @@ -407,25 +407,25 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, SUNAssert(Arnoldi_CONTENT(DEE)->Hes, SUN_ERR_ARG_CORRUPT); int retval; - int *num_warmups = &(Arnoldi_CONTENT(DEE)->num_warmups); - sunindextype n = Arnoldi_CONTENT(DEE)->kry_dim; + int* num_warmups = &(Arnoldi_CONTENT(DEE)->num_warmups); + sunindextype n = Arnoldi_CONTENT(DEE)->kry_dim; sunrealtype normAv; - long int *num_ATimes = &(Arnoldi_CONTENT(DEE)->num_ATimes); - long int *num_iters = &(Arnoldi_CONTENT(DEE)->num_iters); - *num_ATimes = 0; - *num_iters = 0; + long int* num_ATimes = &(Arnoldi_CONTENT(DEE)->num_ATimes); + long int* num_iters = &(Arnoldi_CONTENT(DEE)->num_iters); + *num_ATimes = 0; + *num_iters = 0; - N_Vector *V = Arnoldi_CONTENT(DEE)->V; + N_Vector* V = Arnoldi_CONTENT(DEE)->V; N_Vector Av = V[1]; sunrealtype** Hes = Arnoldi_CONTENT(DEE)->Hes; SUNATimesFn ATimes = Arnoldi_CONTENT(DEE)->ATimes; - void *ATdata = Arnoldi_CONTENT(DEE)->ATdata; + void* ATdata = Arnoldi_CONTENT(DEE)->ATdata; - sunrealtype* A = Arnoldi_CONTENT(DEE)->LAPACK_A; - sunrealtype* wr = Arnoldi_CONTENT(DEE)->LAPACK_wr; - sunrealtype* wi = Arnoldi_CONTENT(DEE)->LAPACK_wi; + sunrealtype* A = Arnoldi_CONTENT(DEE)->LAPACK_A; + sunrealtype* wr = Arnoldi_CONTENT(DEE)->LAPACK_wr; + sunrealtype* wi = Arnoldi_CONTENT(DEE)->LAPACK_wi; sunrealtype** arr = Arnoldi_CONTENT(DEE)->LAPACK_arr; sunrealtype res; @@ -472,13 +472,10 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, (*num_iters)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } - SUNCheckCall(SUNModifiedGS(V, - Hes, i + 1, (int)n, - &(Hes[i + 1][i]))); + SUNCheckCall(SUNModifiedGS(V, Hes, i + 1, (int)n, &(Hes[i + 1][i]))); /* Unitize the computed orthogonal vector */ - N_VScale(SUN_RCONST(1.0) / Hes[i + 1][i], - V[i + 1], V[i + 1]); + N_VScale(SUN_RCONST(1.0) / Hes[i + 1][i], V[i + 1], V[i + 1]); SUNCheckLastErr(); } @@ -510,10 +507,8 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, sunindextype ldvr = n; sunindextype info; sunindextype lwork = Arnoldi_CONTENT(DEE)->LAPACK_lwork; - xgeev_f77(&jobvl, &jobvr, &n, A, &lda, - wr, wi, - NULL, &ldvl, NULL, &ldvr, Arnoldi_CONTENT(DEE)->LAPACK_work, &lwork, - &info); + xgeev_f77(&jobvl, &jobvr, &n, A, &lda, wr, wi, NULL, &ldvl, NULL, &ldvr, + Arnoldi_CONTENT(DEE)->LAPACK_work, &lwork, &info); if (info != 0) { return SUN_ERR_EXT_FAIL; } @@ -525,8 +520,7 @@ SUNErrCode SUNDomEigEstimator_Estimate_Arnoldi(SUNDomEigEstimator DEE, } /* Sort the array using qsort */ - qsort(arr, n, - sizeof(arr[0]), sundomeigest_Compare); + qsort(arr, n, sizeof(arr[0]), sundomeigest_Compare); /* Substitute the ordered eigenvalues back in LAPACK_w* */ for (int i = 0; i < n; i++) diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 2dc889e890..30f3482ef2 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -391,25 +391,22 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, sunbooleantype is_complex = PI_CONTENT(DEE)->is_complex; - if (is_complex) - { - SUNAssert(PI_CONTENT(DEE)->v_prev, SUN_ERR_ARG_CORRUPT); - } + if (is_complex) { SUNAssert(PI_CONTENT(DEE)->v_prev, SUN_ERR_ARG_CORRUPT); } - N_Vector Av = PI_CONTENT(DEE)->Av; - N_Vector V = PI_CONTENT(DEE)->V; + N_Vector Av = PI_CONTENT(DEE)->Av; + N_Vector V = PI_CONTENT(DEE)->V; N_Vector v_prev = PI_CONTENT(DEE)->v_prev; int num_warmups = PI_CONTENT(DEE)->num_warmups; - long int *num_ATimes = &(PI_CONTENT(DEE)->num_ATimes); - long int *num_iters = &(PI_CONTENT(DEE)->num_iters); - long int max_iters = PI_CONTENT(DEE)->max_iters; + long int* num_ATimes = &(PI_CONTENT(DEE)->num_ATimes); + long int* num_iters = &(PI_CONTENT(DEE)->num_iters); + long int max_iters = PI_CONTENT(DEE)->max_iters; sunrealtype rel_tol = PI_CONTENT(DEE)->rel_tol; - sunrealtype *res = &(PI_CONTENT(DEE)->res); + sunrealtype* res = &(PI_CONTENT(DEE)->res); - void *ATdata = PI_CONTENT(DEE)->ATdata; + void* ATdata = PI_CONTENT(DEE)->ATdata; SUNATimesFn ATimes = PI_CONTENT(DEE)->ATimes; @@ -425,8 +422,7 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, /* Set the initial q = A^{num_warmups}q/||A^{num_warmups}q|| */ for (int i = 0; i < num_warmups; i++) { - retval = ATimes(ATdata, - V, Av); + retval = ATimes(ATdata, V, Av); (*num_ATimes)++; (*num_iters)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } @@ -447,8 +443,7 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, SUNCheckLastErr(); } - retval = ATimes(ATdata, - V, Av); + retval = ATimes(ATdata, V, Av); (*num_ATimes)++; (*num_iters)++; if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } @@ -456,9 +451,8 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, newlambdaR = N_VDotProd(V, Av); //Rayleigh quotient SUNCheckLastErr(); - *res = SUNRabs(newlambdaR - oldlambdaR); - converged = - (*res <= rel_tol * SUNRabs(newlambdaR)); + *res = SUNRabs(newlambdaR - oldlambdaR); + converged = (*res <= rel_tol * SUNRabs(newlambdaR)); if (converged && !is_complex) { break; } @@ -477,9 +471,8 @@ SUNErrCode SUNDomEigEstimator_Estimate_Power(SUNDomEigEstimator DEE, if (is_complex) { retval = sundomeigestimator_complex_dom_eigs_from_PI(DEE, newlambdaR, normw, - v_prev, - V, - lambdaR, lambdaI); + v_prev, V, lambdaR, + lambdaI); if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } } else @@ -581,11 +574,11 @@ SUNErrCode sundomeigestimator_complex_dom_eigs_from_PI( SUNFunctionBegin(DEE->sunctx); int retval; - N_Vector Av = PI_CONTENT(DEE)->Av; - SUNATimesFn ATimes = PI_CONTENT(DEE)->ATimes; - void* ATdata = PI_CONTENT(DEE)->ATdata; - sunrealtype rel_tol = PI_CONTENT(DEE)->rel_tol; - long int *num_ATimes = &(PI_CONTENT(DEE)->num_ATimes); + N_Vector Av = PI_CONTENT(DEE)->Av; + SUNATimesFn ATimes = PI_CONTENT(DEE)->ATimes; + void* ATdata = PI_CONTENT(DEE)->ATdata; + sunrealtype rel_tol = PI_CONTENT(DEE)->rel_tol; + long int* num_ATimes = &(PI_CONTENT(DEE)->num_ATimes); sunrealtype cos_qs, gram_det, det_G_inv, h11, h12, h22, p11, p12, p21, p22; /* The threshold for identifying real or complex DEE is experimentally @@ -762,11 +755,11 @@ SUNErrCode dee_DQJtimes_Power(void* voidstarDEE, N_Vector v, N_Vector Jv) N_Vector Fy = PI_CONTENT(DEE)->Fy; SUNRhsFn rhsfn = PI_CONTENT(DEE)->rhsfn; - void *rhs_data = PI_CONTENT(DEE)->rhs_data; + void* rhs_data = PI_CONTENT(DEE)->rhs_data; sunrealtype rhs_linT = PI_CONTENT(DEE)->rhs_linT; - long int *nfevals = &(PI_CONTENT(DEE)->nfevals); + long int* nfevals = &(PI_CONTENT(DEE)->nfevals); retval = rhsfn(rhs_linT, y, Fy, rhs_data); (*nfevals)++; From 6e51c9e8f3e1f219441a729ba05708e072012bbf Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 22:17:00 -0500 Subject: [PATCH 13/23] swig --- .../fmod_int32/fsundomeigest_arnoldi_mod.c | 24 ---------- .../fmod_int32/fsundomeigest_arnoldi_mod.f90 | 44 ----------------- .../fmod_int64/fsundomeigest_arnoldi_mod.c | 24 ---------- .../fmod_int64/fsundomeigest_arnoldi_mod.f90 | 44 ----------------- .../fmod_int32/fsundomeigest_power_mod.c | 24 +++++----- .../fmod_int32/fsundomeigest_power_mod.f90 | 48 +++++++++---------- .../fmod_int64/fsundomeigest_power_mod.c | 24 +++++----- .../fmod_int64/fsundomeigest_power_mod.f90 | 48 +++++++++---------- 8 files changed, 72 insertions(+), 208 deletions(-) diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c index 37994780aa..b17f88f65e 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c @@ -372,30 +372,6 @@ SWIGEXPORT void * _wrap_SUNDomEigEstimatorContent_Arnoldi__V_get(SwigClassWrappe } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__q_set(SwigClassWrapper const *farg1, N_Vector farg2) { - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - N_Vector arg2 = (N_Vector) 0 ; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::q", return ); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - arg2 = (N_Vector)(farg2); - if (arg1) (arg1)->q = arg2; -} - - -SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Arnoldi__q_get(SwigClassWrapper const *farg1) { - N_Vector fresult ; - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - N_Vector result; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::q", return 0); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - result = (N_Vector) ((arg1)->q); - fresult = result; - return fresult; -} - - SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set(SwigClassWrapper const *farg1, N_Vector farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; N_Vector arg2 = (N_Vector) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 index 8edafe1f65..5056cb0b07 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 @@ -46,8 +46,6 @@ module fsundomeigest_arnoldi_mod procedure :: get_ATdata => swigf_SUNDomEigEstimatorContent_Arnoldi__ATdata_get procedure :: set_V => swigf_SUNDomEigEstimatorContent_Arnoldi__V_set procedure :: get_V => swigf_SUNDomEigEstimatorContent_Arnoldi__V_get - procedure :: set_q => swigf_SUNDomEigEstimatorContent_Arnoldi__q_set - procedure :: get_q => swigf_SUNDomEigEstimatorContent_Arnoldi__q_get procedure :: set_rhs_linY => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set procedure :: get_rhs_linY => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_get procedure :: set_Fy => swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_set @@ -163,23 +161,6 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__V_get(farg1) & type(C_PTR) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__q_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__q_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR), value :: farg2 -end subroutine - -function swigc_SUNDomEigEstimatorContent_Arnoldi__q_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__q_get") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult -end function - subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set") use, intrinsic :: ISO_C_BINDING @@ -752,31 +733,6 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__V_get(self) & swig_result = fresult end function -subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__q_set(self, q) -use, intrinsic :: ISO_C_BINDING -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -type(N_Vector), target, intent(inout) :: q -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: farg2 - -farg1 = self%swigdata -farg2 = c_loc(q) -call swigc_SUNDomEigEstimatorContent_Arnoldi__q_set(farg1, farg2) -end subroutine - -function swigf_SUNDomEigEstimatorContent_Arnoldi__q_get(self) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -type(N_Vector), pointer :: swig_result -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -type(C_PTR) :: fresult -type(SwigClassWrapper) :: farg1 - -farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__q_get(farg1) -call c_f_pointer(fresult, swig_result) -end function - subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set(self, rhs_liny) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c index 6cc33c49a7..a9915a6f43 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c @@ -372,30 +372,6 @@ SWIGEXPORT void * _wrap_SUNDomEigEstimatorContent_Arnoldi__V_get(SwigClassWrappe } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__q_set(SwigClassWrapper const *farg1, N_Vector farg2) { - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - N_Vector arg2 = (N_Vector) 0 ; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::q", return ); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - arg2 = (N_Vector)(farg2); - if (arg1) (arg1)->q = arg2; -} - - -SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Arnoldi__q_get(SwigClassWrapper const *farg1) { - N_Vector fresult ; - struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; - N_Vector result; - - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::q", return 0); - arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); - result = (N_Vector) ((arg1)->q); - fresult = result; - return fresult; -} - - SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set(SwigClassWrapper const *farg1, N_Vector farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; N_Vector arg2 = (N_Vector) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 index 85861d0a3c..e5dfbcc8fe 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 @@ -46,8 +46,6 @@ module fsundomeigest_arnoldi_mod procedure :: get_ATdata => swigf_SUNDomEigEstimatorContent_Arnoldi__ATdata_get procedure :: set_V => swigf_SUNDomEigEstimatorContent_Arnoldi__V_set procedure :: get_V => swigf_SUNDomEigEstimatorContent_Arnoldi__V_get - procedure :: set_q => swigf_SUNDomEigEstimatorContent_Arnoldi__q_set - procedure :: get_q => swigf_SUNDomEigEstimatorContent_Arnoldi__q_get procedure :: set_rhs_linY => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set procedure :: get_rhs_linY => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_get procedure :: set_Fy => swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_set @@ -163,23 +161,6 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__V_get(farg1) & type(C_PTR) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__q_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__q_set") -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR), value :: farg2 -end subroutine - -function swigc_SUNDomEigEstimatorContent_Arnoldi__q_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__q_get") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigclasswrapper -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: fresult -end function - subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set") use, intrinsic :: ISO_C_BINDING @@ -752,31 +733,6 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__V_get(self) & swig_result = fresult end function -subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__q_set(self, q) -use, intrinsic :: ISO_C_BINDING -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -type(N_Vector), target, intent(inout) :: q -type(SwigClassWrapper) :: farg1 -type(C_PTR) :: farg2 - -farg1 = self%swigdata -farg2 = c_loc(q) -call swigc_SUNDomEigEstimatorContent_Arnoldi__q_set(farg1, farg2) -end subroutine - -function swigf_SUNDomEigEstimatorContent_Arnoldi__q_get(self) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -type(N_Vector), pointer :: swig_result -class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self -type(C_PTR) :: fresult -type(SwigClassWrapper) :: farg1 - -farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__q_get(farg1) -call c_f_pointer(fresult, swig_result) -end function - subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linY_set(self, rhs_liny) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c index 324db92a27..c62b7c3670 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c @@ -372,49 +372,49 @@ SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__V_get(SwigClassWrappe } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__q_set(SwigClassWrapper const *farg1, N_Vector farg2) { +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__Av_set(SwigClassWrapper const *farg1, N_Vector farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector arg2 = (N_Vector) 0 ; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q", return ); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Av", return ); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); arg2 = (N_Vector)(farg2); - if (arg1) (arg1)->q = arg2; + if (arg1) (arg1)->Av = arg2; } -SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__q_get(SwigClassWrapper const *farg1) { +SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__Av_get(SwigClassWrapper const *farg1) { N_Vector fresult ; struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector result; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q", return 0); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Av", return 0); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - result = (N_Vector) ((arg1)->q); + result = (N_Vector) ((arg1)->Av); fresult = result; return fresult; } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__q_prev_set(SwigClassWrapper const *farg1, N_Vector farg2) { +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__v_prev_set(SwigClassWrapper const *farg1, N_Vector farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector arg2 = (N_Vector) 0 ; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q_prev", return ); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::v_prev", return ); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); arg2 = (N_Vector)(farg2); - if (arg1) (arg1)->q_prev = arg2; + if (arg1) (arg1)->v_prev = arg2; } -SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__q_prev_get(SwigClassWrapper const *farg1) { +SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__v_prev_get(SwigClassWrapper const *farg1) { N_Vector fresult ; struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector result; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q_prev", return 0); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::v_prev", return 0); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - result = (N_Vector) ((arg1)->q_prev); + result = (N_Vector) ((arg1)->v_prev); fresult = result; return fresult; } diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 index 41b78edd03..a09b7a1e9d 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 @@ -46,10 +46,10 @@ module fsundomeigest_power_mod procedure :: get_ATdata => swigf_SUNDomEigEstimatorContent_Power__ATdata_get procedure :: set_V => swigf_SUNDomEigEstimatorContent_Power__V_set procedure :: get_V => swigf_SUNDomEigEstimatorContent_Power__V_get - procedure :: set_q => swigf_SUNDomEigEstimatorContent_Power__q_set - procedure :: get_q => swigf_SUNDomEigEstimatorContent_Power__q_get - procedure :: set_q_prev => swigf_SUNDomEigEstimatorContent_Power__q_prev_set - procedure :: get_q_prev => swigf_SUNDomEigEstimatorContent_Power__q_prev_get + procedure :: set_Av => swigf_SUNDomEigEstimatorContent_Power__Av_set + procedure :: get_Av => swigf_SUNDomEigEstimatorContent_Power__Av_get + procedure :: set_v_prev => swigf_SUNDomEigEstimatorContent_Power__v_prev_set + procedure :: get_v_prev => swigf_SUNDomEigEstimatorContent_Power__v_prev_get procedure :: set_rhs_linY => swigf_SUNDomEigEstimatorContent_Power__rhs_linY_set procedure :: get_rhs_linY => swigf_SUNDomEigEstimatorContent_Power__rhs_linY_get procedure :: set_Fy => swigf_SUNDomEigEstimatorContent_Power__Fy_set @@ -156,16 +156,16 @@ function swigc_SUNDomEigEstimatorContent_Power__V_get(farg1) & type(C_PTR) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Power__q_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_set") +subroutine swigc_SUNDomEigEstimatorContent_Power__Av_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Av_set") use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper type(SwigClassWrapper) :: farg1 type(C_PTR), value :: farg2 end subroutine -function swigc_SUNDomEigEstimatorContent_Power__q_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_get") & +function swigc_SUNDomEigEstimatorContent_Power__Av_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Av_get") & result(fresult) use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper @@ -173,16 +173,16 @@ function swigc_SUNDomEigEstimatorContent_Power__q_get(farg1) & type(C_PTR) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Power__q_prev_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_prev_set") +subroutine swigc_SUNDomEigEstimatorContent_Power__v_prev_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__v_prev_set") use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper type(SwigClassWrapper) :: farg1 type(C_PTR), value :: farg2 end subroutine -function swigc_SUNDomEigEstimatorContent_Power__q_prev_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_prev_get") & +function swigc_SUNDomEigEstimatorContent_Power__v_prev_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__v_prev_get") & result(fresult) use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper @@ -688,19 +688,19 @@ function swigf_SUNDomEigEstimatorContent_Power__V_get(self) & call c_f_pointer(fresult, swig_result) end function -subroutine swigf_SUNDomEigEstimatorContent_Power__q_set(self, q) +subroutine swigf_SUNDomEigEstimatorContent_Power__Av_set(self, av) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -type(N_Vector), target, intent(inout) :: q +type(N_Vector), target, intent(inout) :: av type(SwigClassWrapper) :: farg1 type(C_PTR) :: farg2 farg1 = self%swigdata -farg2 = c_loc(q) -call swigc_SUNDomEigEstimatorContent_Power__q_set(farg1, farg2) +farg2 = c_loc(av) +call swigc_SUNDomEigEstimatorContent_Power__Av_set(farg1, farg2) end subroutine -function swigf_SUNDomEigEstimatorContent_Power__q_get(self) & +function swigf_SUNDomEigEstimatorContent_Power__Av_get(self) & result(swig_result) use, intrinsic :: ISO_C_BINDING type(N_Vector), pointer :: swig_result @@ -709,23 +709,23 @@ function swigf_SUNDomEigEstimatorContent_Power__q_get(self) & type(SwigClassWrapper) :: farg1 farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Power__q_get(farg1) +fresult = swigc_SUNDomEigEstimatorContent_Power__Av_get(farg1) call c_f_pointer(fresult, swig_result) end function -subroutine swigf_SUNDomEigEstimatorContent_Power__q_prev_set(self, q_prev) +subroutine swigf_SUNDomEigEstimatorContent_Power__v_prev_set(self, v_prev) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -type(N_Vector), target, intent(inout) :: q_prev +type(N_Vector), target, intent(inout) :: v_prev type(SwigClassWrapper) :: farg1 type(C_PTR) :: farg2 farg1 = self%swigdata -farg2 = c_loc(q_prev) -call swigc_SUNDomEigEstimatorContent_Power__q_prev_set(farg1, farg2) +farg2 = c_loc(v_prev) +call swigc_SUNDomEigEstimatorContent_Power__v_prev_set(farg1, farg2) end subroutine -function swigf_SUNDomEigEstimatorContent_Power__q_prev_get(self) & +function swigf_SUNDomEigEstimatorContent_Power__v_prev_get(self) & result(swig_result) use, intrinsic :: ISO_C_BINDING type(N_Vector), pointer :: swig_result @@ -734,7 +734,7 @@ function swigf_SUNDomEigEstimatorContent_Power__q_prev_get(self) & type(SwigClassWrapper) :: farg1 farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Power__q_prev_get(farg1) +fresult = swigc_SUNDomEigEstimatorContent_Power__v_prev_get(farg1) call c_f_pointer(fresult, swig_result) end function diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c index 324db92a27..c62b7c3670 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c @@ -372,49 +372,49 @@ SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__V_get(SwigClassWrappe } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__q_set(SwigClassWrapper const *farg1, N_Vector farg2) { +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__Av_set(SwigClassWrapper const *farg1, N_Vector farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector arg2 = (N_Vector) 0 ; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q", return ); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Av", return ); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); arg2 = (N_Vector)(farg2); - if (arg1) (arg1)->q = arg2; + if (arg1) (arg1)->Av = arg2; } -SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__q_get(SwigClassWrapper const *farg1) { +SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__Av_get(SwigClassWrapper const *farg1) { N_Vector fresult ; struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector result; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q", return 0); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Av", return 0); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - result = (N_Vector) ((arg1)->q); + result = (N_Vector) ((arg1)->Av); fresult = result; return fresult; } -SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__q_prev_set(SwigClassWrapper const *farg1, N_Vector farg2) { +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__v_prev_set(SwigClassWrapper const *farg1, N_Vector farg2) { struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector arg2 = (N_Vector) 0 ; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q_prev", return ); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::v_prev", return ); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); arg2 = (N_Vector)(farg2); - if (arg1) (arg1)->q_prev = arg2; + if (arg1) (arg1)->v_prev = arg2; } -SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__q_prev_get(SwigClassWrapper const *farg1) { +SWIGEXPORT N_Vector _wrap_SUNDomEigEstimatorContent_Power__v_prev_get(SwigClassWrapper const *farg1) { N_Vector fresult ; struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; N_Vector result; - SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::q_prev", return 0); + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::v_prev", return 0); arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); - result = (N_Vector) ((arg1)->q_prev); + result = (N_Vector) ((arg1)->v_prev); fresult = result; return fresult; } diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 index 41b78edd03..a09b7a1e9d 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 @@ -46,10 +46,10 @@ module fsundomeigest_power_mod procedure :: get_ATdata => swigf_SUNDomEigEstimatorContent_Power__ATdata_get procedure :: set_V => swigf_SUNDomEigEstimatorContent_Power__V_set procedure :: get_V => swigf_SUNDomEigEstimatorContent_Power__V_get - procedure :: set_q => swigf_SUNDomEigEstimatorContent_Power__q_set - procedure :: get_q => swigf_SUNDomEigEstimatorContent_Power__q_get - procedure :: set_q_prev => swigf_SUNDomEigEstimatorContent_Power__q_prev_set - procedure :: get_q_prev => swigf_SUNDomEigEstimatorContent_Power__q_prev_get + procedure :: set_Av => swigf_SUNDomEigEstimatorContent_Power__Av_set + procedure :: get_Av => swigf_SUNDomEigEstimatorContent_Power__Av_get + procedure :: set_v_prev => swigf_SUNDomEigEstimatorContent_Power__v_prev_set + procedure :: get_v_prev => swigf_SUNDomEigEstimatorContent_Power__v_prev_get procedure :: set_rhs_linY => swigf_SUNDomEigEstimatorContent_Power__rhs_linY_set procedure :: get_rhs_linY => swigf_SUNDomEigEstimatorContent_Power__rhs_linY_get procedure :: set_Fy => swigf_SUNDomEigEstimatorContent_Power__Fy_set @@ -156,16 +156,16 @@ function swigc_SUNDomEigEstimatorContent_Power__V_get(farg1) & type(C_PTR) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Power__q_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_set") +subroutine swigc_SUNDomEigEstimatorContent_Power__Av_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Av_set") use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper type(SwigClassWrapper) :: farg1 type(C_PTR), value :: farg2 end subroutine -function swigc_SUNDomEigEstimatorContent_Power__q_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_get") & +function swigc_SUNDomEigEstimatorContent_Power__Av_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Av_get") & result(fresult) use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper @@ -173,16 +173,16 @@ function swigc_SUNDomEigEstimatorContent_Power__q_get(farg1) & type(C_PTR) :: fresult end function -subroutine swigc_SUNDomEigEstimatorContent_Power__q_prev_set(farg1, farg2) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_prev_set") +subroutine swigc_SUNDomEigEstimatorContent_Power__v_prev_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__v_prev_set") use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper type(SwigClassWrapper) :: farg1 type(C_PTR), value :: farg2 end subroutine -function swigc_SUNDomEigEstimatorContent_Power__q_prev_get(farg1) & -bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__q_prev_get") & +function swigc_SUNDomEigEstimatorContent_Power__v_prev_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__v_prev_get") & result(fresult) use, intrinsic :: ISO_C_BINDING import :: swigclasswrapper @@ -688,19 +688,19 @@ function swigf_SUNDomEigEstimatorContent_Power__V_get(self) & call c_f_pointer(fresult, swig_result) end function -subroutine swigf_SUNDomEigEstimatorContent_Power__q_set(self, q) +subroutine swigf_SUNDomEigEstimatorContent_Power__Av_set(self, av) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -type(N_Vector), target, intent(inout) :: q +type(N_Vector), target, intent(inout) :: av type(SwigClassWrapper) :: farg1 type(C_PTR) :: farg2 farg1 = self%swigdata -farg2 = c_loc(q) -call swigc_SUNDomEigEstimatorContent_Power__q_set(farg1, farg2) +farg2 = c_loc(av) +call swigc_SUNDomEigEstimatorContent_Power__Av_set(farg1, farg2) end subroutine -function swigf_SUNDomEigEstimatorContent_Power__q_get(self) & +function swigf_SUNDomEigEstimatorContent_Power__Av_get(self) & result(swig_result) use, intrinsic :: ISO_C_BINDING type(N_Vector), pointer :: swig_result @@ -709,23 +709,23 @@ function swigf_SUNDomEigEstimatorContent_Power__q_get(self) & type(SwigClassWrapper) :: farg1 farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Power__q_get(farg1) +fresult = swigc_SUNDomEigEstimatorContent_Power__Av_get(farg1) call c_f_pointer(fresult, swig_result) end function -subroutine swigf_SUNDomEigEstimatorContent_Power__q_prev_set(self, q_prev) +subroutine swigf_SUNDomEigEstimatorContent_Power__v_prev_set(self, v_prev) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Power_), intent(in) :: self -type(N_Vector), target, intent(inout) :: q_prev +type(N_Vector), target, intent(inout) :: v_prev type(SwigClassWrapper) :: farg1 type(C_PTR) :: farg2 farg1 = self%swigdata -farg2 = c_loc(q_prev) -call swigc_SUNDomEigEstimatorContent_Power__q_prev_set(farg1, farg2) +farg2 = c_loc(v_prev) +call swigc_SUNDomEigEstimatorContent_Power__v_prev_set(farg1, farg2) end subroutine -function swigf_SUNDomEigEstimatorContent_Power__q_prev_get(self) & +function swigf_SUNDomEigEstimatorContent_Power__v_prev_get(self) & result(swig_result) use, intrinsic :: ISO_C_BINDING type(N_Vector), pointer :: swig_result @@ -734,7 +734,7 @@ function swigf_SUNDomEigEstimatorContent_Power__q_prev_get(self) & type(SwigClassWrapper) :: farg1 farg1 = self%swigdata -fresult = swigc_SUNDomEigEstimatorContent_Power__q_prev_get(farg1) +fresult = swigc_SUNDomEigEstimatorContent_Power__v_prev_get(farg1) call c_f_pointer(fresult, swig_result) end function From 7ef5c0741ca0d1d61bc211f323658fca6cd591bc Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 22:32:33 -0500 Subject: [PATCH 14/23] removed unused vector V --- src/sundomeigest/arnoldi/sundomeigest_arnoldi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 6e0c80ad55..e75615baae 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -289,7 +289,6 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) sunrealtype* A = Arnoldi_CONTENT(DEE)->LAPACK_A; sunrealtype* wr = Arnoldi_CONTENT(DEE)->LAPACK_wr; sunrealtype* wi = Arnoldi_CONTENT(DEE)->LAPACK_wi; - N_Vector V = Arnoldi_CONTENT(DEE)->V[0]; xgeev_f77(&jobvl, &jobvr, &N, A, &lda, wr, wi, NULL, &ldvl, NULL, &ldvr, &work, &lwork, &info); From 93eff5fe46cb0f58bfa2faf48ba8c08abdfbee2d Mon Sep 17 00:00:00 2001 From: maggul Date: Fri, 5 Jun 2026 23:15:55 -0500 Subject: [PATCH 15/23] fixed error check --- src/sundomeigest/power/sundomeigest_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 30f3482ef2..4c38a4a63b 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -297,7 +297,7 @@ SUNErrCode SUNDomEigEstimator_Initialize_Power(SUNDomEigEstimator DEE) if (PI_CONTENT(DEE)->is_complex) { - SUNAssert(PI_CONTENT(DEE)->v_prev == NULL, SUN_ERR_ARG_CORRUPT); + SUNAssert(PI_CONTENT(DEE)->v_prev, SUN_ERR_ARG_CORRUPT); } return SUN_SUCCESS; From cf1397edca7f1e8bb2d2b6f00b76f52a80f61d75 Mon Sep 17 00:00:00 2001 From: maggul Date: Sat, 6 Jun 2026 13:22:16 -0500 Subject: [PATCH 16/23] resolve merge conflicts --- src/sundomeigest/power/sundomeigest_power.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index c573f3d9be..4c38a4a63b 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -159,17 +159,8 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, content->v_prev = N_VClone(q); SUNCheckLastErrNull(); - - content->V = N_VClone(q); - SUNCheckLastErrNull(); - - /* Initialize the vector V */ - sunrealtype normq = N_VDotProd(q, q); - SUNCheckLastErrNull(); - - normq = SUNRsqrt(normq); - N_VScale(ONE / normq, q, PI_CONTENT(DEE)->V); + content->V = N_VClone(q); SUNCheckLastErrNull(); /* Initialize the vector V */ From ae9fe29aee1dfa770b42d011312645e9b596432c Mon Sep 17 00:00:00 2001 From: maggul Date: Sat, 6 Jun 2026 14:10:06 -0500 Subject: [PATCH 17/23] removed lsrkStep_DQJtimes and attached the step rhs to the DEE rhs --- src/arkode/arkode_lsrkstep.c | 92 +++---------------------------- src/arkode/arkode_lsrkstep_impl.h | 1 - src/arkode/arkode_lsrkstep_io.c | 6 +- 3 files changed, 12 insertions(+), 87 deletions(-) diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index 7a1aa6c9c8..c55489dfa5 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -2890,6 +2890,15 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) if (step_mem->DEE != NULL) { + retval = SUNDomEigEstimator_SetRhsLinearizationPoint(step_mem->DEE, + ark_mem->tn, + ark_mem->yn); + if (retval != SUN_SUCCESS) + { arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, + "SUNDomEigEstimator_SetRhsLinearizationPoint failed"); + return ARK_DEE_FAIL; + } + retval = SUNDomEigEstimator_Estimate(step_mem->DEE, &step_mem->lambdaR, &step_mem->lambdaI); step_mem->dom_eig_num_evals++; @@ -3230,89 +3239,6 @@ int lsrkStep_legendre_P_complex(int s, sunrealtype zR, sunrealtype zI, return ARK_SUCCESS; } -/*--------------------------------------------------------------- - lsrkStep_DQJtimes: - - This routine generates a difference quotient approximation to - the Jacobian-vector product f_y(t,y) * v. The approximation is - Jv = [f(y + v*sig) - f(y)]/sig, where sig = 1 / ||v||_WRMS, - i.e. the WRMS norm of v*sig is 1. - ---------------------------------------------------------------*/ -int lsrkStep_DQJtimes(void* arkode_mem, N_Vector v, N_Vector Jv) -{ - ARKodeMem ark_mem; - ARKodeLSRKStepMem step_mem; - - sunrealtype sig, siginv; - int iter, retval; - - /* access ARKodeLSRKStepMem structure */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, - &step_mem); - if (retval != ARK_SUCCESS) { return retval; } - - sunrealtype t = ark_mem->tn; - N_Vector y = ark_mem->yn; - N_Vector work = ark_mem->tempv3; - - /* Compute RHS function, if necessary. */ - if ((!ark_mem->fn_is_current && ark_mem->initsetup) || - (step_mem->step_nst != ark_mem->nst)) - { - /* call the user-supplied pre-RHS function (if supplied) */ - if (ark_mem->PreRhsFn) - { - retval = ark_mem->PreRhsFn(t, y, ark_mem->user_data); - if (retval != 0) { return ARK_PRERHSFN_FAIL; } - } - - retval = step_mem->fe(t, y, ark_mem->fn, ark_mem->user_data); - step_mem->nfeDQ++; - if (retval != ARK_SUCCESS) - { - SUNLogExtraDebugVec(ARK_LOGGER, "DomEig JvTimes RHS", ark_mem->fn, - "F_n(:) ="); - SUNLogInfo(ARK_LOGGER, "DomEig JvTimes", - "status = failed rhs eval, retval = %i", retval); - return (ARK_RHSFUNC_FAIL); - } - ark_mem->fn_is_current = SUNTRUE; - } - - /* Initialize perturbation to 1/||v|| */ - sig = ONE / N_VWrmsNorm(v, ark_mem->ewt); - - for (iter = 0; iter < MAX_DQITERS; iter++) - { - /* Set work = y + sig*v */ - N_VLinearSum(sig, v, ONE, y, work); - - /* call the user-supplied pre-RHS function (if supplied) */ - if (ark_mem->PreRhsFn) - { - retval = ark_mem->PreRhsFn(t, work, ark_mem->user_data); - if (retval != 0) { return ARK_PRERHSFN_FAIL; } - } - /* Set Jv = f(tn, y+sig*v) */ - retval = step_mem->fe(t, work, Jv, ark_mem->user_data); - step_mem->nfeDQ++; - if (retval == 0) { break; } - if (retval < 0) { return (-1); } - - /* If f failed recoverably, shrink sig and retry */ - sig *= SUN_RCONST(0.25); - } - - /* If retval still isn't 0, return with a recoverable failure */ - if (retval > 0) { return (+1); } - - /* Replace Jv by (Jv - fn)/sig */ - siginv = ONE / sig; - N_VLinearSum(siginv, Jv, -siginv, ark_mem->fn, Jv); - - return ARK_SUCCESS; -} - /*=============================================================== EOF ===============================================================*/ diff --git a/src/arkode/arkode_lsrkstep_impl.h b/src/arkode/arkode_lsrkstep_impl.h index 47e002e721..088fb54714 100644 --- a/src/arkode/arkode_lsrkstep_impl.h +++ b/src/arkode/arkode_lsrkstep_impl.h @@ -254,7 +254,6 @@ int lsrkStep_cheb_T_complex(int s, sunrealtype zR, sunrealtype zI, sunrealtype* TsR, sunrealtype* TsI); int lsrkStep_legendre_P_complex(int s, sunrealtype zR, sunrealtype zI, sunrealtype* PsR, sunrealtype* PsI); -int lsrkStep_DQJtimes(void* arkode_mem, N_Vector v, N_Vector Jv); /*=============================================================== Reusable LSRKStep Error Messages diff --git a/src/arkode/arkode_lsrkstep_io.c b/src/arkode/arkode_lsrkstep_io.c index eb1d6a1820..5f72be15ab 100644 --- a/src/arkode/arkode_lsrkstep_io.c +++ b/src/arkode/arkode_lsrkstep_io.c @@ -553,12 +553,12 @@ int LSRKStepSetDomEigEstimator(void* arkode_mem, SUNDomEigEstimator DEE) /* Attach the DEE pointer to the step memory */ step_mem->DEE = DEE; - /* Set the ATimes function for the DEE with A_data = arkode_mem */ - retval = SUNDomEigEstimator_SetATimes(DEE, arkode_mem, lsrkStep_DQJtimes); + /* Set the RHS function for the DEE with user_data */ + retval = SUNDomEigEstimator_SetRhs(DEE, ark_mem->user_data, step_mem->fe); if (retval != SUN_SUCCESS) { arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, - "SUNDomEigEstimator_SetATimes failed"); + "SUNDomEigEstimator_SetRhs failed"); return ARK_DEE_FAIL; } From 726a49b9f7406675151a5276afe5455318f81b8e Mon Sep 17 00:00:00 2001 From: maggul Date: Sat, 6 Jun 2026 14:22:23 -0500 Subject: [PATCH 18/23] formatting --- src/arkode/arkode_lsrkstep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index c55489dfa5..1c0f889030 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -2894,8 +2894,9 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) ark_mem->tn, ark_mem->yn); if (retval != SUN_SUCCESS) - { arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, - "SUNDomEigEstimator_SetRhsLinearizationPoint failed"); + { + arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, + "SUNDomEigEstimator_SetRhsLinearizationPoint failed"); return ARK_DEE_FAIL; } From b68b8c8d44f5290dedd1bcf2696dfea4c2cbbfd3 Mon Sep 17 00:00:00 2001 From: maggul Date: Sat, 6 Jun 2026 15:42:22 -0500 Subject: [PATCH 19/23] nfeDQ update --- src/arkode/arkode_lsrkstep.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index 1c0f889030..9bba8f36c3 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -2911,6 +2911,7 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) } long int num_iters; + long int nfeDQ; retval = SUNDomEigEstimator_GetNumIters(step_mem->DEE, &num_iters); if (retval != SUN_SUCCESS) { @@ -2920,6 +2921,15 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) } step_mem->num_dee_iters += num_iters; + retval = SUNDomEigEstimator_GetNumRhsEvals(step_mem->DEE, &nfeDQ); + if (retval != SUN_SUCCESS) + { + arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, + "SUNDomEigEstimator_GetNumRhsEvals failed"); + return ARK_DEE_FAIL; + } + step_mem->nfeDQ += nfeDQ; + /* After the first call to SUNDomEigEstimator_Estimate, the number of warmups is set to num_warmups, this allows the successive calls to SUNDomEigEstimator_Estimate to use a different number of warmups. */ From 439560d5aac6c96f0acb4be597b652b8da5eb06d Mon Sep 17 00:00:00 2001 From: maggul Date: Sat, 6 Jun 2026 15:49:18 -0500 Subject: [PATCH 20/23] Number of fe calls for DEE, number increased since DEE don't know if fn_is_current --- src/arkode/arkode_lsrkstep.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index 9bba8f36c3..dd71bddc3a 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -2911,7 +2911,6 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) } long int num_iters; - long int nfeDQ; retval = SUNDomEigEstimator_GetNumIters(step_mem->DEE, &num_iters); if (retval != SUN_SUCCESS) { @@ -2921,14 +2920,13 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) } step_mem->num_dee_iters += num_iters; - retval = SUNDomEigEstimator_GetNumRhsEvals(step_mem->DEE, &nfeDQ); + retval = SUNDomEigEstimator_GetNumRhsEvals(step_mem->DEE, &(step_mem->nfeDQ)); if (retval != SUN_SUCCESS) { arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, "SUNDomEigEstimator_GetNumRhsEvals failed"); return ARK_DEE_FAIL; } - step_mem->nfeDQ += nfeDQ; /* After the first call to SUNDomEigEstimator_Estimate, the number of warmups is set to num_warmups, this allows the successive calls to From 0aa3f543441a57e0d20a3384e1229952fd4505e7 Mon Sep 17 00:00:00 2001 From: maggul Date: Sat, 6 Jun 2026 22:49:28 -0500 Subject: [PATCH 21/23] pass fn to DEE if fn_is_current --- include/sundials/sundials_domeigestimator.h | 6 ++ include/sundomeigest/sundomeigest_arnoldi.h | 5 ++ include/sundomeigest/sundomeigest_power.h | 5 ++ src/arkode/arkode_lsrkstep.c | 12 +++ src/sundials/sundials_domeigestimator.c | 11 +++ .../arnoldi/sundomeigest_arnoldi.c | 89 +++++++++++++------ src/sundomeigest/power/sundomeigest_power.c | 78 +++++++++++----- 7 files changed, 159 insertions(+), 47 deletions(-) diff --git a/include/sundials/sundials_domeigestimator.h b/include/sundials/sundials_domeigestimator.h index a7b4be5d6a..1f3f5e3212 100644 --- a/include/sundials/sundials_domeigestimator.h +++ b/include/sundials/sundials_domeigestimator.h @@ -52,6 +52,8 @@ struct SUNDomEigEstimator_Ops_ SUNErrCode (*setrhs)(SUNDomEigEstimator, void*, SUNRhsFn); SUNErrCode (*setrhslinearizationpoint)(SUNDomEigEstimator, sunrealtype, N_Vector); + SUNErrCode (*setrhsatlinearizationpoint)(SUNDomEigEstimator, + N_Vector); SUNErrCode (*setoptions)(SUNDomEigEstimator DEE, const char* Did, const char* file_name, int argc, char* argv[]); SUNErrCode (*setmaxiters)(SUNDomEigEstimator, long int); @@ -101,6 +103,10 @@ SUNDIALS_EXPORT SUNErrCode SUNDomEigEstimator_SetRhsLinearizationPoint(SUNDomEigEstimator DEE, sunrealtype t, N_Vector v); +SUNDIALS_EXPORT +SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint(SUNDomEigEstimator DEE, + N_Vector Fyt); + SUNDIALS_EXPORT SUNErrCode SUNDomEigEstimator_SetOptions(SUNDomEigEstimator DEE, const char* Did, const char* file_name, diff --git a/include/sundomeigest/sundomeigest_arnoldi.h b/include/sundomeigest/sundomeigest_arnoldi.h index 0a2aafa9d7..9b925d40fb 100644 --- a/include/sundomeigest/sundomeigest_arnoldi.h +++ b/include/sundomeigest/sundomeigest_arnoldi.h @@ -49,6 +49,7 @@ struct SUNDomEigEstimatorContent_Arnoldi_ int num_warmups; /* Number of preprocessing iterations */ long int num_iters; /* Number of iterations in last Estimate call */ sunbooleantype warmup_to_tol; /* Whether to use warmup iterations */ + sunbooleantype Fy_is_current; /* Flag to track if Fy is current */ sunrealtype tol_warmup; /* Tolerance for warmup iterations */ sunrealtype rhs_linT; /* Time value for linearization point */ @@ -90,6 +91,10 @@ SUNDIALS_EXPORT SUNErrCode SUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi( SUNDomEigEstimator DEE, sunrealtype t, N_Vector v); +SUNDIALS_EXPORT +SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(SUNDomEigEstimator DEE, + N_Vector Fyt); + SUNDIALS_EXPORT SUNErrCode SUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(SUNDomEigEstimator DEE, int num_iters); diff --git a/include/sundomeigest/sundomeigest_power.h b/include/sundomeigest/sundomeigest_power.h index f9e10a4b74..23078600ca 100644 --- a/include/sundomeigest/sundomeigest_power.h +++ b/include/sundomeigest/sundomeigest_power.h @@ -58,6 +58,7 @@ struct SUNDomEigEstimatorContent_Power_ long int nfevals; /* Number of RHS evaluations */ sunbooleantype is_complex; /* Flag for complex eigenvalue request */ + sunbooleantype Fy_is_current; /* Flag to track if Fy is current */ }; typedef struct SUNDomEigEstimatorContent_Power_* SUNDomEigEstimatorContent_Power; @@ -99,6 +100,10 @@ SUNDIALS_EXPORT SUNErrCode SUNDomEigEstimator_SetRhsLinearizationPoint_Power( SUNDomEigEstimator DEE, sunrealtype t, N_Vector v); +SUNDIALS_EXPORT +SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint_Power( + SUNDomEigEstimator DEE, N_Vector Fyt); + SUNDIALS_EXPORT SUNErrCode SUNDomEigEstimator_SetIsReal_Power(SUNDomEigEstimator DEE, sunbooleantype real); diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index dd71bddc3a..2366db360c 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -2900,6 +2900,18 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) return ARK_DEE_FAIL; } + /* Pass the current RHS vector fn to the dominant eigenvalue estimator */ + if (ark_mem->fn_is_current == SUNTRUE) + { + retval = SUNDomEigEstimator_SetRhsAtLinearizationPoint(step_mem->DEE, ark_mem->fn); + if (retval != SUN_SUCCESS) + { + arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, + "SUNDomEigEstimator_SetRhsAtLinearizationPoint failed"); + return ARK_DEE_FAIL; + } + } + retval = SUNDomEigEstimator_Estimate(step_mem->DEE, &step_mem->lambdaR, &step_mem->lambdaI); step_mem->dom_eig_num_evals++; diff --git a/src/sundials/sundials_domeigestimator.c b/src/sundials/sundials_domeigestimator.c index e8e92851c7..5fb47bfa6b 100644 --- a/src/sundials/sundials_domeigestimator.c +++ b/src/sundials/sundials_domeigestimator.c @@ -223,6 +223,17 @@ SUNErrCode SUNDomEigEstimator_SetRhsLinearizationPoint(SUNDomEigEstimator DEE, return (ier); } +SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint(SUNDomEigEstimator DEE, + N_Vector Fyt) +{ + SUNErrCode ier; + SUNDIALS_MARK_FUNCTION_BEGIN(getSUNProfiler(DEE)); + if (DEE->ops->setrhsatlinearizationpoint) { ier = DEE->ops->setrhsatlinearizationpoint(DEE, Fyt); } + else { ier = SUN_SUCCESS; } + SUNDIALS_MARK_FUNCTION_END(getSUNProfiler(DEE)); + return (ier); +} + SUNErrCode SUNDomEigEstimator_SetOptions(SUNDomEigEstimator DEE, const char* Did, const char* file_name, int argc, char* argv[]) diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index e75615baae..360437bbde 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -113,6 +113,8 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, DEE->ops->setrhs = SUNDomEigEstimator_SetRhs_Arnoldi; DEE->ops->setrhslinearizationpoint = SUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi; + DEE->ops->setrhsatlinearizationpoint = + SUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi; DEE->ops->setnumpreprocessiters = SUNDomEigEstimator_SetNumPreprocessIters_Arnoldi; DEE->ops->setreltol = SUNDomEigEstimator_SetRelTol_Arnoldi; @@ -146,6 +148,7 @@ SUNDomEigEstimator SUNDomEigEstimator_Arnoldi(N_Vector q, int kry_dim, content->num_iters = 0; content->num_ATimes = 0; content->warmup_to_tol = SUNFALSE; + content->Fy_is_current = SUNFALSE; content->tol_warmup = DEE_TOL_OF_WARMUPS_ARNOLDI_DEFAULT; content->rhsfn = NULL; content->rhs_data = NULL; @@ -237,50 +240,74 @@ SUNErrCode SUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi( return SUN_SUCCESS; } -SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) +SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi( + SUNDomEigEstimator DEE, N_Vector Fyt) { SUNFunctionBegin(DEE->sunctx); SUNAssert(DEE, SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE), SUN_ERR_ARG_CORRUPT); + SUNAssert(Fyt, SUN_ERR_ARG_CORRUPT); - if (Arnoldi_CONTENT(DEE)->kry_dim < 2) - { - Arnoldi_CONTENT(DEE)->kry_dim = DEE_KRYLOV_DIM_DEFAULT; - } - if (Arnoldi_CONTENT(DEE)->num_warmups < 0) + if (Arnoldi_CONTENT(DEE)->Fy == NULL) { - Arnoldi_CONTENT(DEE)->num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; + Arnoldi_CONTENT(DEE)->Fy = N_VClone(Fyt); + SUNCheckLastErr(); } + N_VScale(ONE, Fyt, Arnoldi_CONTENT(DEE)->Fy); + SUNCheckLastErr(); + + Arnoldi_CONTENT(DEE)->Fy_is_current = SUNTRUE; + + return SUN_SUCCESS; +} + +SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) +{ + SUNFunctionBegin(DEE->sunctx); + + SUNAssert(DEE, SUN_ERR_ARG_CORRUPT); + SUNAssert(Arnoldi_CONTENT(DEE), SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE)->ATimes, SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); + int *kry_dim = &(Arnoldi_CONTENT(DEE)->kry_dim); + int *num_warmups = &(Arnoldi_CONTENT(DEE)->num_warmups); + + if (*kry_dim < 2) + { + *kry_dim = DEE_KRYLOV_DIM_DEFAULT; + } + if (*num_warmups < 0) + { + *num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; + } + if (Arnoldi_CONTENT(DEE)->LAPACK_A == NULL) { Arnoldi_CONTENT(DEE)->LAPACK_A = (sunrealtype*)malloc( - (Arnoldi_CONTENT(DEE)->kry_dim * Arnoldi_CONTENT(DEE)->kry_dim) * - sizeof(sunrealtype)); + (*kry_dim * *kry_dim) * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_A, SUN_ERR_MALLOC_FAIL); } if (Arnoldi_CONTENT(DEE)->LAPACK_wr == NULL) { Arnoldi_CONTENT(DEE)->LAPACK_wr = - malloc(Arnoldi_CONTENT(DEE)->kry_dim * sizeof(sunrealtype)); + malloc(*kry_dim * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_wr, SUN_ERR_MALLOC_FAIL); } if (Arnoldi_CONTENT(DEE)->LAPACK_wi == NULL) { Arnoldi_CONTENT(DEE)->LAPACK_wi = - malloc(Arnoldi_CONTENT(DEE)->kry_dim * sizeof(sunrealtype)); + malloc(*kry_dim * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_wi, SUN_ERR_MALLOC_FAIL); } /* query the workspace size (call with lwork = -1) */ char jobvl = 'N'; char jobvr = 'N'; - sunindextype N = Arnoldi_CONTENT(DEE)->kry_dim; - sunindextype lda = Arnoldi_CONTENT(DEE)->kry_dim; + sunindextype N = *kry_dim; + sunindextype lda = *kry_dim; sunindextype ldvl = 1; sunindextype ldvr = 1; sunindextype info = 0; @@ -297,12 +324,12 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) Arnoldi_CONTENT(DEE)->LAPACK_lwork = (sunindextype)work; Arnoldi_CONTENT(DEE)->LAPACK_work = (sunrealtype*)malloc( - Arnoldi_CONTENT(DEE)->LAPACK_lwork * sizeof(sunrealtype)); + ((sunindextype)work) * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_work, SUN_ERR_MALLOC_FAIL); /* LAPACK array */ Arnoldi_CONTENT(DEE)->LAPACK_arr = - (sunrealtype**)malloc(Arnoldi_CONTENT(DEE)->kry_dim * sizeof(sunrealtype*)); + (sunrealtype**)malloc(*kry_dim * sizeof(sunrealtype*)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_arr, SUN_ERR_MALLOC_FAIL); for (int k = 0; k < Arnoldi_CONTENT(DEE)->kry_dim; k++) @@ -314,13 +341,13 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) /* Hessenberg matrix Hes */ Arnoldi_CONTENT(DEE)->Hes = (sunrealtype**)malloc( - (Arnoldi_CONTENT(DEE)->kry_dim + 1) * sizeof(sunrealtype*)); + (*kry_dim + 1) * sizeof(sunrealtype*)); SUNAssert(Arnoldi_CONTENT(DEE)->Hes, SUN_ERR_MALLOC_FAIL); - for (int k = 0; k <= Arnoldi_CONTENT(DEE)->kry_dim; k++) + for (int k = 0; k <= *kry_dim; k++) { Arnoldi_CONTENT(DEE)->Hes[k] = - (sunrealtype*)malloc(Arnoldi_CONTENT(DEE)->kry_dim * sizeof(sunrealtype)); + (sunrealtype*)malloc(*kry_dim * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->Hes[k], SUN_ERR_MALLOC_FAIL); } @@ -739,14 +766,26 @@ SUNErrCode dee_DQJtimes_Arnoldi(void* voidstarDEE, N_Vector v, N_Vector Jv) sunrealtype sig, siginv; int iter, retval; + sunbooleantype* Fy_is_current = &(Arnoldi_CONTENT(DEE)->Fy_is_current); N_Vector y = Arnoldi_CONTENT(DEE)->rhs_linY; N_Vector work = Arnoldi_CONTENT(DEE)->work; N_Vector Fy = Arnoldi_CONTENT(DEE)->Fy; - retval = Arnoldi_CONTENT(DEE)->rhsfn(Arnoldi_CONTENT(DEE)->rhs_linT, y, Fy, - Arnoldi_CONTENT(DEE)->rhs_data); - Arnoldi_CONTENT(DEE)->nfevals++; - if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } + SUNRhsFn rhsfn = Arnoldi_CONTENT(DEE)->rhsfn; + void* rhs_data = Arnoldi_CONTENT(DEE)->rhs_data; + + sunrealtype rhs_linT = Arnoldi_CONTENT(DEE)->rhs_linT; + + long int* nfevals = &(Arnoldi_CONTENT(DEE)->nfevals); + + if (!(*Fy_is_current)) + { + /* If Fy is not current, compute it at the linearization point */ + retval = rhsfn(rhs_linT, y, Fy, rhs_data); + (*nfevals)++; + if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } + *Fy_is_current = SUNTRUE; + } /* Initialize perturbation */ sunrealtype ydotv = N_VDotProd(y, v); @@ -761,9 +800,8 @@ SUNErrCode dee_DQJtimes_Arnoldi(void* voidstarDEE, N_Vector v, N_Vector Jv) N_VLinearSum(sig, v, ONE, y, work); /* Set Jv = f(tn, y+sig*v) */ - retval = Arnoldi_CONTENT(DEE)->rhsfn(Arnoldi_CONTENT(DEE)->rhs_linT, work, - Jv, Arnoldi_CONTENT(DEE)->rhs_data); - Arnoldi_CONTENT(DEE)->nfevals++; + retval = rhsfn(rhs_linT, work, Jv, rhs_data); + (*nfevals)++; if (retval == 0) { break; } if (retval < 0) { return SUN_ERR_USER_FCN_FAIL; } @@ -778,5 +816,6 @@ SUNErrCode dee_DQJtimes_Arnoldi(void* voidstarDEE, N_Vector v, N_Vector Jv) siginv = ONE / sig; N_VLinearSum(siginv, Jv, -siginv, Fy, Jv); + *Fy_is_current = SUNFALSE; return SUN_SUCCESS; } diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 4c38a4a63b..88d7be3c93 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -111,6 +111,8 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, DEE->ops->setrhs = SUNDomEigEstimator_SetRhs_Power; DEE->ops->setrhslinearizationpoint = SUNDomEigEstimator_SetRhsLinearizationPoint_Power; + DEE->ops->setrhsatlinearizationpoint = + SUNDomEigEstimator_SetRhsAtLinearizationPoint_Power; DEE->ops->setmaxiters = SUNDomEigEstimator_SetMaxIters_Power; DEE->ops->setnumpreprocessiters = SUNDomEigEstimator_SetNumPreprocessIters_Power; DEE->ops->setreltol = SUNDomEigEstimator_SetRelTol_Power; @@ -133,25 +135,26 @@ SUNDomEigEstimator SUNDomEigEstimator_Power(N_Vector q, long int max_iters, DEE->content = content; /* Fill content */ - content->ATimes = NULL; - content->ATdata = NULL; - content->V = NULL; - content->Av = NULL; - content->v_prev = NULL; - content->rhs_linY = NULL; - content->rhs_linT = ZERO; - content->Fy = NULL; - content->work = NULL; - content->is_complex = SUNTRUE; - content->max_iters = max_iters; - content->num_warmups = DEE_NUM_OF_WARMUPS_PI_DEFAULT; - content->rel_tol = rel_tol; - content->res = ZERO; - content->rhsfn = NULL; - content->rhs_data = NULL; - content->nfevals = 0; - content->num_iters = 0; - content->num_ATimes = 0; + content->ATimes = NULL; + content->ATdata = NULL; + content->V = NULL; + content->Av = NULL; + content->v_prev = NULL; + content->rhs_linY = NULL; + content->rhs_linT = ZERO; + content->Fy = NULL; + content->work = NULL; + content->is_complex = SUNTRUE; + content->Fy_is_current = SUNFALSE; + content->max_iters = max_iters; + content->num_warmups = DEE_NUM_OF_WARMUPS_PI_DEFAULT; + content->rel_tol = rel_tol; + content->res = ZERO; + content->rhsfn = NULL; + content->rhs_data = NULL; + content->nfevals = 0; + content->num_iters = 0; + content->num_ATimes = 0; /* Allocate content */ content->Av = N_VClone(q); @@ -240,6 +243,30 @@ SUNErrCode SUNDomEigEstimator_SetRhsLinearizationPoint_Power( return SUN_SUCCESS; } +SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint_Power( + SUNDomEigEstimator DEE, N_Vector Fyt) +{ + SUNFunctionBegin(DEE->sunctx); + + SUNAssert(DEE, SUN_ERR_ARG_CORRUPT); + SUNAssert(PI_CONTENT(DEE), SUN_ERR_ARG_CORRUPT); + SUNAssert(Fyt, SUN_ERR_ARG_CORRUPT); + + if (PI_CONTENT(DEE)->Fy == NULL) + { + PI_CONTENT(DEE)->Fy = N_VClone(Fyt); + SUNCheckLastErr(); + } + + N_VScale(ONE, Fyt, PI_CONTENT(DEE)->Fy); + SUNCheckLastErr(); + + /* Set the flag to indicate that Fy is current */ + PI_CONTENT(DEE)->Fy_is_current = SUNTRUE; + + return SUN_SUCCESS; +} + SUNErrCode SUNDomEigEstimator_SetIsReal_Power(SUNDomEigEstimator DEE, sunbooleantype real) { @@ -750,6 +777,7 @@ SUNErrCode dee_DQJtimes_Power(void* voidstarDEE, N_Vector v, N_Vector Jv) sunrealtype sig, siginv; int iter, retval; + sunbooleantype *Fy_is_current = &(PI_CONTENT(DEE)->Fy_is_current); N_Vector y = PI_CONTENT(DEE)->rhs_linY; N_Vector work = PI_CONTENT(DEE)->work; N_Vector Fy = PI_CONTENT(DEE)->Fy; @@ -761,9 +789,14 @@ SUNErrCode dee_DQJtimes_Power(void* voidstarDEE, N_Vector v, N_Vector Jv) long int* nfevals = &(PI_CONTENT(DEE)->nfevals); - retval = rhsfn(rhs_linT, y, Fy, rhs_data); - (*nfevals)++; - if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } + if (!(*Fy_is_current)) + { + /* If Fy is not current, compute it at the linearization point */ + retval = rhsfn(rhs_linT, y, Fy, rhs_data); + (*nfevals)++; + if (retval != 0) { return SUN_ERR_USER_FCN_FAIL; } + *Fy_is_current = SUNTRUE; + } /* Initialize perturbation */ sunrealtype ydotv = N_VDotProd(y, v); @@ -794,5 +827,6 @@ SUNErrCode dee_DQJtimes_Power(void* voidstarDEE, N_Vector v, N_Vector Jv) siginv = ONE / sig; N_VLinearSum(siginv, Jv, -siginv, Fy, Jv); + *Fy_is_current = SUNFALSE; return SUN_SUCCESS; } From 349d8f0dee68a56de969b4ce69cd676d71ecebd1 Mon Sep 17 00:00:00 2001 From: maggul Date: Mon, 15 Jun 2026 14:43:05 -0500 Subject: [PATCH 22/23] formatting --- include/sundials/sundials_domeigestimator.h | 3 +- include/sundomeigest/sundomeigest_arnoldi.h | 4 +- include/sundomeigest/sundomeigest_power.h | 2 +- src/arkode/arkode_lsrkstep.c | 3 +- src/sundials/sundials_domeigestimator.c | 5 ++- .../arnoldi/sundomeigest_arnoldi.c | 40 ++++++++----------- src/sundomeigest/power/sundomeigest_power.c | 8 ++-- 7 files changed, 30 insertions(+), 35 deletions(-) diff --git a/include/sundials/sundials_domeigestimator.h b/include/sundials/sundials_domeigestimator.h index 1f3f5e3212..e824a20ac8 100644 --- a/include/sundials/sundials_domeigestimator.h +++ b/include/sundials/sundials_domeigestimator.h @@ -52,8 +52,7 @@ struct SUNDomEigEstimator_Ops_ SUNErrCode (*setrhs)(SUNDomEigEstimator, void*, SUNRhsFn); SUNErrCode (*setrhslinearizationpoint)(SUNDomEigEstimator, sunrealtype, N_Vector); - SUNErrCode (*setrhsatlinearizationpoint)(SUNDomEigEstimator, - N_Vector); + SUNErrCode (*setrhsatlinearizationpoint)(SUNDomEigEstimator, N_Vector); SUNErrCode (*setoptions)(SUNDomEigEstimator DEE, const char* Did, const char* file_name, int argc, char* argv[]); SUNErrCode (*setmaxiters)(SUNDomEigEstimator, long int); diff --git a/include/sundomeigest/sundomeigest_arnoldi.h b/include/sundomeigest/sundomeigest_arnoldi.h index 9b925d40fb..5f01c6e1f3 100644 --- a/include/sundomeigest/sundomeigest_arnoldi.h +++ b/include/sundomeigest/sundomeigest_arnoldi.h @@ -92,8 +92,8 @@ SUNErrCode SUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi( SUNDomEigEstimator DEE, sunrealtype t, N_Vector v); SUNDIALS_EXPORT -SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(SUNDomEigEstimator DEE, - N_Vector Fyt); +SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi( + SUNDomEigEstimator DEE, N_Vector Fyt); SUNDIALS_EXPORT SUNErrCode SUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(SUNDomEigEstimator DEE, diff --git a/include/sundomeigest/sundomeigest_power.h b/include/sundomeigest/sundomeigest_power.h index 23078600ca..cc629c0835 100644 --- a/include/sundomeigest/sundomeigest_power.h +++ b/include/sundomeigest/sundomeigest_power.h @@ -57,7 +57,7 @@ struct SUNDomEigEstimatorContent_Power_ void* rhs_data; /* RHS function data */ long int nfevals; /* Number of RHS evaluations */ - sunbooleantype is_complex; /* Flag for complex eigenvalue request */ + sunbooleantype is_complex; /* Flag for complex eigenvalue request */ sunbooleantype Fy_is_current; /* Flag to track if Fy is current */ }; diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index d03bc6a5e8..8ffcff3028 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -2903,7 +2903,8 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) /* Pass the current RHS vector fn to the dominant eigenvalue estimator */ if (ark_mem->fn_is_current == SUNTRUE) { - retval = SUNDomEigEstimator_SetRhsAtLinearizationPoint(step_mem->DEE, ark_mem->fn); + retval = SUNDomEigEstimator_SetRhsAtLinearizationPoint(step_mem->DEE, + ark_mem->fn); if (retval != SUN_SUCCESS) { arkProcessError(ark_mem, ARK_DEE_FAIL, __LINE__, __func__, __FILE__, diff --git a/src/sundials/sundials_domeigestimator.c b/src/sundials/sundials_domeigestimator.c index 5fb47bfa6b..fbf5c977f8 100644 --- a/src/sundials/sundials_domeigestimator.c +++ b/src/sundials/sundials_domeigestimator.c @@ -228,7 +228,10 @@ SUNErrCode SUNDomEigEstimator_SetRhsAtLinearizationPoint(SUNDomEigEstimator DEE, { SUNErrCode ier; SUNDIALS_MARK_FUNCTION_BEGIN(getSUNProfiler(DEE)); - if (DEE->ops->setrhsatlinearizationpoint) { ier = DEE->ops->setrhsatlinearizationpoint(DEE, Fyt); } + if (DEE->ops->setrhsatlinearizationpoint) + { + ier = DEE->ops->setrhsatlinearizationpoint(DEE, Fyt); + } else { ier = SUN_SUCCESS; } SUNDIALS_MARK_FUNCTION_END(getSUNProfiler(DEE)); return (ier); diff --git a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c index 360437bbde..034adcd867 100644 --- a/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c +++ b/src/sundomeigest/arnoldi/sundomeigest_arnoldi.c @@ -272,34 +272,26 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) SUNAssert(Arnoldi_CONTENT(DEE)->ATimes, SUN_ERR_ARG_CORRUPT); SUNAssert(Arnoldi_CONTENT(DEE)->V, SUN_ERR_ARG_CORRUPT); - int *kry_dim = &(Arnoldi_CONTENT(DEE)->kry_dim); - int *num_warmups = &(Arnoldi_CONTENT(DEE)->num_warmups); + int* kry_dim = &(Arnoldi_CONTENT(DEE)->kry_dim); + int* num_warmups = &(Arnoldi_CONTENT(DEE)->num_warmups); - if (*kry_dim < 2) - { - *kry_dim = DEE_KRYLOV_DIM_DEFAULT; - } - if (*num_warmups < 0) - { - *num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; - } + if (*kry_dim < 2) { *kry_dim = DEE_KRYLOV_DIM_DEFAULT; } + if (*num_warmups < 0) { *num_warmups = DEE_NUM_OF_WARMUPS_ARNOLDI_DEFAULT; } if (Arnoldi_CONTENT(DEE)->LAPACK_A == NULL) { - Arnoldi_CONTENT(DEE)->LAPACK_A = (sunrealtype*)malloc( - (*kry_dim * *kry_dim) * sizeof(sunrealtype)); + Arnoldi_CONTENT(DEE)->LAPACK_A = + (sunrealtype*)malloc((*kry_dim * *kry_dim) * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_A, SUN_ERR_MALLOC_FAIL); } if (Arnoldi_CONTENT(DEE)->LAPACK_wr == NULL) { - Arnoldi_CONTENT(DEE)->LAPACK_wr = - malloc(*kry_dim * sizeof(sunrealtype)); + Arnoldi_CONTENT(DEE)->LAPACK_wr = malloc(*kry_dim * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_wr, SUN_ERR_MALLOC_FAIL); } if (Arnoldi_CONTENT(DEE)->LAPACK_wi == NULL) { - Arnoldi_CONTENT(DEE)->LAPACK_wi = - malloc(*kry_dim * sizeof(sunrealtype)); + Arnoldi_CONTENT(DEE)->LAPACK_wi = malloc(*kry_dim * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_wi, SUN_ERR_MALLOC_FAIL); } @@ -323,8 +315,8 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) /* The workspace size is returned as the first entry of the work array */ Arnoldi_CONTENT(DEE)->LAPACK_lwork = (sunindextype)work; - Arnoldi_CONTENT(DEE)->LAPACK_work = (sunrealtype*)malloc( - ((sunindextype)work) * sizeof(sunrealtype)); + Arnoldi_CONTENT(DEE)->LAPACK_work = + (sunrealtype*)malloc(((sunindextype)work) * sizeof(sunrealtype)); SUNAssert(Arnoldi_CONTENT(DEE)->LAPACK_work, SUN_ERR_MALLOC_FAIL); /* LAPACK array */ @@ -340,8 +332,8 @@ SUNErrCode SUNDomEigEstimator_Initialize_Arnoldi(SUNDomEigEstimator DEE) } /* Hessenberg matrix Hes */ - Arnoldi_CONTENT(DEE)->Hes = (sunrealtype**)malloc( - (*kry_dim + 1) * sizeof(sunrealtype*)); + Arnoldi_CONTENT(DEE)->Hes = + (sunrealtype**)malloc((*kry_dim + 1) * sizeof(sunrealtype*)); SUNAssert(Arnoldi_CONTENT(DEE)->Hes, SUN_ERR_MALLOC_FAIL); for (int k = 0; k <= *kry_dim; k++) @@ -767,9 +759,9 @@ SUNErrCode dee_DQJtimes_Arnoldi(void* voidstarDEE, N_Vector v, N_Vector Jv) int iter, retval; sunbooleantype* Fy_is_current = &(Arnoldi_CONTENT(DEE)->Fy_is_current); - N_Vector y = Arnoldi_CONTENT(DEE)->rhs_linY; - N_Vector work = Arnoldi_CONTENT(DEE)->work; - N_Vector Fy = Arnoldi_CONTENT(DEE)->Fy; + N_Vector y = Arnoldi_CONTENT(DEE)->rhs_linY; + N_Vector work = Arnoldi_CONTENT(DEE)->work; + N_Vector Fy = Arnoldi_CONTENT(DEE)->Fy; SUNRhsFn rhsfn = Arnoldi_CONTENT(DEE)->rhsfn; void* rhs_data = Arnoldi_CONTENT(DEE)->rhs_data; @@ -800,7 +792,7 @@ SUNErrCode dee_DQJtimes_Arnoldi(void* voidstarDEE, N_Vector v, N_Vector Jv) N_VLinearSum(sig, v, ONE, y, work); /* Set Jv = f(tn, y+sig*v) */ - retval = rhsfn(rhs_linT, work, Jv, rhs_data); + retval = rhsfn(rhs_linT, work, Jv, rhs_data); (*nfevals)++; if (retval == 0) { break; } if (retval < 0) { return SUN_ERR_USER_FCN_FAIL; } diff --git a/src/sundomeigest/power/sundomeigest_power.c b/src/sundomeigest/power/sundomeigest_power.c index 88d7be3c93..3062645378 100644 --- a/src/sundomeigest/power/sundomeigest_power.c +++ b/src/sundomeigest/power/sundomeigest_power.c @@ -777,10 +777,10 @@ SUNErrCode dee_DQJtimes_Power(void* voidstarDEE, N_Vector v, N_Vector Jv) sunrealtype sig, siginv; int iter, retval; - sunbooleantype *Fy_is_current = &(PI_CONTENT(DEE)->Fy_is_current); - N_Vector y = PI_CONTENT(DEE)->rhs_linY; - N_Vector work = PI_CONTENT(DEE)->work; - N_Vector Fy = PI_CONTENT(DEE)->Fy; + sunbooleantype* Fy_is_current = &(PI_CONTENT(DEE)->Fy_is_current); + N_Vector y = PI_CONTENT(DEE)->rhs_linY; + N_Vector work = PI_CONTENT(DEE)->work; + N_Vector Fy = PI_CONTENT(DEE)->Fy; SUNRhsFn rhsfn = PI_CONTENT(DEE)->rhsfn; void* rhs_data = PI_CONTENT(DEE)->rhs_data; From 4a76165397344d40da4868606841bd0a851cfe2a Mon Sep 17 00:00:00 2001 From: maggul Date: Wed, 17 Jun 2026 11:26:36 -0500 Subject: [PATCH 23/23] swig and litgen --- .../sundomeigest_power_generated.hpp | 4 ++ src/sundials/fmod_int32/fsundials_core_mod.c | 14 ++++ .../fmod_int32/fsundials_core_mod.f90 | 27 +++++++ src/sundials/fmod_int64/fsundials_core_mod.c | 14 ++++ .../fmod_int64/fsundials_core_mod.f90 | 27 +++++++ .../fmod_int32/fsundomeigest_arnoldi_mod.c | 38 ++++++++++ .../fmod_int32/fsundomeigest_arnoldi_mod.f90 | 70 +++++++++++++++++++ .../fmod_int64/fsundomeigest_arnoldi_mod.c | 38 ++++++++++ .../fmod_int64/fsundomeigest_arnoldi_mod.f90 | 70 +++++++++++++++++++ .../fmod_int32/fsundomeigest_power_mod.c | 38 ++++++++++ .../fmod_int32/fsundomeigest_power_mod.f90 | 70 +++++++++++++++++++ .../fmod_int64/fsundomeigest_power_mod.c | 38 ++++++++++ .../fmod_int64/fsundomeigest_power_mod.f90 | 70 +++++++++++++++++++ 13 files changed, 518 insertions(+) diff --git a/bindings/sundials4py/sundomeigest/sundomeigest_power_generated.hpp b/bindings/sundials4py/sundomeigest/sundomeigest_power_generated.hpp index 27b613dd62..5928fb972e 100644 --- a/bindings/sundials4py/sundomeigest/sundomeigest_power_generated.hpp +++ b/bindings/sundials4py/sundomeigest/sundomeigest_power_generated.hpp @@ -33,6 +33,10 @@ m.def( nb::arg("q"), nb::arg("max_iters"), nb::arg("rel_tol"), nb::arg("sunctx"), "nb::keep_alive<0, 4>()", nb::keep_alive<0, 4>()); +m.def("SUNDomEigEstimator_SetRhsAtLinearizationPoint_Power", + SUNDomEigEstimator_SetRhsAtLinearizationPoint_Power, nb::arg("DEE"), + nb::arg("Fyt")); + m.def("SUNDomEigEstimator_SetIsReal_Power", SUNDomEigEstimator_SetIsReal_Power, nb::arg("DEE"), nb::arg("real")); // #ifdef __cplusplus diff --git a/src/sundials/fmod_int32/fsundials_core_mod.c b/src/sundials/fmod_int32/fsundials_core_mod.c index 7390131c63..43f9014588 100644 --- a/src/sundials/fmod_int32/fsundials_core_mod.c +++ b/src/sundials/fmod_int32/fsundials_core_mod.c @@ -3962,6 +3962,20 @@ SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsLinearizationPoint(SUNDomEigEstim } +SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint(SUNDomEigEstimator farg1, N_Vector farg2) { + int fresult ; + SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + SUNErrCode result; + + arg1 = (SUNDomEigEstimator)(farg1); + arg2 = (N_Vector)(farg2); + result = (SUNErrCode)SUNDomEigEstimator_SetRhsAtLinearizationPoint(arg1,arg2); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetMaxIters(SUNDomEigEstimator farg1, long const *farg2) { int fresult ; SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; diff --git a/src/sundials/fmod_int32/fsundials_core_mod.f90 b/src/sundials/fmod_int32/fsundials_core_mod.f90 index 9f392ded5e..ab83256319 100644 --- a/src/sundials/fmod_int32/fsundials_core_mod.f90 +++ b/src/sundials/fmod_int32/fsundials_core_mod.f90 @@ -697,6 +697,7 @@ module fsundials_core_mod type(C_FUNPTR), public :: setatimes type(C_FUNPTR), public :: setrhs type(C_FUNPTR), public :: setrhslinearizationpoint + type(C_FUNPTR), public :: setrhsatlinearizationpoint type(C_FUNPTR), public :: setoptions type(C_FUNPTR), public :: setmaxiters type(C_FUNPTR), public :: setnumpreprocessiters @@ -723,6 +724,7 @@ module fsundials_core_mod public :: FSUNDomEigEstimator_SetATimes public :: FSUNDomEigEstimator_SetRhs public :: FSUNDomEigEstimator_SetRhsLinearizationPoint + public :: FSUNDomEigEstimator_SetRhsAtLinearizationPoint public :: FSUNDomEigEstimator_SetMaxIters public :: FSUNDomEigEstimator_SetNumPreprocessIters public :: FSUNDomEigEstimator_SetRelTol @@ -3053,6 +3055,15 @@ function swigc_FSUNDomEigEstimator_SetRhsLinearizationPoint(farg1, farg2, farg3) integer(C_INT) :: fresult end function +function swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint(farg1, farg2) & +bind(C, name="_wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNDomEigEstimator_SetMaxIters(farg1, farg2) & bind(C, name="_wrap_FSUNDomEigEstimator_SetMaxIters") & result(fresult) @@ -7440,6 +7451,22 @@ function FSUNDomEigEstimator_SetRhsLinearizationPoint(dee, t, v) & swig_result = fresult end function +function FSUNDomEigEstimator_SetRhsAtLinearizationPoint(dee, fyt) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(SUNDomEigEstimator), target, intent(inout) :: dee +type(N_Vector), target, intent(inout) :: fyt +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = c_loc(dee) +farg2 = c_loc(fyt) +fresult = swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint(farg1, farg2) +swig_result = fresult +end function + function FSUNDomEigEstimator_SetMaxIters(dee, max_iters) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/sundials/fmod_int64/fsundials_core_mod.c b/src/sundials/fmod_int64/fsundials_core_mod.c index 1577020edc..dd56451733 100644 --- a/src/sundials/fmod_int64/fsundials_core_mod.c +++ b/src/sundials/fmod_int64/fsundials_core_mod.c @@ -3962,6 +3962,20 @@ SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsLinearizationPoint(SUNDomEigEstim } +SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint(SUNDomEigEstimator farg1, N_Vector farg2) { + int fresult ; + SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + SUNErrCode result; + + arg1 = (SUNDomEigEstimator)(farg1); + arg2 = (N_Vector)(farg2); + result = (SUNErrCode)SUNDomEigEstimator_SetRhsAtLinearizationPoint(arg1,arg2); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetMaxIters(SUNDomEigEstimator farg1, long const *farg2) { int fresult ; SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; diff --git a/src/sundials/fmod_int64/fsundials_core_mod.f90 b/src/sundials/fmod_int64/fsundials_core_mod.f90 index b3037e6dd5..83b982b7d7 100644 --- a/src/sundials/fmod_int64/fsundials_core_mod.f90 +++ b/src/sundials/fmod_int64/fsundials_core_mod.f90 @@ -697,6 +697,7 @@ module fsundials_core_mod type(C_FUNPTR), public :: setatimes type(C_FUNPTR), public :: setrhs type(C_FUNPTR), public :: setrhslinearizationpoint + type(C_FUNPTR), public :: setrhsatlinearizationpoint type(C_FUNPTR), public :: setoptions type(C_FUNPTR), public :: setmaxiters type(C_FUNPTR), public :: setnumpreprocessiters @@ -723,6 +724,7 @@ module fsundials_core_mod public :: FSUNDomEigEstimator_SetATimes public :: FSUNDomEigEstimator_SetRhs public :: FSUNDomEigEstimator_SetRhsLinearizationPoint + public :: FSUNDomEigEstimator_SetRhsAtLinearizationPoint public :: FSUNDomEigEstimator_SetMaxIters public :: FSUNDomEigEstimator_SetNumPreprocessIters public :: FSUNDomEigEstimator_SetRelTol @@ -3053,6 +3055,15 @@ function swigc_FSUNDomEigEstimator_SetRhsLinearizationPoint(farg1, farg2, farg3) integer(C_INT) :: fresult end function +function swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint(farg1, farg2) & +bind(C, name="_wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNDomEigEstimator_SetMaxIters(farg1, farg2) & bind(C, name="_wrap_FSUNDomEigEstimator_SetMaxIters") & result(fresult) @@ -7440,6 +7451,22 @@ function FSUNDomEigEstimator_SetRhsLinearizationPoint(dee, t, v) & swig_result = fresult end function +function FSUNDomEigEstimator_SetRhsAtLinearizationPoint(dee, fyt) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(SUNDomEigEstimator), target, intent(inout) :: dee +type(N_Vector), target, intent(inout) :: fyt +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = c_loc(dee) +farg2 = c_loc(fyt) +fresult = swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint(farg1, farg2) +swig_result = fresult +end function + function FSUNDomEigEstimator_SetMaxIters(dee, max_iters) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c index b17f88f65e..d960c81b9b 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.c @@ -540,6 +540,30 @@ SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get(SwigCl } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::Fy_is_current", return ); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->Fy_is_current = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::Fy_is_current", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + result = (int) ((arg1)->Fy_is_current); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set(SwigClassWrapper const *farg1, double const *farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; sunrealtype arg2 ; @@ -947,6 +971,20 @@ SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi(SUNDom } +SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(SUNDomEigEstimator farg1, N_Vector farg2) { + int fresult ; + SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + SUNErrCode result; + + arg1 = (SUNDomEigEstimator)(farg1); + arg2 = (N_Vector)(farg2); + result = (SUNErrCode)SUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(arg1,arg2); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(SUNDomEigEstimator farg1, int const *farg2) { int fresult ; SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 index 5056cb0b07..4a7318c844 100644 --- a/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int32/fsundomeigest_arnoldi_mod.f90 @@ -60,6 +60,8 @@ module fsundomeigest_arnoldi_mod procedure :: get_num_iters => swigf_SUNDomEigEstimatorContent_Arnoldi__num_iters_get procedure :: set_warmup_to_tol => swigf_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_set procedure :: get_warmup_to_tol => swigf_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get + procedure :: set_Fy_is_current => swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set + procedure :: get_Fy_is_current => swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get procedure :: set_tol_warmup => swigf_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set procedure :: get_tol_warmup => swigf_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_get procedure :: set_rhs_linT => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linT_set @@ -97,6 +99,7 @@ module fsundomeigest_arnoldi_mod public :: FSUNDomEigEstimator_SetATimes_Arnoldi public :: FSUNDomEigEstimator_SetRhs_Arnoldi public :: FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi + public :: FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi public :: FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi public :: FSUNDomEigEstimator_SetRelTol_Arnoldi public :: FSUNDomEigEstimator_SetInitialGuess_Arnoldi @@ -280,6 +283,23 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get(farg1) & integer(C_INT) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set") use, intrinsic :: ISO_C_BINDING @@ -564,6 +584,15 @@ function swigc_FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi(farg1, farg2 integer(C_INT) :: fresult end function +function swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(farg1, farg2) & +bind(C, name="_wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(farg1, farg2) & bind(C, name="_wrap_FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi") & result(fresult) @@ -908,6 +937,31 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(self, fy_is_current) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT), intent(in) :: fy_is_current +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = fy_is_current +call swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(farg1) +swig_result = fresult +end function + subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set(self, tol_warmup) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self @@ -1346,6 +1400,22 @@ function FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi(dee, t, v) & swig_result = fresult end function +function FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(dee, fyt) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(SUNDomEigEstimator), target, intent(inout) :: dee +type(N_Vector), target, intent(inout) :: fyt +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = c_loc(dee) +farg2 = c_loc(fyt) +fresult = swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(farg1, farg2) +swig_result = fresult +end function + function FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(dee, num_iters) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c index a9915a6f43..b81d4dde90 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.c @@ -540,6 +540,30 @@ SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get(SwigCl } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::Fy_is_current", return ); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->Fy_is_current = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Arnoldi_ *", "SUNDomEigEstimatorContent_Arnoldi_", "SUNDomEigEstimatorContent_Arnoldi_::Fy_is_current", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *)(farg1->cptr); + result = (int) ((arg1)->Fy_is_current); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set(SwigClassWrapper const *farg1, double const *farg2) { struct SUNDomEigEstimatorContent_Arnoldi_ *arg1 = (struct SUNDomEigEstimatorContent_Arnoldi_ *) 0 ; sunrealtype arg2 ; @@ -947,6 +971,20 @@ SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi(SUNDom } +SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(SUNDomEigEstimator farg1, N_Vector farg2) { + int fresult ; + SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + SUNErrCode result; + + arg1 = (SUNDomEigEstimator)(farg1); + arg2 = (N_Vector)(farg2); + result = (SUNErrCode)SUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(arg1,arg2); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(SUNDomEigEstimator farg1, int const *farg2) { int fresult ; SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; diff --git a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 index e5dfbcc8fe..17f9171dbd 100644 --- a/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 +++ b/src/sundomeigest/arnoldi/fmod_int64/fsundomeigest_arnoldi_mod.f90 @@ -60,6 +60,8 @@ module fsundomeigest_arnoldi_mod procedure :: get_num_iters => swigf_SUNDomEigEstimatorContent_Arnoldi__num_iters_get procedure :: set_warmup_to_tol => swigf_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_set procedure :: get_warmup_to_tol => swigf_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get + procedure :: set_Fy_is_current => swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set + procedure :: get_Fy_is_current => swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get procedure :: set_tol_warmup => swigf_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set procedure :: get_tol_warmup => swigf_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_get procedure :: set_rhs_linT => swigf_SUNDomEigEstimatorContent_Arnoldi__rhs_linT_set @@ -97,6 +99,7 @@ module fsundomeigest_arnoldi_mod public :: FSUNDomEigEstimator_SetATimes_Arnoldi public :: FSUNDomEigEstimator_SetRhs_Arnoldi public :: FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi + public :: FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi public :: FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi public :: FSUNDomEigEstimator_SetRelTol_Arnoldi public :: FSUNDomEigEstimator_SetInitialGuess_Arnoldi @@ -280,6 +283,23 @@ function swigc_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get(farg1) & integer(C_INT) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + subroutine swigc_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set(farg1, farg2) & bind(C, name="_wrap_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set") use, intrinsic :: ISO_C_BINDING @@ -564,6 +584,15 @@ function swigc_FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi(farg1, farg2 integer(C_INT) :: fresult end function +function swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(farg1, farg2) & +bind(C, name="_wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(farg1, farg2) & bind(C, name="_wrap_FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi") & result(fresult) @@ -908,6 +937,31 @@ function swigf_SUNDomEigEstimatorContent_Arnoldi__warmup_to_tol_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(self, fy_is_current) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT), intent(in) :: fy_is_current +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = fy_is_current +call swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Arnoldi__Fy_is_current_get(farg1) +swig_result = fresult +end function + subroutine swigf_SUNDomEigEstimatorContent_Arnoldi__tol_warmup_set(self, tol_warmup) use, intrinsic :: ISO_C_BINDING class(SUNDomEigEstimatorContent_Arnoldi_), intent(in) :: self @@ -1346,6 +1400,22 @@ function FSUNDomEigEstimator_SetRhsLinearizationPoint_Arnoldi(dee, t, v) & swig_result = fresult end function +function FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(dee, fyt) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(SUNDomEigEstimator), target, intent(inout) :: dee +type(N_Vector), target, intent(inout) :: fyt +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = c_loc(dee) +farg2 = c_loc(fyt) +fresult = swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Arnoldi(farg1, farg2) +swig_result = fresult +end function + function FSUNDomEigEstimator_SetNumPreprocessIters_Arnoldi(dee, num_iters) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c index c62b7c3670..6462b07889 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.c @@ -756,6 +756,30 @@ SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__is_complex_get(SwigClassWr } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Fy_is_current", return ); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->Fy_is_current = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Fy_is_current", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + result = (int) ((arg1)->Fy_is_current); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT SwigClassWrapper _wrap_new_SUNDomEigEstimatorContent_Power_() { SwigClassWrapper fresult ; struct SUNDomEigEstimatorContent_Power_ *result = 0 ; @@ -909,6 +933,20 @@ SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsLinearizationPoint_Power(SUNDomEi } +SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(SUNDomEigEstimator farg1, N_Vector farg2) { + int fresult ; + SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + SUNErrCode result; + + arg1 = (SUNDomEigEstimator)(farg1); + arg2 = (N_Vector)(farg2); + result = (SUNErrCode)SUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(arg1,arg2); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetIsReal_Power(SUNDomEigEstimator farg1, int const *farg2) { int fresult ; SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; diff --git a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 index a09b7a1e9d..5c38720a8f 100644 --- a/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int32/fsundomeigest_power_mod.f90 @@ -78,6 +78,8 @@ module fsundomeigest_power_mod procedure :: get_nfevals => swigf_SUNDomEigEstimatorContent_Power__nfevals_get procedure :: set_is_complex => swigf_SUNDomEigEstimatorContent_Power__is_complex_set procedure :: get_is_complex => swigf_SUNDomEigEstimatorContent_Power__is_complex_get + procedure :: set_Fy_is_current => swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_set + procedure :: get_Fy_is_current => swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_get procedure :: release => swigf_release_SUNDomEigEstimatorContent_Power_ procedure, private :: swigf_SUNDomEigEstimatorContent_Power__op_assign__ generic :: assignment(=) => swigf_SUNDomEigEstimatorContent_Power__op_assign__ @@ -93,6 +95,7 @@ module fsundomeigest_power_mod public :: FSUNDomEigEstimator_SetRelTol_Power public :: FSUNDomEigEstimator_SetInitialGuess_Power public :: FSUNDomEigEstimator_SetRhsLinearizationPoint_Power + public :: FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power public :: FSUNDomEigEstimator_SetIsReal_Power public :: FSUNDomEigEstimator_Initialize_Power public :: FSUNDomEigEstimator_Estimate_Power @@ -428,6 +431,23 @@ function swigc_SUNDomEigEstimatorContent_Power__is_complex_get(farg1) & integer(C_INT) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + function swigc_new_SUNDomEigEstimatorContent_Power_() & bind(C, name="_wrap_new_SUNDomEigEstimatorContent_Power_") & result(fresult) @@ -528,6 +548,15 @@ function swigc_FSUNDomEigEstimator_SetRhsLinearizationPoint_Power(farg1, farg2, integer(C_INT) :: fresult end function +function swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(farg1, farg2) & +bind(C, name="_wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNDomEigEstimator_SetIsReal_Power(farg1, farg2) & bind(C, name="_wrap_FSUNDomEigEstimator_SetIsReal_Power") & result(fresult) @@ -1088,6 +1117,31 @@ function swigf_SUNDomEigEstimatorContent_Power__is_complex_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_set(self, fy_is_current) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT), intent(in) :: fy_is_current +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = fy_is_current +call swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_get(farg1) +swig_result = fresult +end function + function swigf_create_SUNDomEigEstimatorContent_Power_() & result(self) use, intrinsic :: ISO_C_BINDING @@ -1268,6 +1322,22 @@ function FSUNDomEigEstimator_SetRhsLinearizationPoint_Power(dee, t, v) & swig_result = fresult end function +function FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(dee, fyt) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(SUNDomEigEstimator), target, intent(inout) :: dee +type(N_Vector), target, intent(inout) :: fyt +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = c_loc(dee) +farg2 = c_loc(fyt) +fresult = swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(farg1, farg2) +swig_result = fresult +end function + function FSUNDomEigEstimator_SetIsReal_Power(dee, real) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c index c62b7c3670..6462b07889 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.c @@ -756,6 +756,30 @@ SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__is_complex_get(SwigClassWr } +SWIGEXPORT void _wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_set(SwigClassWrapper const *farg1, int const *farg2) { + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int arg2 ; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Fy_is_current", return ); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + arg2 = (int)(*farg2); + if (arg1) (arg1)->Fy_is_current = arg2; +} + + +SWIGEXPORT int _wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_get(SwigClassWrapper const *farg1) { + int fresult ; + struct SUNDomEigEstimatorContent_Power_ *arg1 = (struct SUNDomEigEstimatorContent_Power_ *) 0 ; + int result; + + SWIG_check_mutable_nonnull(*farg1, "struct SUNDomEigEstimatorContent_Power_ *", "SUNDomEigEstimatorContent_Power_", "SUNDomEigEstimatorContent_Power_::Fy_is_current", return 0); + arg1 = (struct SUNDomEigEstimatorContent_Power_ *)(farg1->cptr); + result = (int) ((arg1)->Fy_is_current); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT SwigClassWrapper _wrap_new_SUNDomEigEstimatorContent_Power_() { SwigClassWrapper fresult ; struct SUNDomEigEstimatorContent_Power_ *result = 0 ; @@ -909,6 +933,20 @@ SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsLinearizationPoint_Power(SUNDomEi } +SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(SUNDomEigEstimator farg1, N_Vector farg2) { + int fresult ; + SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; + N_Vector arg2 = (N_Vector) 0 ; + SUNErrCode result; + + arg1 = (SUNDomEigEstimator)(farg1); + arg2 = (N_Vector)(farg2); + result = (SUNErrCode)SUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(arg1,arg2); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDomEigEstimator_SetIsReal_Power(SUNDomEigEstimator farg1, int const *farg2) { int fresult ; SUNDomEigEstimator arg1 = (SUNDomEigEstimator) 0 ; diff --git a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 index a09b7a1e9d..5c38720a8f 100644 --- a/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 +++ b/src/sundomeigest/power/fmod_int64/fsundomeigest_power_mod.f90 @@ -78,6 +78,8 @@ module fsundomeigest_power_mod procedure :: get_nfevals => swigf_SUNDomEigEstimatorContent_Power__nfevals_get procedure :: set_is_complex => swigf_SUNDomEigEstimatorContent_Power__is_complex_set procedure :: get_is_complex => swigf_SUNDomEigEstimatorContent_Power__is_complex_get + procedure :: set_Fy_is_current => swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_set + procedure :: get_Fy_is_current => swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_get procedure :: release => swigf_release_SUNDomEigEstimatorContent_Power_ procedure, private :: swigf_SUNDomEigEstimatorContent_Power__op_assign__ generic :: assignment(=) => swigf_SUNDomEigEstimatorContent_Power__op_assign__ @@ -93,6 +95,7 @@ module fsundomeigest_power_mod public :: FSUNDomEigEstimator_SetRelTol_Power public :: FSUNDomEigEstimator_SetInitialGuess_Power public :: FSUNDomEigEstimator_SetRhsLinearizationPoint_Power + public :: FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power public :: FSUNDomEigEstimator_SetIsReal_Power public :: FSUNDomEigEstimator_Initialize_Power public :: FSUNDomEigEstimator_Estimate_Power @@ -428,6 +431,23 @@ function swigc_SUNDomEigEstimatorContent_Power__is_complex_get(farg1) & integer(C_INT) :: fresult end function +subroutine swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_set(farg1, farg2) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_set") +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT), intent(in) :: farg2 +end subroutine + +function swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_get(farg1) & +bind(C, name="_wrap_SUNDomEigEstimatorContent_Power__Fy_is_current_get") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigclasswrapper +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: fresult +end function + function swigc_new_SUNDomEigEstimatorContent_Power_() & bind(C, name="_wrap_new_SUNDomEigEstimatorContent_Power_") & result(fresult) @@ -528,6 +548,15 @@ function swigc_FSUNDomEigEstimator_SetRhsLinearizationPoint_Power(farg1, farg2, integer(C_INT) :: fresult end function +function swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(farg1, farg2) & +bind(C, name="_wrap_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNDomEigEstimator_SetIsReal_Power(farg1, farg2) & bind(C, name="_wrap_FSUNDomEigEstimator_SetIsReal_Power") & result(fresult) @@ -1088,6 +1117,31 @@ function swigf_SUNDomEigEstimatorContent_Power__is_complex_get(self) & swig_result = fresult end function +subroutine swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_set(self, fy_is_current) +use, intrinsic :: ISO_C_BINDING +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT), intent(in) :: fy_is_current +type(SwigClassWrapper) :: farg1 +integer(C_INT) :: farg2 + +farg1 = self%swigdata +farg2 = fy_is_current +call swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_set(farg1, farg2) +end subroutine + +function swigf_SUNDomEigEstimatorContent_Power__Fy_is_current_get(self) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +class(SUNDomEigEstimatorContent_Power_), intent(in) :: self +integer(C_INT) :: fresult +type(SwigClassWrapper) :: farg1 + +farg1 = self%swigdata +fresult = swigc_SUNDomEigEstimatorContent_Power__Fy_is_current_get(farg1) +swig_result = fresult +end function + function swigf_create_SUNDomEigEstimatorContent_Power_() & result(self) use, intrinsic :: ISO_C_BINDING @@ -1268,6 +1322,22 @@ function FSUNDomEigEstimator_SetRhsLinearizationPoint_Power(dee, t, v) & swig_result = fresult end function +function FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(dee, fyt) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(SUNDomEigEstimator), target, intent(inout) :: dee +type(N_Vector), target, intent(inout) :: fyt +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = c_loc(dee) +farg2 = c_loc(fyt) +fresult = swigc_FSUNDomEigEstimator_SetRhsAtLinearizationPoint_Power(farg1, farg2) +swig_result = fresult +end function + function FSUNDomEigEstimator_SetIsReal_Power(dee, real) & result(swig_result) use, intrinsic :: ISO_C_BINDING