Date: 2025-03-29T05:58:29+00:00

Actual source code: symbrdn.h

      1: #pragma once

      3: #include <../src/ksp/ksp/utils/lmvm/lmvm.h>

      5: /*
      6:   Limited-memory Symmetric Broyden method for approximating both
      7:   the forward product and inverse application of a Jacobian.
      8: */

     10: typedef struct {
     11:   Mat                        D;                                 /* diagonal scaling term */
     12:   Vec                       *P, *Q;                             /* storage vectors for (B_i)*S[i] and (B_i)^{-1}*Y[i] */
     13:   Vec                        invDnew, invD, BFGS, DFP, U, V, W; /* work vectors for diagonal scaling */
     14:   Vec                        work;
     15:   PetscBool                  allocated, needP, needQ;
     16:   PetscReal                 *stp, *ytq, *yts, *yty, *sts; /* scalar arrays for recycling dot products */
     17:   PetscScalar               *workscalar;                  /* work scalar array */
     18:   PetscReal                  theta, phi, *psi;            /* convex combination factors between DFP and BFGS */
     19:   PetscReal                  rho, alpha, beta;            /* convex combination factors for the scalar or diagonal scaling */
     20:   PetscReal                  delta, delta_min, delta_max, sigma;
     21:   PetscInt                   sigma_hist; /* length of update history to be used for scaling */
     22:   MatLMVMSymBroydenScaleType scale_type;
     23:   PetscInt                   watchdog, max_seq_rejects; /* tracker to reset after a certain # of consecutive rejects */
     24: } Mat_SymBrdn;

     26: PETSC_INTERN PetscErrorCode MatSymBrdnApplyJ0Fwd(Mat, Vec, Vec);
     27: PETSC_INTERN PetscErrorCode MatSymBrdnApplyJ0Inv(Mat, Vec, Vec);
     28: PETSC_INTERN PetscErrorCode MatSymBrdnComputeJ0Diag(Mat);
     29: PETSC_INTERN PetscErrorCode MatSymBrdnComputeJ0Scalar(Mat);

     31: PETSC_INTERN PetscErrorCode MatView_LMVMSymBrdn(Mat, PetscViewer);
     32: PETSC_INTERN PetscErrorCode MatSetFromOptions_LMVMSymBrdn(Mat, PetscOptionItems);
     33: PETSC_INTERN PetscErrorCode MatSetFromOptions_LMVMSymBrdn_Private(Mat, PetscOptionItems);