diff liboctave/dRowVector.cc @ 7503:8c32f95c2639

convert mapper functions to new format
author David Bateman <dbateman@free.fr>
date Wed, 20 Feb 2008 04:22:50 -0500
parents 29980c6b8604
children 82be108cc558
line wrap: on
line diff
--- a/liboctave/dRowVector.cc	Wed Feb 20 01:09:19 2008 -0500
+++ b/liboctave/dRowVector.cc	Wed Feb 20 04:22:50 2008 -0500
@@ -30,6 +30,7 @@
 
 #include "Array-util.h"
 #include "f77-fcn.h"
+#include "functor.h"
 #include "lo-error.h"
 #include "mx-base.h"
 #include "mx-inlines.cc"
@@ -232,21 +233,15 @@
 // other operations
 
 RowVector
-RowVector::map (d_d_Mapper f) const
+RowVector::map (dmapper fcn) const
 {
-  RowVector b (*this);
-  return b.apply (f);
+  return MArray<double>::map<double> (func_ptr (fcn));
 }
 
-RowVector&
-RowVector::apply (d_d_Mapper f)
+ComplexRowVector
+RowVector::map (cmapper fcn) const
 {
-  double *d = fortran_vec (); // Ensures only one reference to my privates!
-
-  for (octave_idx_type i = 0; i < length (); i++)
-    d[i] = f (d[i]);
-
-  return *this;
+  return MArray<double>::map<Complex> (func_ptr (fcn));
 }
 
 double