bugGNU Octave - Bugs: bug #34778, norm fails when OPT argument is...

 
 

bug #34778: norm fails when OPT argument is given

Submitter:  Juan Pablo Carbajal <juanpi>
Submitted:  Tue 08 Nov 2011 05:37:49 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.3 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 01 Aug 2013 03:39:57 AM UTC, comment #5: 

The Matlab documentation doesn't have a 3-argument form with the "rows" or "cols" options. AFAICT those are an Octave extension so there's no problem with compatibility there. All I did was come up with rules that made sense to prevent things like norm(x,"cols","rows").

Mike Miller <mtmiller>
Group Member
Wed 31 Jul 2013 02:58:19 PM UTC, comment #4: 

Great! Did you check Matlab compatibility o those forbidden str combinations?

Thanks

Juan Pablo Carbajal <juanpi>
Group Member
Wed 31 Jul 2013 01:41:21 AM UTC, comment #3: 

Hi, I pushed the following fix for this bug:

http://hg.savannah.gnu.org/hgweb/octave/rev/00985134145e

I heavily modified your patch to handle different possible combinations of arguments, hopefully this meets your needs. Also implementing the "inf" case wasn't too hard.

Mike Miller <mtmiller>
Group Member
Wed 15 May 2013 12:15:57 PM UTC, comment #2: 

Hello all,

I am pinging this issue. Still there in
    > hg summ
    parent: 16666:af7287d567dc tip
    minor change to wording for previous change
    branch: default
    commit: 4639 unknown (clean)
    update: (current)

Is the patch still valid?

Juan Pablo Carbajal <juanpi>
Group Member
Tue 08 Nov 2011 07:37:18 PM UTC, comment #1: 

Ok,
I made a patch.
The "inf" case is not implemented when rows and cols are given, but an error is reported

I added some tests, two of them checking for the failure.

When run make test and got

src/data.cc ............................................ PASS  629/629

  PASS   7063
  FAIL      0

There were 2 expected failures (see fntests.log for details).



(file #24330)

Juan Pablo Carbajal <juanpi>
Group Member
Tue 08 Nov 2011 05:37:49 PM UTC, original submission:  


In function ./src/xnorm.cc line 97 and 138 the function to calculate norms along rows or columns are defined.

This functions are not working if the type of norm is selected.


> norm(rand(4,3),"fro","cols")

error: invalid conversion from string to real scalar

> norm(rand(4,3),"fro","rows")

error: invalid conversion from string to real scalar

I think the problem is an incorrect handling of the 2 string arguments case:

Built-in Function:  norm (A, P, OPT)

Because

> norm(rand(4,3),"rows")

and

> norm(rand(4,3),"cols")


work fine applying the l2 norm ("fro").

I tried to generate a patch but Ia m not yet successful.



Juan Pablo Carbajal <juanpi>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #24330:  changeset.patch added by juanpi (5KiB - text/x-patch - patch to norm when 3 arguments are given)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by juanpi (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-31 mtmiller CategoryNone Octave Function
        StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2011-11-08 jordigh StatusNone Patch Submitted
    2011-11-08 juanpi Attached File- Added changeset.patch, #24330

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code