bugGNU Octave - Bugs: bug #42691, vectorize(<anonymous...

 
 

bug #42691: vectorize(<anonymous function>) fails while <inline> works.

Submitter:  Colin Macdonald <cbm>
Submitted:  Sat 05 Jul 2014 09:58:18 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Aug 2021 05:50:15 AM UTC, comment #4: 

Thanks for checking.

Somehow this bug must have been fixed 🙂  For Octave 6.3.0 on openSUSE 15.3:


>> f = inline ('x*x + y*y'); char (f), char (vectorize (f))
ans = x*x + y*y
ans = x.*x + y.*y

>> g = @(x,y) x^2 + y^2, vectorize (g)
g =

@(x, y) x ^ 2 + y ^ 2

warning: vectorize is unreliable; its use is strongly discouraged
ans =

@(x, y) x .^ 2 + y .^ 2


Similar results for Matlab R2021a.

Kai Torben Ohlhus <siko1056>
Group Member
Wed 04 Aug 2021 05:40:10 AM UTC, comment #3: 

Looks like there has been some changes
Inline is obsolete.
vectorize anonymous function is possible


f = inline('x*x + y*y')
warning: inline is obsolete; use anonymous functions instead
f =

  <class inline>
g = @(x,y) x^2 + y^2
g =

@(x, y) x ^ 2 + y ^ 2
vectorize(f)
ans =

  <class inline>
vectorize(g)
warning: vectorize is unreliable; its use is strongly discouraged
ans =

@(x, y) x .^ 2 + y .^ 2


Anonymous
Thu 15 Dec 2016 06:01:31 PM UTC, comment #2: 

This issue is still present in Octave 4.2.0.

Hartmut <hardy>
Sun 06 Jul 2014 05:13:24 AM UTC, comment #1: 

Confirmed.  The C++ code is definitely set up only for strings and inline objects.

Rik <rik5>
Group administrator
Sat 05 Jul 2014 09:58:18 PM UTC, original submission:  

Both work in Matlab.

Example:

octave:12> f = inline('x*x + y*y')
f = f(x, y) = x*x + y*y
octave:13> g = @(x,y) x^2 + y^2
g =

@(x, y) x ^ 2 + y ^ 2

octave:14> vectorize(f)
ans = f(x, y) = x.*x + y.*y
octave:15> vectorize(g)
error: vectorize: FUN must be a string or inline function


Colin Macdonald <cbm>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by cbm (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-04 siko1056 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-01-04 rik5 Dependencies- bugs #49886 is dependent
    2014-07-06 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code