# HG changeset patch # User Jaroslav Hajek # Date 1228989858 -3600 # Node ID c1bada868690320b88ca28adccce44d419a585a0 # Parent d95282fa057941c06d2299cede744b32a34d9547 alow single/double conversion of diag & perm matrices diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-12-11 Jaroslav Hajek + + * ov-re-mat.cc (Fdouble): Handle diagonal & perm matrices. + * ov-flt-re-mat.cc (Fsingle): Handle diagonal & perm matrices. + 2008-12-11 Jaroslav Hajek * ov-base-diag.cc (octave_base_diag::subsasgn): New method. diff --git a/src/ov-flt-re-mat.cc b/src/ov-flt-re-mat.cc --- a/src/ov-flt-re-mat.cc +++ b/src/ov-flt-re-mat.cc @@ -56,6 +56,9 @@ #include "ov-flt-re-mat.h" #include "ov-flt-cx-mat.h" #include "ov-re-sparse.h" +#include "ov-flt-re-diag.h" +#include "ov-flt-cx-diag.h" +#include "ov-flt-perm.h" #include "ov-type-conv.h" #include "pr-output.h" #include "variables.h" @@ -804,7 +807,22 @@ if (args.length () == 1) { - if (args(0).is_sparse_type ()) + if (args(0).is_perm_matrix ()) + { + OCTAVE_TYPE_CONV_BODY3 (single, octave_float_perm_matrix, octave_float_scalar); + } + else if (args(0).is_diag_matrix ()) + { + if (args(0).is_complex_type ()) + { + OCTAVE_TYPE_CONV_BODY3 (single, octave_float_complex_diag_matrix, octave_float_complex); + } + else + { + OCTAVE_TYPE_CONV_BODY3 (single, octave_float_diag_matrix, octave_float_scalar); + } + } + else if (args(0).is_sparse_type ()) { error ("single: sparse type do not support single precision"); } diff --git a/src/ov-re-mat.cc b/src/ov-re-mat.cc --- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -55,6 +55,9 @@ #include "ov-complex.h" #include "ov-cx-mat.h" #include "ov-re-sparse.h" +#include "ov-re-diag.h" +#include "ov-cx-diag.h" +#include "ov-perm.h" #include "ov-type-conv.h" #include "pr-output.h" #include "variables.h" @@ -829,9 +832,24 @@ // inside their own scopes, and we don't declare retval here to // avoid a shadowed declaration warning. - if (args.length () == 1) + if (args(0).is_perm_matrix ()) + { + OCTAVE_TYPE_CONV_BODY3 (double, octave_perm_matrix, octave_scalar); + } + else if (args.length () == 1) { - if (args(0).is_sparse_type ()) + if (args(0).is_diag_matrix ()) + { + if (args(0).is_complex_type ()) + { + OCTAVE_TYPE_CONV_BODY3 (double, octave_complex_diag_matrix, octave_complex); + } + else + { + OCTAVE_TYPE_CONV_BODY3 (double, octave_diag_matrix, octave_scalar); + } + } + else if (args(0).is_sparse_type ()) { if (args(0).is_complex_type ()) {