comparison liboctave/dMatrix.cc @ 8999:dc07bc4157b8

allow empty matrices in stream input operators
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 20 Mar 2009 11:39:25 +0100
parents d91fa4b20bbb
children 8145f2255276
comparison
equal deleted inserted replaced
8998:a48fba01e4ac 8999:dc07bc4157b8
3056 operator >> (std::istream& is, Matrix& a) 3056 operator >> (std::istream& is, Matrix& a)
3057 { 3057 {
3058 octave_idx_type nr = a.rows (); 3058 octave_idx_type nr = a.rows ();
3059 octave_idx_type nc = a.cols (); 3059 octave_idx_type nc = a.cols ();
3060 3060
3061 if (nr < 1 || nc < 1) 3061 if (nr > 0 && nc > 0)
3062 is.clear (std::ios::badbit);
3063 else
3064 { 3062 {
3065 double tmp; 3063 double tmp;
3066 for (octave_idx_type i = 0; i < nr; i++) 3064 for (octave_idx_type i = 0; i < nr; i++)
3067 for (octave_idx_type j = 0; j < nc; j++) 3065 for (octave_idx_type j = 0; j < nc; j++)
3068 { 3066 {