Actual source code: slepcsys.h

  1: /*
  2:    This include file contains definitions of system functions. It is included
  3:    by all other SLEPc include files.

  5:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  7:    Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain

  9:    This file is part of SLEPc.
 10:       
 11:    SLEPc is free software: you can redistribute it and/or modify it under  the
 12:    terms of version 3 of the GNU Lesser General Public License as published by
 13:    the Free Software Foundation.

 15:    SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
 16:    WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
 17:    FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
 18:    more details.

 20:    You  should have received a copy of the GNU Lesser General  Public  License
 21:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: */


 28: /* ========================================================================== */
 29: /* 
 30:    slepcconf.h is created by the configure script and placed in ${PETSC_ARCH}/include.
 31:    It contains macro definitions set at configure time.
 32: */
 33: #include "slepcconf.h"

 35: /* ========================================================================== */
 36: /* 
 37:    Current SLEPc version number and release date
 38: */
 39:  #include slepcversion.h
 40: #define SLEPC_AUTHOR_INFO        "       The SLEPc Team\n    slepc-maint@grycap.upv.es\n http://www.grycap.upv.es/slepc\n"
 41: #if (SLEPC_VERSION_RELEASE == 1)
 42: #define SlepcGetVersion(version,len) PetscSNPrintf(version,len,"SLEPc Release Version %d.%d, Patch %d, %s", \
 43:                                          SLEPC_VERSION_MAJOR,SLEPC_VERSION_MINOR, \
 44:                                          SLEPC_VERSION_PATCH,SLEPC_VERSION_PATCH_DATE)
 45: #else
 46: #define SlepcGetVersion(version,len) PetscSNPrintf(version,len,"SLEPc Development SVN revision: %d  SVN Date: %s", \
 47:                                         SLEPC_VERSION_SVN, SLEPC_VERSION_DATE_SVN)
 48: #endif
 49: /*MC
 50:     SlepcGetVersion - Gets the SLEPc version information in a string.

 52:     Input Parameter:
 53: .   len - length of the string

 55:     Output Parameter:
 56: .   version - version string

 58:     Level: developer

 60:     Usage:
 61:     char version[256];
 62:     SlepcGetVersion(version,256);CHKERRQ(ierr)

 64:     Fortran Note:
 65:     This routine is not supported in Fortran.
 66: M*/

 68: /* ========================================================================== */
 69: /* 
 70:    The PETSc include files. 
 71: */
 72: #include "petscsys.h"
 73: #include "petscvec.h"
 74: #include "petscmat.h"
 75: /*
 76:     slepcvec.h contains extensions to PETSc Vec's
 77: */
 78:  #include slepcvec.h
 79: /*
 80:     slepcimpl.h contains definitions common to all SLEPc objects
 81: */
 82:  #include private/slepcimpl.h

 84: /*
 85:     Default tolerance for the different solvers, depending on the precision
 86: */
 87: #if defined(PETSC_USE_REAL_SINGLE)
 88: #  define SLEPC_DEFAULT_TOL   1e-6
 89: #elif defined(PETSC_USE_REAL_DOUBLE)
 90: #  define SLEPC_DEFAULT_TOL   1e-8
 91: #elif defined(PETSC_USE_REAL___FLOAT128)
 92: #  define SLEPC_DEFAULT_TOL   1e-16
 93: #else
 94: #  define SLEPC_DEFAULT_TOL   1e-7
 95: #endif


 99: /*
100:     Initialization of SLEPc and other system routines
101: */

109: /*@C
110:    SlepcAbs - Returns sqrt(x**2+y**2), taking care not to cause unnecessary
111:    overflow. It is based on LAPACK's DLAPY2.

113:    Not Collective

115:    Input parameters:
116: .  x,y - the real numbers

118:    Output parameter:
119: .  return - the result

121:    Level: developer
122: @*/
123: PETSC_STATIC_INLINE PetscReal SlepcAbs(PetscReal x,PetscReal y)
124: {
125:   PetscReal w,z,t,xabs=PetscAbs(x),yabs=PetscAbs(y);

127:   w = PetscMax(xabs,yabs);
128:   z = PetscMin(xabs,yabs);
129:   if (z == 0.0) return w;
130:   t = z/w;
131:   return w*PetscSqrtReal(1.0+t*t);
132: }


135: /*MC
136:    SlepcAbsEigenvalue - Returns the absolute value of a complex number given
137:    its real and imaginary parts.

139:   Synopsis:
140:    PetscReal SlepcAbsEigenvalue(PetscScalar x,PetscScalar y)
141:    Not Collective

143:    Input parameters:
144: +  x  - the real part of the complex number
145: -  y  - the imaginary part of the complex number

147:    Notes: 
148:    This function computes sqrt(x**2+y**2), taking care not to cause unnecessary
149:    overflow. It is based on LAPACK's DLAPY2.

151:    Level: developer

153: M*/
154: #if !defined(PETSC_USE_COMPLEX)
155: #define SlepcAbsEigenvalue(x,y) SlepcAbs(x,y)
156: #else
157: #define SlepcAbsEigenvalue(x,y) PetscAbsScalar(x)
158: #endif
162: 

166: #endif