[Scilab-users] circshift() : Scilab Enhancement Proposal
Samuel Gougeon
sgougeon at free.fr
Tue Jan 9 20:25:58 CET 2018
Hello Rafael,
Le 03/01/2018 à 16:00, Rafael Guerra a écrit :
>
> Samuel,
>
> As requested, some further feedback on circshift:
>
> .../...
>
> * 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, also to
> have option for non-circular shifts and for padding with zeros
>
To go on about resize_matrix() , padding, and shifting without wrapping:
Specifying a (N>1 x 2) matrix of positive (pad) or negative (trim)
margins resizing
would be simple.
Padding with other default elements for non-numerical arrays, or with a
chosen
value, is already enabled.
Possible new syntaxes and examples of usages:
resMat = resize_matrix(mat, frameWidth)
resMat = resize_matrix(mat, frameWidth, ..)
m = [
6 -7 -1 -2
-6 0 -2 -5
-5 4 -1 8
];
// shift without extension nor wrapping:
resize_matrix(m, [0 0 ; -1 1])
ans =
-7 -1 -2 0
0 -2 -5 0
4 -1 8 0
// Another case without extensions nor wrapping:
resize_matrix(m, [1 -1 ; 2 -2])
ans =
0 0 0 0
0 0 6 -7
0 0 -6 0
// More general
resize_matrix(m, [2 1 ; 1 -1])
ans =
0 0 0 0
0 0 0 0
0 6 -7 -1
0 -6 0 -2
0 -5 4 -1
0 0 0 0
Is it the kind of features you were thinking about?
IMO, there is no need to implement this in another specific function,
because these features are just particular cases or resizing, with a
simple syntax allowing to crop borders as well.
Best regards
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180109/0eb6532c/attachment.htm>
More information about the users
mailing list