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

Bounds.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 <iostream>
00032 
00033 #include "Bounds.h"
00034 #include "lo-error.h"
00035 
00036 // error handling
00037 
00038 void
00039 Bounds::error (const char* msg)
00040 {
00041   (*current_liboctave_error_handler) ("fatal bounds error: ", msg);
00042 }
00043 
00044 Bounds&
00045 Bounds::set_bounds (const ColumnVector l, const ColumnVector u)
00046 {
00047   if (l.capacity () != u.capacity ())
00048     {
00049       error ("inconsistent sizes for lower and upper bounds");
00050       return *this;
00051     }
00052 
00053   lb = l;
00054   ub = u;
00055 
00056   return *this;
00057 }
00058 
00059 Bounds&
00060 Bounds::set_lower_bounds (const ColumnVector l)
00061 {
00062   if (ub.capacity () != l.capacity ())
00063     {
00064       error ("inconsistent size for lower bounds");
00065       return *this;
00066     }
00067 
00068   lb = l;
00069 
00070   return *this;
00071 }
00072 
00073 Bounds&
00074 Bounds::set_upper_bounds (const ColumnVector u)
00075 {
00076   if (lb.capacity () != u.capacity ())
00077     {
00078       error ("inconsistent size for upper bounds");
00079       return *this;
00080     }
00081 
00082   ub = u;
00083 
00084   return *this;
00085 }
00086 
00087 std::ostream&
00088 operator << (std::ostream& os, const Bounds& b)
00089 {
00090   for (int i = 0; i < b.size (); i++)
00091     os << b.lower_bound (i) << " " << b.upper_bound (i) << "\n";
00092 
00093   return os;
00094 }
00095 
00096 /*
00097 ;;; Local Variables: ***
00098 ;;; mode: C++ ***
00099 ;;; End: ***
00100 */

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