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

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

[Octave-bug-tracker] [bug #33625] filter with dimension and empty SI doe


From: Oscar Yanez
Subject: [Octave-bug-tracker] [bug #33625] filter with dimension and empty SI does return error
Date: Tue, 22 Nov 2011 19:59:39 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20100101 Firefox/8.0

Follow-up Comment #8, bug #33625 (project octave):

Hello again,

I've been looking through this for the morning and I have a bunch of
information to share. First, let me confirm that the file filter.cc that comes
with the current 3.4.3 source download does not have the patch described in
this thread. So whoever builds from this source will encounter the filter()
problem.

Second, I added some debugging code to filter.cc and noticed that it doesn't
matter if the SI parameter in the function call is a row or a column vector
(it is expected to be a column vector), it always shows up in filter.cc as a
row vector (!!), and therefore si_dims(0) in line 93 is ALWAYS one. That makes
the test fail right there, because the state vector should be of length
ab_len-1, which is the value of si_dims(1) when the function is called with
the correct arguments. I changed that single index and the function works as
expected. Maybe I am overlooking errors further down in the code, but my tests
have run well.

Before transcribing some of my test code, may I ask why is it that SI ends up
being a row vector no matter what? I have little knowledge of the calling
process in octave, but it is clear that SI is changed.

The test code that follows filters a random signal in two different ways:
first, it filters the entire vector with zero initial state values; second, it
filters the vector in halfs, passing the state vectors from call to call.
Differences in the result should be negligible or zero and so they are:

octave:3> x = randn(1000,1);
octave:4> b = [0.2 0.4 0.2]; a = 1; si = zeros(2,1);
octave:5> y = filter(b,a,x,si);
octave:6> [y1,sf] = filter(b,a,x(1:500),si);
octave:7> y2 = filter(b,a,x(501:1000),sf);
octave:8> max(abs((y-[y1;y2])))
ans = 0

To corroborate the fact that SI is always made into a row vector, the call:

octave:12> y = filter(b,a,x,si);

works the same (with no error messages) as 

octave:13> y = filter(b,a,x,si');

after the change I propose. So, what do you think ?

Best,
Oscar

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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