1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2013 - Scilab Enterprises - Paul Bignier
4 // Copyright (C) 2012 - Scilab Enterprises - Sylvestre Ledru
6 // This file is distributed under the same license as the Scilab package.
7 // =============================================================================
9 // <-- CLI SHELL MODE -->
11 // <-- ENGLISH IMPOSED -->
14 x = [1 2 3 4; 5 6 7 8];
17 assert_checkequal([5 6 7 8; 1 2 3 4], y);
22 assert_checkequal([4 3 2 1; 8 7 6 5], y);
25 x = matrix(1:24, [3 2 4]);
27 ref = hypermat([3 2 4], [19;20;21;22;23;24;13;14;15;16;17;18;7;8;9;10;11;12;1;2;3;4;5;6]);
29 assert_checkequal(y, ref);
32 y = flipdim(x*%i, dim);
33 assert_checkequal(y, ref*%i);
35 // Integer-encoded numbers:
36 y = flipdim(int16(x), dim);
37 assert_checkequal(y, int16(ref));
40 ref_bool = hypermat([3 2 4], [%T;%T;%T;%T;%T;%T;%T;%T;%T;%T;%T;%T;%F;%F;%F;%T;%T;%F;%F;%F;%F;%F;%F;%F]);
41 y = flipdim(x < 15, 2);
42 assert_checkequal(y, ref_bool);
45 x_txt = matrix(strsplit("a":"x", 1:23), 4, 6);
46 x_txt = x_txt + x_txt;
47 ref_txt = ["uu" "qq" "mm" "ii" "ee" "aa"; "vv" "rr" "nn" "jj" "ff" "bb";
48 "ww" "ss" "oo" "kk" "gg" "cc";
49 "xx" "tt" "pp" "ll" "hh" "dd" ];
50 y = flipdim(x_txt, 2);
51 assert_checkequal(y, ref_txt);
54 x_pol = inv_coeff([x(:,:,1) x(:,:,2) x(:,:,3) x(:,:,4) [0;1;2]], 2);
56 ref_pol = [3+12*X+21*X^2 6+15*X+24*X^2 9+18*X+2*X^2;
57 2+11*X+20*X^2 5+14*X+23*X^2 8+17*X+X^2;
58 1+10*X+19*X^2 4+13*X+22*X^2 7+16*X ];
59 y = flipdim(x_pol, 1);
60 assert_checkequal(y, ref_pol);
66 assert_checkequal(y, ref_r);
69 x = matrix(1:48, [3 2 4 2]);
71 ref = hypermat([3 2 4 2], [19;20;21;22;23;24;13;14;15;16;17;18;7;8;9;10;11;12;1;2;3;4;5;6;43;44;45;46;47;48;37;38;39;40;41;42;31;32;33;34;35;36;25;26;27;28;29;30]);
73 assert_checkequal(y, ref);