Mercurial > hg > octave-nkf
changeset 5157:8ca032643f55
[project @ 2005-02-23 00:18:58 by jwe]
author | jwe |
---|---|
date | Wed, 23 Feb 2005 00:18:58 +0000 |
parents | 7c3b22bafedc |
children | 955ed0dcdc5f |
files | src/ChangeLog src/ov-base-int.cc src/ov-bool-mat.cc src/ov-cell.cc src/ov-cx-mat.cc src/ov-re-mat.cc src/ov-str-mat.cc |
diffstat | 7 files changed, 80 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2005-02-22 John W. Eaton <jwe@octave.org> + * ov-base-int.cc (octave_baes_int_matrix<T>::load_binary): + Handle arrays with only one dimension. + * ov-bool-mat.cc (octave_bool_matrix::load_binary): Likewise. + * ov-cell.cc (octave_cell::load_binary): Likewise. + * ov-cell.cc (octave_complex_matrix::load_binary): Likewise. + * ov-re-mat.cc (octave_matrix::load_binary): Likewise. + * ov-str-mat.cc (octave_char_matrix_str::load_binary): Likewise. + * ov-mapper.cc (octave_mapper::subsref): Return retval after calling next_subsref.
--- a/src/ov-base-int.cc +++ b/src/ov-base-int.cc @@ -173,6 +173,18 @@ dv(i) = di; } + // Convert an array with a single dimension to be a row vector. + // Octave should never write files like this, other software + // might. + + if (mdims == 1) + { + mdims = 2; + dv.resize (mdims); + dv(1) = dv(0); + dv(0) = 1; + } + T m (dv); if (! is.read (X_CAST (char *, m.data ()), m.byte_size ()))
--- a/src/ov-bool-mat.cc +++ b/src/ov-bool-mat.cc @@ -334,6 +334,18 @@ dv(i) = di; } + // Convert an array with a single dimension to be a row vector. + // Octave should never write files like this, other software + // might. + + if (mdims == 1) + { + mdims = 2; + dv.resize (mdims); + dv(1) = dv(0); + dv(0) = 1; + } + int nel = dv.numel (); OCTAVE_LOCAL_BUFFER (char, htmp, nel); if (! is.read (htmp, nel))
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -668,6 +668,18 @@ dv(i) = di; } + // Convert an array with a single dimension to be a row vector. + // Octave should never write files like this, other software + // might. + + if (mdims == 1) + { + mdims = 2; + dv.resize (mdims); + dv(1) = dv(0); + dv(0) = 1; + } + int nel = dv.numel (); Cell tmp(dv);
--- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -421,6 +421,18 @@ dv(i) = di; } + // Convert an array with a single dimension to be a row vector. + // Octave should never write files like this, other software + // might. + + if (mdims == 1) + { + mdims = 2; + dv.resize (mdims); + dv(1) = dv(0); + dv(0) = 1; + } + if (! is.read (X_CAST (char *, &tmp), 1)) return false;
--- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -475,6 +475,18 @@ dv(i) = di; } + // Convert an array with a single dimension to be a row vector. + // Octave should never write files like this, other software + // might. + + if (mdims == 1) + { + mdims = 2; + dv.resize (mdims); + dv(1) = dv(0); + dv(0) = 1; + } + if (! is.read (X_CAST (char *, &tmp), 1)) return false;
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -475,6 +475,18 @@ dv(i) = di; } + // Convert an array with a single dimension to be a row vector. + // Octave should never write files like this, other software + // might. + + if (mdims == 1) + { + mdims = 2; + dv.resize (mdims); + dv(1) = dv(0); + dv(0) = 1; + } + charNDArray m(dv); char *tmp = m.fortran_vec (); is.read (tmp, dv.numel ());