Mercurial > hg > octave-lyh
changeset 8454:aaf2b6d6813c
fix behaviour of "full"
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sat, 10 Jan 2009 08:46:23 +0100 |
parents | 9e1973f7709d |
children | fd11a08a9b31 |
files | src/ChangeLog src/DLD-FUNCTIONS/sparse.cc |
diffstat | 2 files changed, 16 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-01-10 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/sparse.cc (Ffull): Convert diagonal & permutation + matrices, leave other classes untouched. + 2009-01-09 Jaroslav Hajek <highegg@gmail.com> * OPERATORS/op-cdm-cdm.cc: Install missing widening op.
--- a/src/DLD-FUNCTIONS/sparse.cc +++ b/src/DLD-FUNCTIONS/sparse.cc @@ -352,7 +352,7 @@ DEFUN_DLD (full, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{FM} =} full (@var{SM})\n\ - returns a full storage matrix from a sparse one\n\ + returns a full storage matrix from a sparse, diagonal, permutation matrix or a range.\n\ @seealso{sparse}\n\ @end deftypefn") { @@ -373,10 +373,16 @@ else if (args(0).type_name () == "sparse bool matrix") retval = args(0).bool_matrix_value (); } - else if (args(0).is_real_type()) - retval = args(0).matrix_value(); - else if (args(0).is_complex_type()) - retval = args(0).complex_matrix_value(); + else if (args(0).is_diag_matrix () || args(0).is_perm_matrix ()) + { + octave_value_list idx; + idx(0) = idx(1) = ':'; + retval = args(0).do_index_op (idx); + } + else if (args(0).is_range ()) + retval = args(0).matrix_value (); + else if (args(0).is_matrix_type ()) + retval = args(0); else gripe_wrong_type_arg ("full", args(0));