Mercurial > hg > octave-nkf
changeset 3972:c21bb69ea262
[project @ 2002-07-03 18:58:51 by jwe]
author | jwe |
---|---|
date | Wed, 03 Jul 2002 18:58:51 +0000 |
parents | 41e7fa40ff4c |
children | 826092b5665e |
files | src/ChangeLog src/data.cc |
diffstat | 2 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-07-03 John W. Eaton <jwe@bevo.che.wisc.edu> + + * data.cc (make_diag const octave_value&, const octave_value&): + Allow first arg to be 1x0 or 0x1. + 2002-07-02 John W. Eaton <jwe@bevo.che.wisc.edu> * defaults.cc (loadpath): Comment out previous change.
--- a/src/data.cc +++ b/src/data.cc @@ -317,6 +317,9 @@ DATA_REDUCTION (cumsum); } +// XXX FIXME XXX -- we could eliminate some duplicate code here with +// some template functions or macros. + static octave_value make_diag (const Matrix& v, int k) { @@ -480,10 +483,10 @@ int nr = m.rows (); int nc = m.columns (); - if (nr == 0 || nc == 0) + if (nr == 1 || nc == 1) + retval = make_diag (m, k); + else if (nr == 0 || nc == 0) retval = Matrix (); - else if (nr == 1 || nc == 1) - retval = make_diag (m, k); else { ColumnVector d = m.diag (k); @@ -500,10 +503,10 @@ int nr = cm.rows (); int nc = cm.columns (); - if (nr == 0 || nc == 0) + if (nr == 1 || nc == 1) + retval = make_diag (cm, k); + else if (nr == 0 || nc == 0) retval = Matrix (); - else if (nr == 1 || nc == 1) - retval = make_diag (cm, k); else { ComplexColumnVector d = cm.diag (k);