Subversion Repositories slepc-dev

Rev

Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 dsic.upv.es!jroman 1
/*
2265 jroman 2
   This include file contains definitions of system functions. It is included
3
   by all other SLEPc include files.
1376 slepc 4
 
5
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1672 slepc 6
   SLEPc - Scalable Library for Eigenvalue Problem Computations
2575 eromero 7
   Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
1376 slepc 8
 
1672 slepc 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.
14
 
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.
19
 
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/>.
1376 slepc 22
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6 dsic.upv.es!jroman 23
*/
1376 slepc 24
 
6 dsic.upv.es!jroman 25
#if !defined(__SLEPC_H)
26
#define __SLEPC_H
27
 
28
/* ========================================================================== */
29
/*
2265 jroman 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"
34
 
35
/* ========================================================================== */
36
/*
6 dsic.upv.es!jroman 37
   Current SLEPc version number and release date
38
*/
39
#include "slepcversion.h"
2269 jroman 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, \
2316 jroman 44
                                         SLEPC_VERSION_PATCH,SLEPC_VERSION_PATCH_DATE)
2269 jroman 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.
6 dsic.upv.es!jroman 51
 
2269 jroman 52
    Input Parameter:
53
.   len - length of the string
54
 
55
    Output Parameter:
56
.   version - version string
57
 
58
    Level: developer
59
 
60
    Usage:
61
    char version[256];
62
    ierr = SlepcGetVersion(version,256);CHKERRQ(ierr)
63
 
64
    Fortran Note:
65
    This routine is not supported in Fortran.
66
M*/
67
 
6 dsic.upv.es!jroman 68
/* ========================================================================== */
69
/*
70
   The PETSc include files.
71
*/
2265 jroman 72
#include "petscsys.h"
6 dsic.upv.es!jroman 73
#include "petscvec.h"
74
#include "petscmat.h"
2283 jroman 75
/*
2345 jroman 76
    slepcvec.h contains extensions to PETSc Vec's
77
*/
78
#include "slepcvec.h"
79
/*
2283 jroman 80
    slepcimpl.h contains definitions common to all SLEPc objects
81
*/
82
#include "private/slepcimpl.h"
6 dsic.upv.es!jroman 83
 
2619 jroman 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
96
 
97
 
476 dsic.upv.es!antodo 98
PETSC_EXTERN_CXX_BEGIN
6 dsic.upv.es!jroman 99
/*
100
    Initialization of SLEPc and other system routines
101
*/
2428 jroman 102
extern PetscErrorCode SlepcInitialize(int*,char***,const char[],const char[]);
2240 jroman 103
extern PetscErrorCode SlepcFinalize(void);
104
extern PetscErrorCode SlepcInitializeFortran(void);
2428 jroman 105
extern PetscErrorCode SlepcInitialized(PetscBool*);
6 dsic.upv.es!jroman 106
 
2545 eromero 107
#undef __FUNCT__
108
#define __FUNCT__ "SlepcAbs"
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.
112
 
113
   Not Collective
114
 
115
   Input parameters:
116
.  x,y - the real numbers
117
 
118
   Output parameter:
119
.  return - the result
120
 
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);
126
 
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
}
133
 
134
 
2546 eromero 135
/*MC
2545 eromero 136
   SlepcAbsEigenvalue - Returns the absolute value of a complex number given
137
   its real and imaginary parts.
138
 
139
  Synopsis:
140
   PetscReal SlepcAbsEigenvalue(PetscScalar x,PetscScalar y)
141
   Not Collective
142
 
143
   Input parameters:
144
+  x  - the real part of the complex number
145
-  y  - the imaginary part of the complex number
146
 
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.
150
 
151
   Level: developer
152
 
2546 eromero 153
M*/
502 dsic.upv.es!antodo 154
#if !defined(PETSC_USE_COMPLEX)
2545 eromero 155
#define SlepcAbsEigenvalue(x,y) SlepcAbs(x,y)
502 dsic.upv.es!antodo 156
#else
157
#define SlepcAbsEigenvalue(x,y) PetscAbsScalar(x)
158
#endif
2240 jroman 159
extern PetscErrorCode SlepcMatConvertSeqDense(Mat,Mat*);
2294 jroman 160
extern PetscErrorCode SlepcMatTile(PetscScalar,Mat,PetscScalar,Mat,PetscScalar,Mat,PetscScalar,Mat,Mat*);
2538 jroman 161
extern PetscErrorCode SlepcCheckOrthogonality(Vec*,PetscInt,Vec *,PetscInt,Mat,PetscReal*);
877 dsic.upv.es!jroman 162
 
2216 jroman 163
extern PetscBool SlepcInitializeCalled;
1409 slepc 164
 
476 dsic.upv.es!antodo 165
PETSC_EXTERN_CXX_END
6 dsic.upv.es!jroman 166
#endif
167