diff liboctave/dRowVector.cc @ 10363:a0728e81ed25

improve diag matrix interface & implementation
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 26 Feb 2010 11:44:38 +0100
parents 07ebe522dac2
children 141b3fb5cef7
line wrap: on
line diff
--- a/liboctave/dRowVector.cc
+++ b/liboctave/dRowVector.cc
@@ -150,21 +150,13 @@
 RowVector
 real (const ComplexRowVector& a)
 {
-  octave_idx_type a_len = a.length ();
-  RowVector retval;
-  if (a_len > 0)
-    retval = RowVector (mx_inline_real_dup (a.data (), a_len), a_len);
-  return retval;
+  return do_mx_unary_op<double, Complex> (a, mx_inline_real);
 }
 
 RowVector
 imag (const ComplexRowVector& a)
 {
-  octave_idx_type a_len = a.length ();
-  RowVector retval;
-  if (a_len > 0)
-    retval = RowVector (mx_inline_imag_dup (a.data (), a_len), a_len);
-  return retval;
+  return do_mx_unary_op<double, Complex> (a, mx_inline_imag);
 }
 
 RowVector