help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vectorize problem?


From: David Bateman
Subject: Re: vectorize problem?
Date: Sat, 02 Jul 2005 19:23:21 +0200
User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

Ok, I didn't notice that when I coded that stuff. I hope the argnames function doesn't have to have the same treatment as that would mean that the string would have to be converted to an inline function first so that the variables of the function can be easily extracted. In any case the formula function won't need changing as that wouldn't make any sense...

D.

2005-07-01  David Bateman <address@hidden>

   * ov-fcn-inline.cc (Fvectorize): Allow string arguments

--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary

*** src/ov-fcn-inline.cc~       2005-04-26 21:28:31.000000000 +0200
--- src/ov-fcn-inline.cc        2005-07-02 19:09:33.340277664 +0200
***************
*** 810,822 ****
  
    if (nargin == 1)
      {
!       octave_fcn_inline* old = args(0).fcn_inline_value (true);
  
!       if (old)
        {
!         std::string old_func = old->fcn_text ();
!         std::string new_func;
  
          size_t i = 0;
  
          while (i < old_func.length ())
--- 810,835 ----
  
    if (nargin == 1)
      {
!       std::string old_func;
!       octave_fcn_inline* old = 0;
!       bool func_is_string = true;
  
!       if (args(0).is_string ())
!       old_func = args(0).string_value ();
!       else
        {
!         old = args(0).fcn_inline_value (true);
!         func_is_string = false;
! 
!         if (old)
!           old_func = old->fcn_text ();
!         else
!           error ("vectorize: must be a string or inline function");
!       }
  
+       if (! error_state)
+       {
+         std::string new_func;
          size_t i = 0;
  
          while (i < old_func.length ())
***************
*** 840,849 ****
              i++;
            }
  
!         retval = octave_value (new octave_fcn_inline (new_func, 
old->fcn_arg_names ()));
        }
-       else
-       error ("vectorize: must be an inline function");
      }
    else
      print_usage ("vectorize");
--- 853,864 ----
              i++;
            }
  
!         if (func_is_string)
!           retval = octave_value (new_func);
!         else
!           retval = octave_value (new octave_fcn_inline 
!                                  (new_func, old->fcn_arg_names ()));
        }
      }
    else
      print_usage ("vectorize");

reply via email to

[Prev in Thread] Current Thread [Next in Thread]