メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

Quad.h

解説を見る。
00001 /*
00002 
00003 Copyright (C) 1996, 1997 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 2, or (at your option) any
00010 later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 */
00022 
00023 #if !defined (octave_Quad_h)
00024 #define octave_Quad_h 1
00025 
00026 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
00027 #pragma interface
00028 #endif
00029 
00030 #include <cfloat>
00031 #include <cmath>
00032 
00033 #include "dColVector.h"
00034 
00035 #if !defined (octave_Quad_typedefs)
00036 #define octave_Quad_typedefs 1
00037 
00038 typedef double (*integrand_fcn) (double x);
00039 
00040 #endif
00041 
00042 // XXX FIXME XXX -- would be nice to not have to have this global
00043 // variable.
00044 // Nonzero means an error occurred in the calculation of the integrand
00045 // function, and the user wants us to quit.
00046 extern int quad_integration_error;
00047 
00048 #include "Quad-opts.h"
00049 
00050 class
00051 Quad : public Quad_options
00052 {
00053  public:
00054 
00055   Quad (integrand_fcn fcn)
00056     : Quad_options (), f (fcn) { }
00057 
00058   virtual ~Quad (void) { }
00059 
00060   virtual double integrate (void)
00061     {
00062       int ier, neval;
00063       double abserr;
00064       return do_integrate (ier, neval, abserr);
00065     }
00066 
00067   virtual double integrate (int& ier)
00068     {
00069       int neval;
00070       double abserr;
00071       return do_integrate (ier, neval, abserr);
00072     }
00073 
00074   virtual double integrate (int& ier, int& neval)
00075     {
00076       double abserr;
00077       return do_integrate (ier, neval, abserr);
00078     }
00079 
00080   virtual double integrate (int& ier, int& neval, double& abserr)
00081     {
00082       return do_integrate (ier, neval, abserr);
00083     }
00084 
00085   virtual double do_integrate (int& ier, int& neval, double& abserr) = 0;
00086 
00087  protected:
00088 
00089   integrand_fcn f;
00090 };
00091 
00092 class
00093 DefQuad : public Quad
00094 {
00095  public:
00096 
00097   DefQuad (integrand_fcn fcn)
00098     : Quad (fcn), lower_limit (0.0), upper_limit (1.0), singularities () { }
00099 
00100   DefQuad (integrand_fcn fcn, double ll, double ul)
00101     : Quad (fcn), lower_limit (ll), upper_limit (ul), singularities () { }
00102 
00103   DefQuad (integrand_fcn fcn, double ll, double ul,
00104            const ColumnVector& sing)
00105     : Quad (fcn), lower_limit (ll), upper_limit (ul),
00106       singularities (sing) { }
00107 
00108   DefQuad (integrand_fcn fcn, const ColumnVector& sing)
00109     : Quad (fcn), lower_limit (0.0), upper_limit (1.0),
00110       singularities (sing) { }
00111 
00112   ~DefQuad (void) { }
00113 
00114   double do_integrate (int& ier, int& neval, double& abserr);
00115 
00116  private:
00117 
00118   double lower_limit;
00119   double upper_limit;
00120 
00121   ColumnVector singularities;
00122 };
00123 
00124 class
00125 IndefQuad : public Quad
00126 {
00127  public:
00128 
00129   enum IntegralType { bound_to_inf, neg_inf_to_bound, doubly_infinite };
00130 
00131   IndefQuad (integrand_fcn fcn)
00132     : Quad (fcn), bound (0.0), type (bound_to_inf) { }
00133 
00134   IndefQuad (integrand_fcn fcn, double b, IntegralType t)
00135     : Quad (fcn), bound (b), type (t) { }
00136 
00137   ~IndefQuad (void) { }
00138 
00139   double do_integrate (int& ier, int& neval, double& abserr);
00140 
00141  private:
00142 
00143   double bound;
00144   IntegralType type;
00145   int integration_error;
00146 };
00147 
00148 #endif
00149 
00150 /*
00151 ;;; Local Variables: ***
00152 ;;; mode: C++ ***
00153 ;;; End: ***
00154 */

Wed Dec 29 11:52:17 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送