Mercurial > hg > octave-nkf
changeset 3307:b6c74a0772b5
[project @ 1999-10-21 03:09:52 by jwe]
author | jwe |
---|---|
date | Thu, 21 Oct 1999 03:09:53 +0000 |
parents | b3bef983b12d |
children | 7ae1928ca623 |
files | src/ChangeLog src/data.cc |
diffstat | 2 files changed, 9 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 1999-10-20 John W. Eaton <jwe@bevo.che.wisc.edu> + * data.cc (make_diag (const octave_value&, const octave_value&)): + Delete special cases for scalars and simply attempt conversion of + first arg to a matrix value. If that fails, we will still see an + error message. + * Makefile.in (DISTFILES): Add mkgendoc to the list. 1999-10-19 John W. Eaton <jwe@bevo.che.wisc.edu>
--- a/src/data.cc +++ b/src/data.cc @@ -453,33 +453,12 @@ return retval; } - int n = ABS (k) + 1; - if (a.is_real_type ()) { - if (a.is_scalar_type ()) - { - double d = a.double_value (); + Matrix m = a.matrix_value (); - if (k == 0) - retval = d; - else if (k > 0) - { - Matrix m (n, n, 0.0); - m (0, k) = d; - retval = m; - } - else if (k < 0) - { - Matrix m (n, n, 0.0); - m (-k, 0) = d; - retval = m; - } - } - else if (a.is_matrix_type ()) + if (! error_state) { - Matrix m = a.matrix_value (); - int nr = m.rows (); int nc = m.columns (); @@ -493,34 +472,13 @@ retval = d; } } - else - gripe_wrong_type_arg ("diag", a); } else if (a.is_complex_type ()) { - if (a.is_scalar_type ()) - { - Complex c = a.complex_value (); + ComplexMatrix cm = a.complex_matrix_value (); - if (k == 0) - retval = c; - else if (k > 0) - { - ComplexMatrix m (n, n, 0.0); - m (0, k) = c; - retval = m; - } - else if (k < 0) - { - ComplexMatrix m (n, n, 0.0); - m (-k, 0) = c; - retval = m; - } - } - else if (a.is_matrix_type ()) + if (! error_state) { - ComplexMatrix cm = a.complex_matrix_value (); - int nr = cm.rows (); int nc = cm.columns (); @@ -534,8 +492,6 @@ retval = d; } } - else - gripe_wrong_type_arg ("diag", a); } else gripe_wrong_type_arg ("diag", a);