44 #include "InputStreamHelperPack_EatInputComment.hpp"
45 #include "DenseLinAlgPack_DMatrixInFunc.hpp"
46 #include "DenseLinAlgPack_DVectorInFunc.hpp"
47 #include "DenseLinAlgPack_DMatrixClass.hpp"
53 std::istream& DenseLinAlgPack::input(std::istream& is, DMatrix* gm, LinAlgPackIO::fmtflags extra_flags) {
54 if( !(extra_flags & LinAlgPackIO::ignore_dim_bit) ) {
58 throw LinAlgPackIO::InputException(
"DenseLinAlgPack::input() {DMatrix}: "
59 "Input operation of matrix dimension failed. Check that the constant n "
60 "is a valid integer." );
62 throw std::ios_base::failure(
"DenseLinAlgPack::input() {DMatrix}: "
63 "Input operation failed because the stream became currupted." );
66 DMatrixSlice gms = (*gm)();
67 return input_gms(is,&gms,
"DenseLinAlgPack::input() {DMatrix}");
70 std::istream& DenseLinAlgPack::input(std::istream& is, DMatrixSlice* gms, LinAlgPackIO::fmtflags extra_flags) {
71 if( !(extra_flags & LinAlgPackIO::ignore_dim_bit) ) {
75 throw LinAlgPackIO::InputException(
"DenseLinAlgPack::input() {DMatrixSlice}: "
76 "Input operation of matrix dimension failed. Check that the constant n "
77 " is a valid integer.");
79 throw std::ios_base::failure(
"DenseLinAlgPack::input() {DMatrixSlice}: "
80 "Input operation failed because the stream became currupted." );
81 DenseLinAlgPack::assert_gms_lhs(*gms,m,n);
83 return input_gms( is, gms,
"DenseLinAlgPack::input() {DMatrixSlice}" );
101 if(!gms->
rows())
return is;
103 ios_base::iostate old_state = is.exceptions();
104 is.exceptions(ios_base::badbit | ios_base::failbit | ios_base::eofbit);
108 InputStreamHelperPack::eat_comment_lines(is,
'*');
109 DVectorSlice gms_row_i = gms->
row(i);
110 DenseLinAlgPack::input( is, &gms_row_i
111 , (DenseLinAlgPack::LinAlgPackIO::fmtflags)(DenseLinAlgPack::LinAlgPackIO::ignore_dim_bit) );
115 is.exceptions(old_state);
118 is.exceptions(old_state);
size_type rows() const
Return the number of rows.
DVectorSlice row(size_type i)
Return DVectorSlice object representing the ith row (1-based; 1,2,..,#this->rows()#, or throw std::out_of_range)