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

CmplxCHOL.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 "CmplxCHOL.h"
00032 #include "f77-fcn.h"
00033 #include "lo-error.h"
00034 
00035 extern "C"
00036 {
00037   F77_RET_T
00038   F77_FUNC (zpotrf, ZPOTRF) (F77_CONST_CHAR_ARG_DECL,
00039                              const int&, Complex*, const int&, int&
00040                              F77_CHAR_ARG_LEN_DECL);
00041 }
00042 
00043 int
00044 ComplexCHOL::init (const ComplexMatrix& a)
00045 {
00046   int a_nr = a.rows ();
00047   int a_nc = a.cols ();
00048 
00049   if (a_nr != a_nc)
00050     {
00051       (*current_liboctave_error_handler)
00052         ("ComplexCHOL requires square matrix");
00053       return -1;
00054     }
00055 
00056   int n = a_nc;
00057   int info;
00058 
00059   chol_mat = a;
00060   Complex *h = chol_mat.fortran_vec ();
00061 
00062   F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, info
00063                              F77_CHAR_ARG_LEN (1)));
00064 
00065   if (f77_exception_encountered)
00066     (*current_liboctave_error_handler) ("unrecoverable error in zpotrf");
00067   else
00068     {
00069       // If someone thinks of a more graceful way of doing this (or
00070       // faster for that matter :-)), please let me know!
00071 
00072       if (n > 1)
00073         for (int j = 0; j < a_nc; j++)
00074           for (int i = j+1; i < a_nr; i++)
00075             chol_mat.elem (i, j) = 0.0;
00076     }
00077 
00078   return info;
00079 }
00080 
00081 /*
00082 ;;; Local Variables: ***
00083 ;;; mode: C++ ***
00084 ;;; End: ***
00085 */

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