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

CmplxAEPBAL.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 "CmplxAEPBAL.h"
00034 #include "dMatrix.h"
00035 #include "f77-fcn.h"
00036 
00037 extern "C"
00038 {
00039   F77_RET_T
00040   F77_FUNC (zgebal, ZGEBAL) (F77_CONST_CHAR_ARG_DECL,
00041                              const int&, Complex*, const int&, int&,
00042                              int&, double*, int&
00043                              F77_CHAR_ARG_LEN_DECL);
00044  
00045   F77_RET_T
00046   F77_FUNC (zgebak, ZGEBAK) (F77_CONST_CHAR_ARG_DECL,
00047                              F77_CONST_CHAR_ARG_DECL,
00048                              const int&, const int&, const int&, double*,
00049                              const int&, Complex*, const int&, int&
00050                              F77_CHAR_ARG_LEN_DECL
00051                              F77_CHAR_ARG_LEN_DECL);
00052 }
00053 
00054 int
00055 ComplexAEPBALANCE::init (const ComplexMatrix& a,
00056                          const std::string& balance_job)
00057 {
00058   int n = a.cols ();
00059 
00060   if (a.rows () != n)
00061     {
00062       (*current_liboctave_error_handler) ("AEPBALANCE requires square matrix");
00063       return -1;
00064     }
00065 
00066   int info;
00067   int ilo;
00068   int ihi;
00069 
00070   Array<double> scale (n);
00071   double *pscale = scale.fortran_vec ();
00072 
00073   balanced_mat = a;
00074   Complex *p_balanced_mat = balanced_mat.fortran_vec ();
00075 
00076   char job = balance_job[0];
00077 
00078   F77_XFCN (zgebal, ZGEBAL, (F77_CONST_CHAR_ARG2 (&job, 1),
00079                              n, p_balanced_mat, n, ilo, ihi,
00080                              pscale, info
00081                              F77_CHAR_ARG_LEN (1)));
00082 
00083   if (f77_exception_encountered)
00084     (*current_liboctave_error_handler) ("unrecoverable error in zgebal");
00085   else
00086     {
00087       balancing_mat = ComplexMatrix (n, n, 0.0);
00088       for (int i = 0; i < n; i++)
00089         balancing_mat.elem (i, i) = 1.0;
00090 
00091       Complex *p_balancing_mat = balancing_mat.fortran_vec ();
00092 
00093       char side = 'R';
00094 
00095       F77_XFCN (zgebak, ZGEBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
00096                                  F77_CONST_CHAR_ARG2 (&side, 1),
00097                                  n, ilo, ihi, pscale, n,
00098                                  p_balancing_mat, n, info
00099                                  F77_CHAR_ARG_LEN (1)
00100                                  F77_CHAR_ARG_LEN (1)));
00101 
00102       if (f77_exception_encountered)
00103         (*current_liboctave_error_handler) ("unrecoverable error in zgebak");
00104     }
00105 
00106   return info;
00107 }
00108 
00109 /*
00110 ;;; Local Variables: ***
00111 ;;; mode: C++ ***
00112 ;;; End: ***
00113 */

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