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

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

[Octave-bug-tracker] [bug #33292] trapz on matrices does not allow a vec


From: Rik
Subject: [Octave-bug-tracker] [bug #33292] trapz on matrices does not allow a vector as first argument
Date: Sat, 14 May 2011 17:22:21 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

Update of bug #33292 (project octave):

                  Status:         Patch Submitted => Fixed                  
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #5:

I checked in changes to the stable branch
(http://hg.savannah.gnu.org/hgweb/octave/rev/d8aff843a9e9) which correct this
bug.  To access the changes you will need to download from the Mercurial
archives and build from source, or wait for the 3.4.1 release.  Instructions
for downloading the source code are here
(http://www.gnu.org/software/octave/download.html)

For Jordi, I took a slightly different approach from your patch.  In your
patch the pseudocode was

unwind_protect block
{
  expand x to size of y with bsxfun
  recursively call trapz with new x, old y matrices
}

If y is a large ND-array, then reproducing x to be the same size as y can be
wasteful of memory.  I also guessed that the overhead of an unwind_protect
block and an extra function call might be heavy.  Instead I tried something
like this

extra_input_validation (which obviates unwind_protect)
{
  reshape x vector to point along correct dimension
  use bsxfun to implement trapz computation between a vector and a matrix
}

Benchmarking showed the new approach to take 84% less time.  I didn't
investigate further, so I still don't know which code construct is actually
responsible for the slowdown.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33292>

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




reply via email to

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