patchGNU Octave - Patches: patch #7417, Enhancement for vec ()

 
 

patch #7417: Enhancement for vec ()

Submitter:  Judd Storrs <judd>
Submitted:  Wed 15 Dec 2010 06:22:34 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Wed 22 Dec 2010 08:40:55 AM UTC, comment #3: 

I checked in this changeset with a few minor edits.

Thanks.

John W. Eaton <jwe>
Group administrator
Wed 15 Dec 2010 08:32:08 PM UTC, comment #2: 

There was a bug I overlooked -- vec(x,1) would try to reshape x to Nx0 instead of keeping it at Nx1. Updated changeset attached.

(file #22210)

Judd Storrs <judd>
Wed 15 Dec 2010 06:41:43 PM UTC, comment #1: 

The second "make check" failure disappeared after a clean recompile with the patch applied.

Judd Storrs <judd>
Wed 15 Dec 2010 06:22:34 PM UTC, original submission:  

I've been using bsxfun() lately and one annoyance is that it can be inelegant (e.g. requiring more care and thought than should be necessary) to create a vector with a desired dimensionality (esp. along higher dimensions when (:) and .' are no longer useful).  By "vector" I mean a K-dimensional array of N elements where all dimensions except for one dimension have size 1.

For example, indexing with (:) or vec() produces Nx1 vectors while ranges (e.g. 1:10) and linspace() produce 1xN vectors.

This patch adds an optional second argument to vec() that allows the dimension of the result to be set directly. With this patch:

  vec (a, dim)

becomes equivalent to:

  shiftdim (a(:), 1-dim)


The attached changeset is against:

changeset:   11370:690181867e54
user:        John W. Eaton <jwe@octave.org>
date:        Wed Dec 15 03:18:44 2010 -0500
summary:     ChangeLog fix


I see two "make check" failures with this patch applied.

1) This failure is seen both with and without the attached changeset applied. I do not believe this is related to the patch.

!!!!! test failed
assert (log2 (complex (0, Inf)),Inf + log2 (i)) expected
Inf + 2.266i
but got
Inf - NaNi
NaNs don't match

2) This failure occurs only when the patch is applied. It's not clear to me yet how this is related to the changeset, but I'm investigating.

!!!!! test failed
assert (norm (R1' R1 - R' R - single (uc uc'), Inf) < 1e1 eps ('single')) failed
shared variables {
  A =

     0.436997  -0.131721   0.124120  -0.061673
    -0.131721   0.738529   0.019851  -0.140295
     0.124120   0.019851   0.354879  -0.059472
    -0.061673  -0.140295  -0.059472   0.600939

  u =

     0.98950
     0.39844
     0.63484
     0.13351

  Ac =

     0.55855 + 0.00000i  -0.16621 - 0.03153i   0.01079 + 0.02364i  -0.02768 - 0.01861i
    -0.16621 + 0.03153i   0.67601 + 0.00000i   0.00115 - 0.04755i   0.01460 + 0.02476i
     0.01079 - 0.02364i   0.00115 + 0.04755i   0.62631 + 0.00000i  -0.15858 - 0.07198i
    -0.02768 + 0.01861i   0.01460 - 0.02476i  -0.15858 + 0.07198i   0.60342 + 0.00000i

  uc =

     0.54267 + 0.91519i
     0.99647 + 0.43141i
     0.83760 + 0.68977i
     0.39160 + 0.90378i

}

Judd Storrs <judd>

 

Attached Files

Attached Files
file #22209:  Fvec.changeset added by judd (2.6KiB - Changeset against 11370:690181867e54)

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by judd (Submitted the item)
  •  

    Votes

    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 logged-in users can vote.

     

    History

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-22 jwe Open/ClosedOpen Closed
    2010-12-22 jwe StatusNone Done
    2010-12-15 judd Attached File- Added Fvec.changeset.2, #22210
    2010-12-15 judd Attached File- Added Fvec.changeset, #22209

    Back to the top

    Powered by Savane 3.16-11ef.
    Corresponding source code