bugGNU Octave - Bugs: bug #35666, wrong matrix division when...

 
 

bug #35666: wrong matrix division when normalizing columns

Submitter:  None
Submitted:  Wed 29 Feb 2012 11:48:47 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  jordigh
Originator Name:  Marko Seric Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 29 Feb 2012 09:55:52 PM UTC, comment #3: 

Okay, I made further modifications:

    http://hg.savannah.gnu.org/hgweb/octave/rev/62cb605af1af


Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 29 Feb 2012 06:05:43 PM UTC, comment #2: 

Your welcome.

There is one more little thing: you should really write


X = X / diag(s);


instead of


X = diag (s) / X;


otherwise the dimension of the matrix switches from k x n to n x k.

ps: maybe you could also add that broadcasting works since Octave v. 3.6.0 ?

Anonymous
Wed 29 Feb 2012 05:35:16 PM UTC, comment #1: 

Thanks, fixed here:

    http://hg.savannah.gnu.org/hgweb/octave/rev/dfb33a5723d2

Also added a note that this can also be done with broadcasting.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 29 Feb 2012 11:48:47 AM UTC, original submission:  

In Chapter "21.4 Some Examples of Usage", this is the code to normalize the columns of a matrix:


       s = norm (X, "columns");
       X = diag (s) \ X;


this produces an error with non-conformant operands:


       X = [1,2,3; 4 5 6];
       s = norm(X,"columns");
       X = diag(s) \ X;
       error: operator \: nonconformant arguments (op1 is 3x3, op2 is 2x3)


The correct way should be


X = X / diag(s)



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 (Updated the item)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-11 rik5 Open/ClosedOpen Closed
    2012-02-29 jordigh Open/ClosedClosed Open
    2012-02-29 rik5 Open/ClosedOpen Closed
    2012-02-29 jordigh StatusNone Fixed
        Assigned toNone jordigh
        Release3.2.3 dev

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code