changeset 19762:928ecc95f395

implement missing complex array extraction function * octave-value/ov-cx-mat.h, octave-value/ov-cx-mat.cc (octave_complex_matrix::array_value): New function.
author John W. Eaton <jwe@octave.org>
date Tue, 17 Feb 2015 00:44:06 -0500
parents 3c3b9fce7d2b
children 17a7e9f26e50
files libinterp/octave-value/ov-cx-mat.cc libinterp/octave-value/ov-cx-mat.h
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-cx-mat.cc	Tue Feb 17 00:42:25 2015 -0500
+++ b/libinterp/octave-value/ov-cx-mat.cc	Tue Feb 17 00:44:06 2015 -0500
@@ -142,6 +142,20 @@
   return retval;
 }
 
+NDArray
+octave_complex_matrix::array_value (bool force_conversion) const
+{
+  NDArray retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real matrix");
+
+  retval = ::real (matrix);
+
+  return retval;
+}
+
 Matrix
 octave_complex_matrix::matrix_value (bool force_conversion) const
 {
--- a/libinterp/octave-value/ov-cx-mat.h	Tue Feb 17 00:42:25 2015 -0500
+++ b/libinterp/octave-value/ov-cx-mat.h	Tue Feb 17 00:44:06 2015 -0500
@@ -110,6 +110,8 @@
   float float_scalar_value (bool frc_str_conv = false) const
   { return float_value (frc_str_conv); }
 
+  NDArray array_value (bool = false) const;
+
   Matrix matrix_value (bool = false) const;
 
   FloatMatrix float_matrix_value (bool = false) const;