Mercurial > hg > octave-lyh
diff liboctave/CNDArray.cc @ 8981:ed5055b0a476
fix & simplify ndarray->matrix conversions
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sat, 14 Mar 2009 19:42:50 +0100 |
parents | d91fa4b20bbb |
children | a48fba01e4ac |
line wrap: on
line diff
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -830,24 +830,11 @@ { ComplexMatrix retval; - int nd = ndims (); - - switch (nd) - { - case 1: - retval = ComplexMatrix (Array2<Complex> (*this, dimensions(0), 1)); - break; - - case 2: - retval = ComplexMatrix (Array2<Complex> (*this, dimensions(0), - dimensions(1))); - break; - - default: - (*current_liboctave_error_handler) - ("invalid conversion of ComplexNDArray to ComplexMatrix"); - break; - } + if (ndims () == 2) + retval = ComplexMatrix (Array2<Complex> (*this)); + else + (*current_liboctave_error_handler) + ("invalid conversion of ComplexNDArray to ComplexMatrix"); return retval; }