4d59d25c138ccdf7e8b063b36a45832c7355865c
[scilab.git] / scilab / modules / ast / tests / unit_tests / divide.dia.ref
1 // ============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2012 - DIGITEO - Antoine ELIAS
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // ============================================================================
7 // <-- JVM NOT MANDATORY -->
8 r = 2;
9 R = [1,2;3,4];
10 R3(:,:,1) = R;
11 R3(:,:,2) = R';
12 c = 1 + 2*%i;
13 C = [1+2*%i,2+4*%i;3+6*%i,4+8*%i];
14 C3(:,:,1) = C;
15 C3(:,:,2) = C';
16 //double / double
17 //r / r
18 assert_checkalmostequal(r / r, 1);
19 //r / c
20 assert_checkalmostequal(r / c, 0.4-0.8*%i);
21 //c / r
22 assert_checkalmostequal(c / r, 0.5+%i);
23 //c / c
24 assert_checkalmostequal(c / c, 1);
25 //double / DOUBLE
26 //r / R
27 assert_checkalmostequal(r / R, [-4,2;3,-1]);
28 //r / C
29 assert_checkalmostequal(r / C, [-0.8+1.6*%i,0.4-0.8*%i;0.6-1.2*%i,-0.2+0.4*%i]);
30 //c / R
31 assert_checkalmostequal(c / R, [-2-4*%i,1+2*%i;1.5+3*%i,-0.5-1*%i]);
32 //c / C
33 assert_checkalmostequal(c / C, [-2,1;1.5,-0.5]);
34 //DOUBLE / double
35 //R / r
36 assert_checkalmostequal(R / r, [0.5,1;1.5,2]);
37 R3rref(:,:,1) = [0.5,1;1.5,2];
38 R3rref(:,:,2) = [0.5,1.5;1,2];
39 assert_checkalmostequal(R3 / r, R3rref);
40 //R / c
41 assert_checkalmostequal(R / c, [0.2-0.4*%i,0.4-0.8*%i;0.6-1.2*%i,0.8-1.6*%i]);
42 R3cref(:,:,1) = [0.2-0.4*%i,0.4-0.8*%i;0.6-1.2*%i,0.8-1.6*%i];
43 R3cref(:,:,2) = [0.2-0.4*%i,0.6-1.2*%i;0.4-0.8*%i,0.8-1.6*%i];
44 assert_checkalmostequal(R3 / c, R3cref);
45 //C / r
46 assert_checkalmostequal(C / r, [0.5+1*%i,1+2*%i;1.5+3*%i,2+4*%i]);
47 C3rref(:,:,1) = [0.5+1*%i,1+2*%i;1.5+3*%i,2+4*%i];
48 C3rref(:,:,2) = [0.5-1*%i,1.5-3*%i;1-2*%i,2-4*%i];
49 assert_checkalmostequal(C3 / r, C3rref);
50 //C / c
51 assert_checkalmostequal(C / c, [1,2;3,4]);
52 C3cref(:,:,1) = [1,2;3,4];
53 C3cref(:,:,2) = [-0.6-0.8*%i,-1.8-2.4*%i;-1.2-1.6*%i,-2.4-3.2*%i];
54 assert_checkalmostequal(C3 / c, C3cref);
55 //DOUBLE / DOUBLE
56 //R / R
57 assert_checkalmostequal(R / R, [1,0;0,1]);
58 //R / C
59 assert_checkalmostequal(R / C, [0.2-0.4*%i,0;0,0.2-0.4*%i]);
60 //C / R
61 assert_checkalmostequal(C / R, [1+2*%i,0;0,1+2*%i]);
62 //C / C
63 assert_checkalmostequal(C / C, [1,0;0,1]);