octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #7417] Enhancement for vec ()


From: Judd Storrs
Subject: [Octave-patch-tracker] [patch #7417] Enhancement for vec ()
Date: Wed, 15 Dec 2010 18:22:35 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Ubuntu/10.04 Chromium/8.0.552.215 Chrome/8.0.552.215 Safari/534.10

URL:
  <http://savannah.gnu.org/patch/?7417>

                 Summary: Enhancement for vec ()
                 Project: GNU Octave
            Submitted by: judd
            Submitted on: Wed 15 Dec 2010 06:22:34 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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 <address@hidden>
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

}




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 15 Dec 2010 06:22:34 PM GMT  Name: Fvec.changeset  Size: 3kB   By:
judd
Changeset against 11370:690181867e54
<http://savannah.gnu.org/patch/download.php?file_id=22209>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?7417>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]