[Scilab-users] circshift() : Scilab Enhancement Proposal

Samuel Gougeon sgougeon at free.fr
Wed Jan 3 22:44:21 CET 2018


Thanks for your comments, Rafael.
I am answering in the body:

Le 03/01/2018 à 16:00, Rafael Guerra a écrit :
>
> Samuel,
>
> As requested, some further feedback on circshift:
>
>   * The proposed syntax seems to be compatible with Matlab’s circshift
>     while adding extra functionality, which is very positive
>
>   * To add to the wish list: if the input matrix represents a
>     regularly sampled function, it would be useful to have in Scilab a
>     generalization of circshift allowing non-integer shifts,
>

As far as i understand, you are addressing here an interpolation feature 
rather than an indices-shifting one.
IMO, this is a job much closer to existing interp#() functions than to 
circshift(). Interpolations modes usually propose options to process 
edges, and other ones to chose an interpolation mode (linear, splines ,etc).
This is far beyond and out of the purpose of circshift(), that does not 
change values, just indices.

>   * also to have option for non-circular shifts and for padding with zeros
>

Something like circshift(), without circ ;)
Padding is presently proposed throught resize_matrix(). But indeed, it 
does not propose left or top padded insertions.
This will become easy with circshift() as it is presently proposed. Example:

--> m = grand(3,4,"uin",0,9)
  m  =
    2.   5.   9.   3.
    2.   4.   5.   5.
    4.   1.   8.   5.

--> circshift(resize_matrix(m, [5,7]),[1,2])
  ans  =
    0.   0.   0.   0.   0.   0.   0.
    0.   0.   2.   5.   9.   3.   0.
    0.   0.   2.   4.   5.   5.   0.
    0.   0.   4.   1.   8.   5.   0.
    0.   0.   0.   0.   0.   0.   0.

The main resize_matrix() syntax is

resMat = resize_matrix(mat, nbRows, nbCols)

Specifying a vector of 2 components instead of a scalar for either 
nbrows or nbcols or both would enable specifying margins on both sides 
for each direction, instead of the new required sizes.
IMO, this would be an improvement for resize_matrix() rather than a 
circshift() extension.
Don't you think so?

Best regards
Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180103/de989716/attachment.htm>


More information about the users mailing list