DenseLinAlgPack_DMatrixInFunc.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef GENMATRIX_IN_FUNC_H
00030 #define GENMATRIX_IN_FUNC_H
00031 
00032 #include "DenseLinAlgPack_IOBasic.hpp"
00033 
00034 namespace DenseLinAlgPack {
00035 
00036 /* * @name DMatrix/DMatrixSlice input stream functions.
00037   *
00038   * These are functions that are used to read a DMatrix or DMatrixSlice object in from a
00039   * formated input stream.
00040   *
00041   * The input format is diferent depending on the on whether the bit
00042   * #LinAlgPackIO::ignore_dim_bit# is set.
00043   * If #exta_flags & LinAlgPackIO::ignore_dim_bit != 0# then the input format is:
00044   *
00045   * Case 1\\
00046   * #m  n#\\
00047   * #gm(1,1) gm(1,2) gm(1,3) ... gm(1,n)#\\
00048   * #gm(2,1) gm(2,2) gm(2,3) ... gm(2,n)#\\
00049   * #   .       .       .           .#\\
00050   * #gm(m,1) gm(m,2) gm(m,3) ... gm(m,n)#\\
00051   *
00052   * If #exta_flags & LinAlgPackIO::ignore_dim_bit == 0# then the input format is:
00053   *
00054   * Case 2\\
00055   * #gm(1,1) gm(1,2) gm(1,3) ... gm(1,n)#\\
00056   * #gm(2,1) gm(2,2) gm(2,3) ... gm(2,n)#\\
00057   * #   .       .       .           .#\\
00058   * #gm(m,1) gm(m,2) gm(m,3) ... gm(m,n)#\\
00059   *
00060   * The numbers of the input must be seperated by white space (the line breaks are
00061   * for looks only) and be valid C language numeric constants.
00062   *
00063   * In addition, comment lines may be inserted between rows of the input matrix.
00064   * These comment lines take the form of Fortan comment lines in that they start on
00065   * new lines (after a '\n' char) with a '*' char and end at the end of a line
00066   * ('\n' terminated).  After the elements for a row are read in the function
00067   * #eat_comment_lines(is,'*');# is called.
00068   *
00069   * For example, the input format for the matrix {1.1 1.2; 2.1 2.2}
00070   * with comments for case 1 is:
00071   *
00072   * #2  2#\\
00073   * #* This is the first row#\\
00074   * #1.1  1.2#\\
00075   * #* This is the second row#\\
00076   * #2.1  2.1#\\
00077   *
00078   * And for case 2 is:
00079   *
00080   * #* This is the first row#\\
00081   * #1.1  1.2#\\
00082   * #* This is the second row#\\
00083   * #2.1  2.1#\\
00084   *
00085   * It is permisible for the dimension #m# and #n# in case 1 to be 0.
00086   * In this case there will be no elements.  So to input an empty matrix you would use:
00087   *
00088   * #0  0#\\
00089   *
00090   * If one of the dimenstions is zero but not the other then a #std::length_error# 
00091   * exception will be thrown.
00092   * If any of the input operations fails then a LinAlgPackIO::InputException exception
00093   * is thrown.  In other words if #is.fail()# or #is.eof()# is true
00094   * before all of the elements have been read in then the exception is thrown.
00095   * Also if the stream becomes corrupted (#is.bad() == true#) then a #std::ios_base::failure#
00096   * exception is thrown. 
00097   */
00098 // @{
00099 
00101 /* * DMatrix input stream function.
00102   *
00103   * Inputs a DMatrix object from an input stream.
00104   * If #exta_flags & LinAlgPackIO::ignore_dim_bit != 0# then #gm# is resized to #m# x #n#
00105   * given in the file.  If #exta_flags & LinAlgPackIO::ignore_dim_bit == 0#
00106   * then the number of elements read in depends on the current dimension of #gm#.
00107   */
00108 std::istream& input(std::istream& is, DMatrix* gm, LinAlgPackIO::fmtflags extra_flags);
00109 
00111 /* * DMatrixSlice input stream function.
00112   *
00113   * Inputs a DMatrixSlice object from an input stream.
00114   * If #exta_flags & LinAlgPackIO::ignore_dim_bit != 0# then the dimension (sized) of #gms#
00115   * is compared to the #m# and #n# given in the file and if they are not equal
00116   * then a #LinAlgPackIO::InputException# is thrown.  If #gms# is unsized then it is resized
00117   * to #m# x #n#.  If #exta_flags & LinAlgPackIO::ignore_dim_bit == 0# then the number of
00118   * elements read in depends on the current size of #gms#.
00119   */
00120 std::istream& input(std::istream& is, DMatrixSlice* gms, LinAlgPackIO::fmtflags extra_flags);
00121 
00122 // @}
00123 
00124 } // end namespace DenseLinAlgPack
00125 
00126 #endif  // GENMATRIX_IN_FUNC_H

Generated on Thu Sep 18 12:33:42 2008 for DenseLinAlgPack: Concreate C++ Classes for Dense Blas-Compatible Linear Algebra by doxygen 1.3.9.1