Date: 2024-09-25T09:34:44+00:00

Actual source code: zrational.c
slepc-3.21.2 2024-09-25
Report Typos and Errors

      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/fortranimpl.h>
     12: #include <slepcfn.h>

     14: #if defined(PETSC_HAVE_FORTRAN_CAPS)
     15: #define fnrationalsetnumerator0_    FNRATIONALSETNUMERATOR0
     16: #define fnrationalsetnumerator1_    FNRATIONALSETNUMERATOR1
     17: #define fnrationalsetdenominator0_  FNRATIONALSETDENOMINATOR0
     18: #define fnrationalsetdenominator1_  FNRATIONALSETDENOMINATOR1
     19: #define fnrationalgetnumerator0_    FNRATIONALGETNUMERATOR0
     20: #define fnrationalgetnumerator1_    FNRATIONALGETNUMERATOR1
     21: #define fnrationalgetdenominator0_  FNRATIONALGETDENOMINATOR0
     22: #define fnrationalgetdenominator1_  FNRATIONALGETDENOMINATOR1
     23: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
     24: #define fnrationalsetnumerator0_    fnrationalsetnumerator0
     25: #define fnrationalsetnumerator1_    fnrationalsetnumerator1
     26: #define fnrationalsetdenominator0_  fnrationalsetdenominator0
     27: #define fnrationalsetdenominator1_  fnrationalsetdenominator1
     28: #define fnrationalgetnumerator0_    fnrationalgetnumerator0
     29: #define fnrationalgetnumerator1_    fnrationalgetnumerator1
     30: #define fnrationalgetdenominator0_  fnrationalgetdenominator0
     31: #define fnrationalgetdenominator1_  fnrationalgetdenominator1
     32: #endif

     34: SLEPC_EXTERN void fnrationalsetnumerator_(FN *fn,PetscInt *np,PetscScalar *pcoeff,PetscErrorCode *ierr)
     35: {
     36:   CHKFORTRANNULLSCALAR(pcoeff);
     37:   *ierr = FNRationalSetNumerator(*fn,*np,pcoeff);
     38: }

     40: SLEPC_EXTERN void fnrationalsetnumerator0_(FN *fn,PetscInt *np,PetscScalar *pcoeff,PetscErrorCode *ierr)
     41: {
     42:   fnrationalsetnumerator_(fn,np,pcoeff,ierr);
     43: }

     45: SLEPC_EXTERN void fnrationalsetnumerator1_(FN *fn,PetscInt *np,PetscScalar *pcoeff,PetscErrorCode *ierr)
     46: {
     47:   fnrationalsetnumerator_(fn,np,pcoeff,ierr);
     48: }

     50: SLEPC_EXTERN void fnrationalsetdenominator_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
     51: {
     52:   CHKFORTRANNULLSCALAR(qcoeff);
     53:   *ierr = FNRationalSetDenominator(*fn,*nq,qcoeff);
     54: }

     56: SLEPC_EXTERN void fnrationalsetdenominator0_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
     57: {
     58:   fnrationalsetdenominator_(fn,nq,qcoeff,ierr);
     59: }

     61: SLEPC_EXTERN void fnrationalsetdenominator1_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
     62: {
     63:   fnrationalsetdenominator_(fn,nq,qcoeff,ierr);
     64: }

     66: SLEPC_EXTERN void fnrationalgetnumerator_(FN *fn,PetscInt *np,PetscScalar *pcoeff,PetscErrorCode *ierr)
     67: {
     68:   PetscScalar *ocoeff;
     69:   PetscInt    n;

     71:   CHKFORTRANNULLINTEGER(np);
     72:   CHKFORTRANNULLSCALAR(pcoeff);
     73:   *ierr = FNRationalGetNumerator(*fn,&n,&ocoeff); if (*ierr) return;
     74:   if (pcoeff && ocoeff) { *ierr = PetscArraycpy(pcoeff,ocoeff,n); if (*ierr) return; }
     75:   if (np) *np = n;
     76:   *ierr = PetscFree(ocoeff);
     77: }

     79: SLEPC_EXTERN void fnrationalgetnumerator0_(FN *fn,PetscInt *np,PetscScalar *qcoeff,PetscErrorCode *ierr)
     80: {
     81:   fnrationalgetnumerator_(fn,np,qcoeff,ierr);
     82: }

     84: SLEPC_EXTERN void fnrationalgetnumerator1_(FN *fn,PetscInt *np,PetscScalar *qcoeff,PetscErrorCode *ierr)
     85: {
     86:   fnrationalgetnumerator_(fn,np,qcoeff,ierr);
     87: }

     89: SLEPC_EXTERN void fnrationalgetdenominator_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
     90: {
     91:   PetscScalar *ocoeff;
     92:   PetscInt    n;

     94:   CHKFORTRANNULLINTEGER(nq);
     95:   CHKFORTRANNULLSCALAR(qcoeff);
     96:   *ierr = FNRationalGetDenominator(*fn,&n,&ocoeff); if (*ierr) return;
     97:   if (qcoeff && ocoeff) { *ierr = PetscArraycpy(qcoeff,ocoeff,n); if (*ierr) return; }
     98:   if (nq) *nq = n;
     99:   *ierr = PetscFree(ocoeff);
    100: }

    102: SLEPC_EXTERN void fnrationalgetdenominator0_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
    103: {
    104:   fnrationalgetdenominator_(fn,nq,qcoeff,ierr);
    105: }

    107: SLEPC_EXTERN void fnrationalgetdenominator1_(FN *fn,PetscInt *nq,PetscScalar *qcoeff,PetscErrorCode *ierr)
    108: {
    109:   fnrationalgetdenominator_(fn,nq,qcoeff,ierr);
    110: }