diff main/fixed/src/ov-fixed-complex.cc @ 5655:0924c374b60d octave-forge

Update fixed point code for 3.1.x. Minor bug in test code still present though code seems to work fine
author adb014
date Mon, 18 May 2009 03:18:11 +0000
parents f8d77845533f
children d84d2fea3c90
line wrap: on
line diff
--- a/main/fixed/src/ov-fixed-complex.cc	Sun May 17 20:06:45 2009 +0000
+++ b/main/fixed/src/ov-fixed-complex.cc	Mon May 18 03:18:11 2009 +0000
@@ -99,16 +99,9 @@
     case '(':
       {
 	if (type.length () == 1)
-	  {
-	    if (idx.front().valid_scalar_indices ()
-		&& rhs.is_scalar_type ()
-		&& rhs.is_numeric_type ())
-	      retval = rhs;
-	    else
-	      retval = numeric_assign (type, idx, rhs);
-	  }
-	else if ((type.length () == 2) && idx.front().valid_scalar_indices ()
-		 && rhs.is_scalar_type () && rhs.is_numeric_type ())
+	  retval = numeric_assign (type, idx, rhs);
+	else if ((type.length () == 2) && rhs.is_scalar_type () && 
+		 rhs.is_numeric_type ())
 	  {
 	    std::list<octave_value_list>::const_iterator p = idx.begin ();
 	    octave_value_list key_idx = *++p;
@@ -191,28 +184,19 @@
 octave_value
 octave_fixed_complex::do_index_op (const octave_value_list& idx, bool resize_ok)
 {
-  octave_value retval;
+  // XXX FIXME XXX -- this doesn't solve the problem of
+  //
+  //   a = 1; a([1,1], [1,1], [1,1])
+  //
+  // and similar constructions.  Hmm...
 
-  if (idx.valid_scalar_indices ())
-    retval = new octave_fixed_complex (scalar);
-  else
-    {
-      // XXX FIXME XXX -- this doesn't solve the problem of
-      //
-      //   a = 1; a([1,1], [1,1], [1,1])
-      //
-      // and similar constructions.  Hmm...
+  // XXX FIXME XXX -- using this constructor avoids narrowing the
+  // 1x1 matrix back to a scalar value.  Need a better solution
+  // to this problem.
 
-      // XXX FIXME XXX -- using this constructor avoids narrowing the
-      // 1x1 matrix back to a scalar value.  Need a better solution
-      // to this problem.
+  octave_value tmp (new octave_fixed_complex_matrix (fixed_complex_matrix_value ()));
 
-      octave_value tmp (new octave_complex_matrix (complex_matrix_value ()));
-
-      retval = tmp.do_index_op (idx, resize_ok);
-    }
-
-  return retval;
+  return  tmp.do_index_op (idx, resize_ok);
 }
 
 FixedPoint