conv.m compatibility

View: New views
6 Messages — Rating Filter:   Alert me  

conv.m compatibility

by cctsim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Description:
conv.m is not compatible with matlab.

In matlab b controls whether y is a
column or row vector.
Example (matlab):
>> a=ones(1,5);
>> b=ones(1,5);
>> size(conv(a,b))
ans =
     1     9
>> size(conv(a.',b))
ans =
     1     9
>> size(conv(a,b.'))
ans =
     9     1

In octave y is always a row vector.
 
Possible patch:

--- conv.m.orig 2005-07-06 23:21:30.001000000 +0100
+++ conv.m 2005-07-16 19:52:54.421875000 +0100
@@ -52,8 +52,10 @@
   if (rows (a) > 1)
     a = reshape (a, 1, la);
   endif
+  bc=0;
   if (rows (b) > 1)
     b = reshape (b, 1, lb);
+    bc=1; ## Flag that b is a column vector
   endif
 
   ## Use the shortest vector as the coefficent vector to filter.
@@ -73,4 +75,9 @@
     y = filter (b, 1, x);
   endif
 
+  ## Compatibility
+  if (bc==1)
+     y=y.';
+  endif
+
 endfunction



Best Regards
cctsim


               
___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------


conv.m compatibility

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 16-Jul-2005, cctsim wrote:

| Description:
| conv.m is not compatible with matlab.
|
| In matlab b controls whether y is a
| column or row vector.
| Example (matlab):
| >> a=ones(1,5);
| >> b=ones(1,5);
| >> size(conv(a,b))
| ans =
|      1     9
| >> size(conv(a.',b))
| ans =
|      1     9
| >> size(conv(a,b.'))
| ans =
|      9     1
|
| In octave y is always a row vector.

Are you sure this is not a bug in Matlab?  Nearly all other polynomial
operations return row vectors, and this feature does not seem to be
documented.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------


Re: conv.m compatibility

by schi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
John W. Eaton wrote:
On 16-Jul-2005, cctsim wrote:

| Description:
| conv.m is not compatible with matlab.
|
| In matlab b controls whether y is a
| column or row vector.
| Example (matlab):
| >> a=ones(1,5);
| >> b=ones(1,5);
| >> size(conv(a,b))
| ans =
|      1     9
| >> size(conv(a.',b))
| ans =
|      1     9
| >> size(conv(a,b.'))
| ans =
|      9     1
|
| In octave y is always a row vector.

Are you sure this is not a bug in Matlab?  Nearly all other polynomial
operations return row vectors, and this feature does not seem to be
documented.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------
I am not sure about our current understanding whether Matlab might have a bug or octave by not following its conventions... at least I am currently looking through some wired code that depends on this behaviour ("feature"?) of the other brand, and so I want to bring this issue to your attention again: Should we adopt to Matlabs behaviour or not?

Rolf

Re: conv.m compatibility

by Moritz Borgmann-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 5:03 Uhr -0700 2008-04-14, Rolf Schirmacher wrote:

>  > | In matlab b controls whether y is a
>>  | column or row vector.
>>  | Example (matlab):
>>  | >> a=ones(1,5);
>>  | >> b=ones(1,5);
>>  | >> size(conv(a,b))
>>  | ans =
>>  |      1     9
>>  | >> size(conv(a.',b))
>>  | ans =
>>  |      1     9
>>  | >> size(conv(a,b.'))
>>  | ans =
>  > |      9     1
>  > | In octave y is always a row vector.
>  >
>  > Are you sure this is not a bug in Matlab?  Nearly all other polynomial
>>  operations return row vectors, and this feature does not seem to be
>>  documented.
>>
>  > jwe
>
>I am not sure about our current understanding whether Matlab might have a
>bug or octave by not following its conventions... at least I am currently
>looking through some wired code that depends on this behaviour ("feature"?)
>of the other brand, and so I want to bring this issue to your attention
>again: Should we adopt to Matlabs behaviour or not?

see my recent thread

http://www.nabble.com/conv-does-not-preverve-orientation-of-input-td16342836.html

Matlab's behavior is even weirder than the description given in the
2005 bug report cited by you, see my original post.

After the discussion, I tend to retract my original patch in favor of
another one that doesn't change functionality, but makes the output
orientation explicit in the documentation - and fix the code that
makes assumptions about the orientation of the output.

-M
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

Re: conv.m compatibility

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 14-Apr-2008, Moritz Borgmann wrote:

| After the discussion, I tend to retract my original patch in favor of
| another one that doesn't change functionality, but makes the output
| orientation explicit in the documentation - and fix the code that
| makes assumptions about the orientation of the output.

Was there a patch submitted for this change?  If so, I think I missed it.

jwe
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

Re: conv.m compatibility

by Moritz Borgmann-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

no, sorry. I haven't found the time yet to prepare a patch; only my
original one that makes Octave compatible (with all the quirks
involved) from 2008-03-28 is available right now. Will follow up as
soon as I find time.

-M

At 8:43 Uhr -0400 2008-04-20, John W. Eaton wrote:

>On 14-Apr-2008, Moritz Borgmann wrote:
>
>| After the discussion, I tend to retract my original patch in favor of
>| another one that doesn't change functionality, but makes the output
>| orientation explicit in the documentation - and fix the code that
>| makes assumptions about the orientation of the output.
>
>Was there a patch submitted for this change?  If so, I think I missed it.
>
>jwe

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave