bugGNU Octave - Bugs: bug #46340, move deg2rad/rad2deg from nurbs or...

 
 

bug #46340: move deg2rad/rad2deg from nurbs or mapping to core

Submitter:  None
Submitted:  Fri 30 Oct 2015 07:55:28 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 23 Nov 2015 08:46:30 PM UTC, comment #8: 

Philip Nienhuis on comment #7:

> Would that solution be useful for various other packages with functions shadowing core functions, like specfun, odepkg, tsa (detrend) ?


I don't see why not. I'm using the same approach on the image package because Matlab has moved a series of its function from their toolbox to its core.

Carnë Draug <carandraug>
Group Member
Mon 23 Nov 2015 06:34:04 PM UTC, comment #7: 

@Carnë:
Would that solution be useful for various other packages with functions shadowing core functions, like specfun, odepkg, tsa (detrend) ?

Philip Nienhuis <philipnienhuis>
Group Member
Mon 23 Nov 2015 01:00:15 PM UTC, comment #6: 

I have pushed a configure script for the mapping package so that it only includes those functions if they are not being supplied by core

http://hg.code.sf.net/p/octave/mapping/rev/81695768f6a9

Carnë Draug <carandraug>
Group Member
Mon 23 Nov 2015 03:17:04 AM UTC, comment #5: 

I added clean room implementations of rad2deg and deg2rad to the core in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/e44d904ac525).  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Sun 01 Nov 2015 03:14:37 PM UTC, comment #4: 

Agree with comment #3.  Matlab is a moving target and they often make one decision, only to reverse it later.

Conceptually, these are very trivial functions to implement so I don't see a problem with adding them to core.  They should probably go in the scripts/general directory along with other conversions like cart2pol.m.

Rik <rik5>
Group administrator
Sat 31 Oct 2015 07:18:15 PM UTC, comment #3: 

Matlab is crazy. Originally had rad2deg and deg2rad in the mapping toolbox.  Then it renamed those as radtodeg and degtorad, also in the mapping toolbox.  And now brings back rad2deg and deg2rad and places them in core.

Anyway, to answer the question, the function in nurbs and mapping have the same interface but the implementation in the mapping toolbox will be faster.  http://hg.code.sf.net/p/octave/mapping/rev/092dc26b88b7

If N is the number of angles, the implementation in mapping performs one division and N multiplications, while the one in nurbs performs N divisions and N multiplications.

Consider:


# deg2rad_nurbs
rad = pi*deg/180.0;

# rad2deg_mapping
rad = deg * (pi/180.0);


Carnë Draug <carandraug>
Group Member
Sat 31 Oct 2015 04:24:17 PM UTC, comment #2: 

Makes sense to me too :-)
Which one(s) is/are the best, or are the versions in nurbs and mapping identical?

Philip Nienhuis <philipnienhuis>
Group Member
Sat 31 Oct 2015 04:27:55 AM UTC, comment #1: 

Actually these functions are both in the nurbs package AND in the mapping package, so moving them to core really makes sense to me.

Carlo de Falco <cdf>
Group Member
Fri 30 Oct 2015 07:55:28 PM UTC, original submission:  

deg2rad/rad2deg have been introduced in matlab R2015b:

http://nl.mathworks.com/help/matlab/ref/deg2rad.html

For octave they are in the nurbs package

http://octave.sourceforge.net/nurbs/function/deg2rad.html

Maybe move these to core?




Anonymous

 

(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

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by cdf (Posted a comment)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-23 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-11-01 rik5 Severity3 - Normal 1 - Wish
        StatusNone Confirmed
    2015-10-31 carandraug Summarymove deg2rad/rad2deg from nurbs to core move deg2rad/rad2deg from nurbs or mapping to core

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code