Date: 2026-05-01T10:02:23+00:00

Actual source code: zrationalf.c

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain

      6:    This file is part of SLEPc.
      7:    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
      8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      9: */

     11: #include <petsc/private/ftnimpl.h>
     12: #include <slepcfn.h>

     14: #if defined(PETSC_HAVE_FORTRAN_CAPS)
     15: #define fnrationalgetnumerator0_    FNRATIONALGETNUMERATOR0
     16: #define fnrationalgetnumerator1_    FNRATIONALGETNUMERATOR1
     17: #define fnrationalgetdenominator0_  FNRATIONALGETDENOMINATOR0
     18: #define fnrationalgetdenominator1_  FNRATIONALGETDENOMINATOR1
     19: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
     20: #define fnrationalgetnumerator0_    fnrationalgetnumerator0
     21: #define fnrationalgetnumerator1_    fnrationalgetnumerator1
     22: #define fnrationalgetdenominator0_  fnrationalgetdenominator0
     23: #define fnrationalgetdenominator1_  fnrationalgetdenominator1
     24: #endif

     26: SLEPC_EXTERN void fnrationalgetnumerator_(FN *fn,PetscInt *np,PetscScalar *pcoeff,PetscErrorCode *ierr)
     27: {
     28:   PetscScalar *ocoeff;
     29:   PetscInt    n;

     31:   CHKFORTRANNULLINTEGER(np);
     32:   CHKFORTRANNULLSCALAR(pcoeff);
     33:   *ierr = FNRationalGetNumerator(*fn,&n,&ocoeff); if (*ierr) return;
     34:   if (pcoeff && ocoeff) { *ierr = PetscArraycpy(pcoeff,ocoeff,n); if (*ierr) return; }
     35:   if (np) *np = n;
     36:   *ierr = PetscFree(ocoeff);
     37: }

     39: SLEPC_EXTERN void fnrationalgetnumerator0_(FN *fn,PetscInt *np,PetscScalar *qcoeff,PetscErrorCode *ierr)
     40: {
     41:   fnrationalgetnumerator_(fn,np,qcoeff,ierr);
     42: }

     44: SLEPC_EXTERN void fnrationalgetnumerator1_(FN *fn,PetscInt *np,PetscScalar *qcoeff,PetscErrorCode *ierr)
     45: {
     46:   fnrationalgetnumerator_(fn,np,qcoeff,ierr);
     47: }

     49: SLEPC_EXTERN void fnrationalgetdenominator_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
     50: {
     51:   PetscScalar *ocoeff;
     52:   PetscInt    n;

     54:   CHKFORTRANNULLINTEGER(nq);
     55:   CHKFORTRANNULLSCALAR(qcoeff);
     56:   *ierr = FNRationalGetDenominator(*fn,&n,&ocoeff); if (*ierr) return;
     57:   if (qcoeff && ocoeff) { *ierr = PetscArraycpy(qcoeff,ocoeff,n); if (*ierr) return; }
     58:   if (nq) *nq = n;
     59:   *ierr = PetscFree(ocoeff);
     60: }

     62: SLEPC_EXTERN void fnrationalgetdenominator0_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
     63: {
     64:   fnrationalgetdenominator_(fn,nq,qcoeff,ierr);
     65: }

     67: SLEPC_EXTERN void fnrationalgetdenominator1_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
     68: {
     69:   fnrationalgetdenominator_(fn,nq,qcoeff,ierr);
     70: }