bugGNU Octave - Bugs: bug #30418, Improved initial vector for normest

 
 

bug #30418: Improved initial vector for normest

Submitted by:  Marco Caliari <caliari>
Submitted on:  Mon 12 Jul 2010 08:18:25 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.3.51Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 14 Jul 2010 05:45:57 PM UTC, comment #3:

Thanks for improving Octave. I committed your patch in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/c69252eb2f2b).

While I was there I also improved the documentation some and added better input validation.

Rik <rik5>
Project Administrator
Wed 14 Jul 2010 07:24:59 AM UTC, comment #2:

Thanks for the suggestions. Enclosed, a new diff w.r.t the original 3.3.51.

Marco

(file #20971)

Marco Caliari <caliari>
Project Member
Tue 13 Jul 2010 04:16:29 PM UTC, comment #1:

I took a look at the patch and I have three suggestions.

1) The octave coding guidelines call for a space between commas in function calls. rand(n,1) => rand(n, 1). This should be easy to fix.

2) In %test code blocks you don't need assign values to variables and then use assert to test whether those variables are equal. You can directly use assert on function calls.
%! rhoest = normest (A);
%! rho = norm (A);
%! assert (rhoest, rho, 1e-6);

could just be
%! assert(normest (A), norm (A), 1e-6);

3) The shape of the code looks like

A) Execute { loop 0 operations }
B) while (condition) { perform loop 1-N operations }

The loop code is duplicated. It appears outside the loop and inside the loop. If you want the loop to always execute once then, rather than using a while() control structure, you could try a do-until structure. I know that you just inherited the original code from normest, but it seems like it is worth fixing this at this time.

Rik <rik5>
Project Administrator
Mon 12 Jul 2010 08:18:25 AM UTC, original submission:

Dear maintainers,

I'm sending a patch against normest.m (3.3.51) with the choice of the initial vector as discussed here

http://www-old.cae.wisc.edu/pipermail/octave-maintainers/2010-February/014994.html

Moreover, I changed a little bit the flow and added a couple of tests.

Best regards,

Marco

2010-07-08  Marco Caliari  <marco.caliari@univr.it>

       * normest.m: Set the random "state" of the initial vector to trace(A).

Marco Caliari <caliari>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #20971:  normest.m.diff added by caliari (1KiB - text/x-patch)
file #20944:  normest.m.diff added by caliari (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by caliari (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 14 Jul 2010 05:45:57 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Wed 14 Jul 2010 07:24:59 AM UTCcaliariAttached File-=>Added normest.m.diff, #20971
    Mon 12 Jul 2010 08:18:25 AM UTCcaliariAttached File-=>Added normest.m.diff, #20944

    Back to the top


    Powered by Savane 3.1-cleanup1