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

dbleAEPBAL.cc

解説を見る。
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 (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
00024 #pragma implementation
00025 #endif
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #include <config.h>
00029 #endif
00030 
00031 #include <string>
00032 
00033 #include "dbleAEPBAL.h"
00034 #include "f77-fcn.h"
00035 
00036 extern "C"
00037 {
00038   F77_RET_T
00039   F77_FUNC (dgebal, DGEBAL) (F77_CONST_CHAR_ARG_DECL,
00040                              const int&, double*, const int&, int&,
00041                              int&, double*, int&
00042                              F77_CHAR_ARG_LEN_DECL);
00043 
00044   F77_RET_T
00045   F77_FUNC (dgebak, DGEBAK) (F77_CONST_CHAR_ARG_DECL,
00046                              F77_CONST_CHAR_ARG_DECL,
00047                              const int&, const int&, const int&, double*,
00048                              const int&, double*, const int&, int&
00049                              F77_CHAR_ARG_LEN_DECL
00050                              F77_CHAR_ARG_LEN_DECL);
00051 }
00052 
00053 int
00054 AEPBALANCE::init (const Matrix& a, const std::string& balance_job)
00055 {
00056   int n = a.cols ();
00057 
00058   if (a.rows () != n)
00059     {
00060       (*current_liboctave_error_handler) ("AEPBALANCE requires square matrix");
00061       return -1;
00062     }
00063 
00064   int info;
00065   int ilo;
00066   int ihi;
00067 
00068   Array<double> scale (n);
00069   double *pscale = scale.fortran_vec ();
00070 
00071   balanced_mat = a;
00072   double *p_balanced_mat = balanced_mat.fortran_vec ();
00073 
00074   char job = balance_job[0];
00075 
00076   F77_XFCN (dgebal, DGEBAL, (F77_CONST_CHAR_ARG2 (&job, 1),
00077                              n, p_balanced_mat, n, ilo, ihi, pscale, info
00078                              F77_CHAR_ARG_LEN (1)));
00079 
00080   if (f77_exception_encountered)
00081     (*current_liboctave_error_handler) ("unrecoverable error in dgebal");
00082   else
00083     {
00084       balancing_mat = Matrix (n, n, 0.0);
00085       for (int i = 0; i < n; i++)
00086         balancing_mat.elem (i ,i) = 1.0;
00087 
00088       double *p_balancing_mat = balancing_mat.fortran_vec ();
00089 
00090       char side = 'R';
00091 
00092       F77_XFCN (dgebak, DGEBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
00093                                  F77_CONST_CHAR_ARG2 (&side, 1),
00094                                  n, ilo, ihi, pscale, n,
00095                                  p_balancing_mat, n, info
00096                                  F77_CHAR_ARG_LEN (1)
00097                                  F77_CHAR_ARG_LEN (1)));
00098 
00099       if (f77_exception_encountered)
00100         (*current_liboctave_error_handler) ("unrecoverable error in dgebak");
00101     }
00102 
00103   return info;
00104 }
00105 
00106 /*
00107 ;;; Local Variables: ***
00108 ;;; mode: C++ ***
00109 ;;; End: ***
00110 */

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