diff options
author | Sandeep Gupta | 2017-06-18 23:55:40 +0530 |
---|---|---|
committer | Sandeep Gupta | 2017-06-18 23:55:40 +0530 |
commit | 277d1edfa17bf3719d90ddbac8e31f6181e952c3 (patch) | |
tree | 0661f1f52af0a0fd654edd4984c30e57037303c6 /src/Scilab2C/SCI2CTests | |
download | Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.tar.gz Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.tar.bz2 Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.zip |
First commit
Diffstat (limited to 'src/Scilab2C/SCI2CTests')
63 files changed, 2071 insertions, 0 deletions
diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionAbs.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionAbs.sci new file mode 100644 index 0000000..8bbbf64 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionAbs.sci @@ -0,0 +1,20 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +disp(abs(7)) +disp(abs(-3)) + + +disp(abs(7-%i)) +disp(abs(7+%i)) +disp(abs(-3-2*%i)) +disp(abs(-3+2*%i)) + +a=[-1 -5 4 -7; -8 3 -74 -5; 141 -3 4 45] +b=[1+%i*7 2 5+%i*4; 4+%i*21 8+%i 6; 3-%i*7 4-%i*2 78 ] +disp(abs(a)) +disp(abs(b)) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionConj.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionConj.sci new file mode 100644 index 0000000..3cceb0d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionConj.sci @@ -0,0 +1,31 @@ +//SCI2C: DEFAULT_PRECISION= FLOAT + +function mainfunction()
+ +s1=[1+%i*3 1-%i*7;-1+5*%i 1-%i*7;-1+5*%i -1-6*%i] +s2=conj(s1); +disp(s2); + +s3=[1 1;-1+5*%i 1-%i*7;-1+5*%i -1-6*%i] +s4=conj(s3); +disp(s4);
+ +s5=1+%i*3 +s6=conj(s5); +disp(s6); + + +s7=1-%i*3 +s8=conj(s7); +disp(s8);
+ +s9=[1+%i*3 1-%i*7;-1 7;-1+5*%i -1-6*%i] +s10=conj(s9); +disp(s10);
+ +s11=[1+%i*3 1;-1+5*%i 1;-1 -1-6*%i] +s12=conj(s11); +disp(s12); + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionFind.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionFind.sci new file mode 100644 index 0000000..2a093e9 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionFind.sci @@ -0,0 +1,20 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +a = 1 +disp(find(a==0)) +disp(find(a==1)) + +b = 1+3*%i +disp(find(b==2-%i)) +disp(find(b==1+3*%i)) + +c=[2 5 4 7; 36 4 1 5; 1 2 54 7; 9 6 3 1] +disp(find(c==1)) + + +d=[1 2+%i 5 9; 7+%i 5+%i 4+%i 1+%i; 1+%i 5+%i 6+%i 3+%i; 2+%i 2+%i 2+%i 2+%i*3] +disp(find(d==2+%i)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionFind2d.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionFind2d.sci new file mode 100644 index 0000000..2857b80 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionFind2d.sci @@ -0,0 +1,32 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +a = 1 +[u1,v1]=find(a==0); +[u2,v2]=find(a==1); + +disp(u1);disp(v1); +disp(u2);disp(v2); + +b = 1+3*%i +[u3,v3]=find(b==0); +[u4,v4]=find(b==1+3*%i); + +disp(u3);disp(v3); +disp(u4);disp(v4); + +c=[2 5 4 7; 36 4 1 5; 1 2 54 7; 9 6 3 1] +[u5,v5]=find(c==0); +[u6,v6]=find(c==1); + +disp(u5);disp(v5); +disp(u6);disp(v6); + +d=[1 2+%i 5 9; 7+%i 5+%i 4+%i 1+%i; 1+%i 5+%i 6+%i 3+%i; 2+%i 2+%i 2-%i 2+%i*3] +[u7,v7]=find(d==0); +[u8,v8]=find(d==2+%i); + +disp(u7);disp(v7); +disp(u8);disp(v8); +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionIsEmpty.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionIsEmpty.sci new file mode 100644 index 0000000..9c975ad --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionIsEmpty.sci @@ -0,0 +1,18 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test isempty + + +disp(isempty(4)); +disp(isempty(3+%i*4)); + +c=[1 5 4 8; 2 9 4 5; 3 6 4 7] +d=[1 5+%i*4 4 8+%i; 2-%i*3 9+%i*7 4+%i*2 5; 3 6 4 7-%i] +e=[0,0] +disp(isempty(c)); +disp(isempty(d)); +disp(isempty(e)); +disp(isempty(e+%i*0)); +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionIsNan.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionIsNan.sci new file mode 100644 index 0000000..9d4eac4 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionIsNan.sci @@ -0,0 +1,20 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test isnan + + +disp(isnan(4)); +disp(isnan(3+%i*4)); + +c=[1 5 4 8; 2 9 4 5; 3 6 4 7] +d=[1 5+%i*4 4 8+%i; 2-%i*3 9+%i*7 4+%i*2 5; 3 6 4 7-%i] +e=[0,0] +//disp(isnan([1 0.01 -%nan %inf-%inf])); +disp(isnan([1 0.01 %inf-%inf])); +disp(isnan(c)); +disp(isnan(d)); +disp(isnan(e)); +disp(isnan(e+%i*0)); +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionLength.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionLength.sci new file mode 100644 index 0000000..7509073 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionLength.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test length + + +disp(length(4)); +disp(length(3+%i*4)); + +c=[1 5 4 8; 2 9 4 5; 3 6 4 7] +d=[1 5+%i*4 4 8+%i; 2-%i*3 9+%i*7 4+%i*2 5; 3 6 4 7-%i; 3 6 4 7-%i] + +disp(length(c)); +disp(length(d)); + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionSign.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionSign.sci new file mode 100644 index 0000000..6a1ce45 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionSign.sci @@ -0,0 +1,28 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test sign + +//real +disp (sign(4)) +disp (sign(0)) +disp (sign(-2)) + +a=[1 0 5 4; -2 4 0 5 ; -4 -2 -1 4] +disp (sign(a)) + + +//complex +disp (sign(4-2*%i)) +disp (sign(4+2*%i)) +disp (sign(0+%i*0)) +disp (sign(3+%i*0)) +disp (sign(0+%i*3)) +disp (sign(-2 - 2*%i)) +disp (sign(-2 + 2*%i)) + +b=[1+%i 0+0*%i 5-2*%i 4+0*%i; -2+%i 4 0+2*%i 5 ; -4-3*%i -2 -1-3*%i 4+2*%i] +disp (sign(b)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionSize.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionSize.sci new file mode 100644 index 0000000..067365d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionSize.sci @@ -0,0 +1,27 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test sign + +//real +disp (size(4)) +disp (size(4,1)) +disp (size(4,2)) + +a=[1 0 5 4; -2 4 0 5 ; -4 -2 -1 4] +disp (size(a)) +disp (size(a,1)) +disp (size(a,2)) + +//complex +disp (size(4-2*%i)) +disp (size(4-2*%i,1)) +disp (size(4-2*%i,2)) + +b=[1+%i 0+0*%i 5-2*%i 4+0*%i; -2+%i 4 0+2*%i 5 ] +disp (size(b)) +disp (size(b,1)) +disp (size(b,2)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionType.sci b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionType.sci new file mode 100644 index 0000000..db83734 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/auxiliaryFunctions/mainfunctionType.sci @@ -0,0 +1,16 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test type + +disp (type(4)) +disp (type(2+3*%i)) + +a=[1 2 4 ; 2 5 3] +disp (type(a)) + +b=[1-%i 2+3*%i 4 ; 2-2*%i 5 3+2*%i] +disp (type(b)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionACos.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionACos.sci new file mode 100644 index 0000000..e022555 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionACos.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test acos + + +disp (acos(0.5)); +disp (acos(0.2+0.1*%i)) + +c=[4 2 3 ;8 8 4; 3 4 5]/10 +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5]/10 + +disp (acos(c)) +disp (acos(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionACosh.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionACosh.sci new file mode 100644 index 0000000..0873919 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionACosh.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test acos + + +disp (acosh(7)); +disp (acosh(2+11*%i)) + +c=[4 2 3 ;8 8 4; 3 4 5]; +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5]; + +disp (acosh(c)) +disp (acosh(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionASin.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionASin.sci new file mode 100644 index 0000000..83fdef4 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionASin.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= FLOAT + +function mainfunction()
+ +//test asin + + +disp (asin(.7)); +disp (asin(.2+.11*%i)) + +c=[4 2 3 ;8 8 4; 3 4 5]/10 +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5]/10 + +disp (asin(c)) +disp (asin(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionASinh.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionASinh.sci new file mode 100644 index 0000000..967341e --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionASinh.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test asinh + + +disp (asinh(7)); +disp (asinh(2+11*%i)) + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (asinh(c)) +disp (asinh(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATan.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATan.sci new file mode 100644 index 0000000..ae5e83d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATan.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test atan + + +disp (atan(7)); +disp (atan(2+11*%i)) + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[4 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (atan(c)) +disp (atan(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATan2.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATan2.sci new file mode 100644 index 0000000..fa8d0a1 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATan2.sci @@ -0,0 +1,14 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test atan2 + + +disp (atan(7,2)); + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[2 3 7 ;2 4 4; 1 3 4] +disp (atan(c,d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATanh.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATanh.sci new file mode 100644 index 0000000..d81af8d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionATanh.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test atanh + + +disp (atanh(7/10)); +disp (atanh((2+11*%i)/10)) + +c=[4 2 3 ;8 8 4; 3 4 5]/10 +d=[4 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5]/10 + +disp (atanh(c)) +disp (atanh(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCeil_Fix_Floor_Int_Round.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCeil_Fix_Floor_Int_Round.sci new file mode 100644 index 0000000..a5930c2 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCeil_Fix_Floor_Int_Round.sci @@ -0,0 +1,48 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ + +// test ceil/fix/floor/int/round + +disp(ceil(4.2)) +disp(fix(4.2)) +disp(floor(4.2)) +disp(int(4.2)) +disp(round(4.2)) + +disp(ceil(-4.2)) +disp(fix(-4.2)) +disp(floor(-4.2)) +disp(int(-4.2)) +disp(round(-4.2)) + + +disp(ceil(4.2 - 2.5*%i)) +disp(fix(4.2 - 2.5*%i)) +disp(floor(4.2 - 2.5*%i)) +disp(int(4.2 - 2.5*%i)) +disp(round(4.2 - 2.5*%i)) + +disp(ceil(-4.2 + 2.5*%i)) +disp(fix(-4.2 + 2.5*%i)) +disp(floor(-4.2 + 2.5*%i)) +disp(int(-4.2 + 2.5*%i)) +disp(round(-4.2 + 2.5*%i)) + +a=[12.5 1.3 1.74 ; -2.4 -3.8 1.000001 ; 1.23 1.99999 0.035; 0 2 -4.5]; + +disp(ceil(a)) +disp(fix(a)) +disp(floor(a)) +disp(int(a)) +disp(round(a)) + +b=a+[1.2 3.8 -3.9; 7 2.7 1.5; 0 -9.5 2.0001; 2.35 -1. 5.49]*%i; +disp(ceil(b)) +disp(fix(b)) +disp(floor(b)) +disp(int(b)) +disp(round(b)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCos.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCos.sci new file mode 100644 index 0000000..d86406b --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCos.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test cos + + +disp (cos(7/10)); +disp (cos((2+11*%i)/10)) + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[4 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (cos(c)) +disp (cos(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCosh.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCosh.sci new file mode 100644 index 0000000..915396f --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionCosh.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test cosh + + +disp (cosh(7/10)); +disp (cosh((2+11*%i)/10)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (cosh(c)) +disp (cosh(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionExp_Expm.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionExp_Expm.sci new file mode 100644 index 0000000..d56328d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionExp_Expm.sci @@ -0,0 +1,30 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE +function mainfunction()
+ +//test exp and expm + +//d0 +disp (exp(3)) + +//z0 +disp (exp(3+%i*4)) + + +a=[1 2 3; 5 5 6] +c=[4 2 3 ;8 8 4; 3 4 5] +b=[1+%i,2+4*%i 3+1*%i; 4 5 6+2*%i] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] + +//d2 +disp (exp(a)) +disp (exp(c)) +disp (expm(c)) + +//z2 +disp (exp(b)) +disp (exp(d)) +disp (expm(d)) + + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog.sci new file mode 100644 index 0000000..925182c --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test log + + +disp (log(7/10)); +disp (log(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (log(c)) +disp (log(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog10.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog10.sci new file mode 100644 index 0000000..c8b4855 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog10.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test log10 + + +disp (log10(7/10)); +disp (log10(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (log10(c)) +disp (log10(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog1p.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog1p.sci new file mode 100644 index 0000000..3c929e8 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionLog1p.sci @@ -0,0 +1,17 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test log1p + + +disp (log1p(7/10)); +//disp (log1p(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +//d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (log1p(c)) +//disp (log1p(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionPow0.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionPow0.sci new file mode 100644 index 0000000..0a19a9b --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionPow0.sci @@ -0,0 +1,27 @@ +//SCI2C: DEFAULT_PRECISION= FLOAT + +function mainfunction()
+ +//test pow0 + + +disp(0^0); +disp(0^4); + +disp(0^(0+0*%i)); +disp(0^(0+%i)); +disp(0^(3+0*%i)); +disp(0^(2+%i)); + +disp((0+0*%i)^0); +disp((0+0*%i)^2); + +disp((0+0*%i)^(0+0*%i)); +//disp((0+0*%i)^(0+3*%i)); +disp((0+0*%i)^(2+0*%i)); +//disp((0+0*%i)^(2+1*%i)); + + + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionPow_MatrixPow.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionPow_MatrixPow.sci new file mode 100644 index 0000000..3706353 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionPow_MatrixPow.sci @@ -0,0 +1,50 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction() + +//test Hat_DotHat + +disp(4.1^3.5); +disp(4.1.^3.5); + +disp(4.4^(3.2+%i*1.1)); +disp(4.4.^(3.2+%i*1.1)); + +disp((3.2+%i*1.1)^4.4); +disp((3.2+%i*1.1).^4.4); + +disp((3.2+%i*1.1)^(4.4+2.6*%i)); +disp((3.2+%i*1.1).^(4.4+2.6*%i)); + +a=[1.2 4.1 3.9; 3.7 2.6 8.1]; +b=a+[2.5 3.9 8.7; 2.5 0.2 3.3]*%i; + +disp(1.2^a) +disp(1.2.^a) + +disp(1.2^b) +disp(1.2.^b) + +disp((1.2+%i*1.1)^a) +disp((1.2+%i*1.1).^a) + +disp((1.2+%i*1.1)^b) +disp((1.2+%i*1.1).^b) + +disp(a.^a) +disp(a.^b) + +disp(b.^a) +disp(b.^b) + +c=[1.2 1.3; 1.4 5.1]; + +disp(c^2.1); +disp(c^(2.1+%i*4.6)); + +d=c+[4.1 2.1; 4.6 5.1]*%i; + +disp(d^2.1); +disp(d^(2.1+%i*4.6)); + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSin.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSin.sci new file mode 100644 index 0000000..db01d7b --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSin.sci @@ -0,0 +1,16 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test sin + +disp (sin(7/10)); +disp (sin(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (sin(c)) +disp (sin(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSinh.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSinh.sci new file mode 100644 index 0000000..c16af3e --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSinh.sci @@ -0,0 +1,16 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test sinh + +disp (sinh(7/10)); +disp (sinh(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (sinh(c)) +disp (sinh(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSqrt.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSqrt.sci new file mode 100644 index 0000000..ba64d18 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionSqrt.sci @@ -0,0 +1,16 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test sqrt + +disp (sqrt(7/10)); +disp (sqrt(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (sqrt(c)) +disp (sqrt(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionTan.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionTan.sci new file mode 100644 index 0000000..67572f0 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionTan.sci @@ -0,0 +1,16 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test tan + +disp (tan(7/10)); +disp (tan(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (tan(c)) +disp (tan(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionTanh.sci b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionTanh.sci new file mode 100644 index 0000000..b282d6d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/elementary Functions/mainfunctionTanh.sci @@ -0,0 +1,16 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test tanh + +disp (tanh(7/10)); +disp (tanh(2+11*%i)) + +c=[1 2 3 ;8 8 4; 3 4 5] +d=[1 2 3+3*%i ;8 8-1*%i 4; 3+4*%i 4 5] + +disp (tanh(c)) +disp (tanh(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/implicitList/mainfunctionImplicitList.sci b/src/Scilab2C/SCI2CTests/Mes_tests/implicitList/mainfunctionImplicitList.sci new file mode 100644 index 0000000..8d7c691 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/implicitList/mainfunctionImplicitList.sci @@ -0,0 +1,36 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test OpColon + +//reals + +disp(2:2) + +disp(1:6) + +disp(2:1:2) + +disp(2:1:5) + +disp(1:2:1) + +disp(1:3:10) + + +//complexe + +2+%i:2-%i + +1+%i:6+%i*5 + +2+%i*3:1-%i*4:2+%i*2 + +2+%i:1+%i:5+%i + +1+%i:2+%i:1+%i + +1+%i:3+%i:10+%i + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpIns.sci b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpIns.sci new file mode 100644 index 0000000..37c7375 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpIns.sci @@ -0,0 +1,136 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ + +// test OpIns + +//reals +a=[1 2 3; 4 5 6] + +a(3)=-2 +disp(a); + +a(3)=-4+%i +disp(a); + +a(1,3)=-12; +disp(a); + +a(1,3)=-5+%i; +disp(a); + +a([1,2],1)=-12; +disp(a); + +a([1,2],1)=-5+%i; +disp(a); + +a(2,[2,3])=-12; +disp(a); + +a(2,[2,3])=-5+%i; +disp(a); + +a([1 2],[1,2,3])=4; +disp(a); + +a([1 2],[1,2,3])=3+%i; +disp(a); + +a([1,3])=7; +disp(a); + +a([1,3])=2+%i; +disp(a); + +a([1,3])=[1,0]; +disp(a); + +a([1,3])=[3-%i,1+%i]; +disp(a); + +a(2,[1,3])=[-2,-7]; +disp(a); + +a(2,[1,3])=[-4+%i,-5+%i]; +disp(a); + +a([1,2],3)=[-9;-1]; +disp(a); + +a([1,2],3)=[-4+%i;-5+%i]; +disp(a); + +a([1,2],[2,3])=[-31 -45;-29 -51]; +disp(a); + +a([1,2],[2,3])=[-4+%i,-5+%i;-4+%i,-5+%i]; +disp(a); + + +//complexes + +b=[1-3*%i 2+%i 3+2*%i; 4 5+4*%i 6] + +b(3)=-2 +disp(b); + +b(3)=-4+%i +disp(b); + +b(1,3)=-12; +disp(b); + +b(1,3)=-5+%i; +disp(b); + +b([1,2],1)=-12; +disp(b); + +b([1,2],1)=-5+%i; +disp(b); + +b(2,[2,3])=-12; +disp(b); + +b(2,[2,3])=-5+%i; +disp(b); + +b([1 2],[1,2,3])=4; +disp(b); + +b([1 2],[1,2,3])=3+%i; +disp(b); + +b([1,3])=7; +disp(b); + +b([1,3])=2+%i; +disp(b); + +b([1,3])=[1,0]; +disp(b); + +b([1,3])=[3-%i,1+%i]; +disp(b); + +b(2,[1,3])=[-2,-7]; +disp(b); + +b(2,[1,3])=[-4+%i,-5+%i]; +disp(b); + +b([1,2],3)=[-9;-1]; +disp(b); + +b([1,2],3)=[-4+%i;-5+%i]; +disp(b); + +b([1,2],[2,3])=[-31 -45;-29 -51]; +disp(b); + +b([1,2],[2,3])=[-4+%i,-5+%i;-4+%i,-5+%i]; +disp(b); + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogEq.sci b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogEq.sci new file mode 100644 index 0000000..86ab725 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogEq.sci @@ -0,0 +1,32 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ + +// test OpEqual +disp(1==1) +disp(1==2) +disp(1==2+%i) +disp(1+%i==2) +disp(1+%i==2+%i) + +a=[1 2 ; 3 4] +b=[5 2 ; 6+%i 1-%i] + +disp(a==a) +disp(a==b) +disp(b==a) +disp(b==b) + + +disp(3==a) +disp(5==b) +disp(a==4) +disp(b==2) + +disp(1+%i==a) +disp(1-%i==b) +disp(a==6+%i) +disp(b==6+%i) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogNe.sci b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogNe.sci new file mode 100644 index 0000000..d1212da --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogNe.sci @@ -0,0 +1,32 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ + +// test OpEqual +disp(1<>1) +disp(1<>2) +disp(1<>2+%i) +disp(1+%i<>2) +disp(1+%i<>2+%i) + +a=[1 2 ; 3 4] +b=[5 2 ; 6+%i 1-%i] + +disp(a<>a) +disp(a<>b) +disp(b<>a) +disp(b<>b) + + +disp(3<>a) +disp(5<>b) +disp(a<>4) +disp(b<>2) + +disp(1+%i<>a) +disp(1-%i<>b) +disp(a<>6+%i) +disp(b<>6+%i) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogNot.sci b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogNot.sci new file mode 100644 index 0000000..6f17a30 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/mainfunctionOpLogNot.sci @@ -0,0 +1,29 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ + +// test OpLogNot + +disp(~(-2)) +disp(~(0)) +disp(~(3)) + +disp(~(0-2*%i)) +disp(~(0+0*%i)) +disp(~(0+3*%i)) +disp(~(3-5*%i)) +disp(~(3+0*%i)) +disp(~(3+6*%i)) + +a=[-1 2 3; 0 -1 4; 2 -0 5]; + +disp(~(a)) + +b=[0+3*%i 2-%i 1 ; 0-2*%i 2+2*%i 1-%i; 0+0*%i 4+0*%i 5-0*%i] + +disp(~(b)) + + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionChol.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionChol.sci new file mode 100644 index 0000000..46f8c40 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionChol.sci @@ -0,0 +1,24 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test chol + +//real +disp (chol(4)) + +a=[1 0 5; -2 4 0 ; -4 -2 -1] +a2=a*a' +disp (chol(a2)) + + +//complex +disp (chol(4-2*%i)) + + +b=[1+%i 0+0*%i; 5-2*%i 4+0*%i] +b2=b*b' +disp (chol(b2)) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionDet.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionDet.sci new file mode 100644 index 0000000..fbd5964 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionDet.sci @@ -0,0 +1,28 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE +function mainfunction()
+ +//test det + +//d0 +disp (det(3)) + +//z0 +disp (det(3+%i*4)) + + +c=[4 2 3 ;8 8 4; 3 4 5] +e=[4 2 3 1;8 8 4 4; 3 4 5 7; 12 2 3 4] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] +f=[4+%i 2 3 1*%i ;3+4*%i 8-2*%i 8+4*%i 4+2*%i ; 3 4+2*%i 5 7; 12+2*%i 2 3 4] + +//d2 +disp (det(c)) +disp (det(e)) + +//z2 +disp (det(d)) +disp (det(f)) + + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionEye.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionEye.sci new file mode 100644 index 0000000..b077c9f --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionEye.sci @@ -0,0 +1,37 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test eye + +//reals + + +disp(eye()) + +disp(eye(1)) + +disp(eye(4)) + +disp(eye(1,1)) + +disp(eye(1,4)) + +disp(eye(4,4)) + +disp(eye(4,1)) + +a=[1 2 3; 4 5 6; 7 8 9] + +disp(eye(a)) + +//complexe + +disp(eye(2+%i)) + +b=a+%i + +disp(eye(b)) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionInversion.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionInversion.sci new file mode 100644 index 0000000..7164590 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionInversion.sci @@ -0,0 +1,21 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test inversion + + +disp (inv(3)) + + +disp (inv(3+2*%i)) + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] + + +disp (inv(c)) + +disp (inv(d)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionOnes.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionOnes.sci new file mode 100644 index 0000000..15b57b6 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionOnes.sci @@ -0,0 +1,37 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test ones + +//reals + + +//disp(ones()) + +disp(ones(1)) + +disp(ones(4)) + +disp(ones(1,1)) + +disp(ones(1,4)) + +disp(ones(4,4)) + +disp(ones(4,1)) + +a=[1 2 3; 4 5 6; 7 8 9] + +disp(ones(a)) + +//complexe + +disp(ones(2+%i)) + +b=a+%i + +disp(ones(b)) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionOpApex_OpDotApex.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionOpApex_OpDotApex.sci new file mode 100644 index 0000000..3f3822e --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionOpApex_OpDotApex.sci @@ -0,0 +1,29 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test OpApex(transpose&conj) & OpDotApex(transpose) + +//reals + +disp(3') + +disp(3.') + +a=[4 2 4 8;3 4 5 1;1 4 5 6; 7 4 5 3] + +disp(a') +disp(a.') + +//complexes + +disp((3+%i)') + +disp((3+%i).') + +b=2.5*a+a*%i; + +disp(b') +disp(b.') + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionSpec_Spec2.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionSpec_Spec2.sci new file mode 100644 index 0000000..36b63d7 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionSpec_Spec2.sci @@ -0,0 +1,66 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test spec + +//reals + +disp(spec(4)) + +[u,v]=spec(4) +disp(u) +disp(v) + +a=[4 2 4 8;3 4 5 1;1 4 5 6; 7 4 5 3] + +disp(spec(a)) + +[x,y]=spec(a) +disp(x) +disp(y) + +b=[1 1;1 3] +disp(spec(b)) + +[s,t]=spec(b) +disp(s) +disp(t) + +c=[1 -2;1 3] +disp(spec(c)) + +[m,n]=spec(c) +disp(m) +disp(n) + + +//complexes + +disp(spec(3-%i)) + +[i,j]=spec(3-%i) +disp(i) +disp(j) + +d=[1 4 2 5; 2 5 4 7; 3 4 2 4;1 4 7 5]+[1 4 5 7;2 3 6 9;2 4 1 5; 7 8 5 4]*%i; + +disp(spec(d)) + +[k,l]=spec(d) +disp(k) +disp(l) + +e=[1 2; 2 7]+[0 4;-4 0]*%i +disp(spec(e)) + +[o,p]=spec(e) +disp(o) +disp(p) + +disp(spec(a+0*%i)) +[q,qq]=spec(a+0*%i) +disp(q) +disp(qq) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionZeros.sci b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionZeros.sci new file mode 100644 index 0000000..7b4b0f9 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/matrixOperations/mainfunctionZeros.sci @@ -0,0 +1,37 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test zeros + +//reals + + +//disp(zeros()) + +disp(zeros(1)) + +disp(zeros(4)) + +disp(zeros(1,1)) + +disp(zeros(1,4)) + +disp(zeros(4,4)) + +disp(zeros(4,1)) + +a=[1 2 3; 4 5 6; 7 8 9] + +disp(zeros(a)) + +//complexe + +disp(zeros(2+%i)) + +b=a+%i + +disp(zeros(b)) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpMinus.sci b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpMinus.sci new file mode 100644 index 0000000..4445143 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpMinus.sci @@ -0,0 +1,50 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE +function mainfunction()
+ +//test soustraction + +//d0d0 +disp (5-3) +//d0z0 +disp (1-%i) +//z0d0 +disp (%i-1) +//z0z0 +disp (%i-3*%i) + +a=[1 2 3; 4 5 6] +c=[1 5 3; 7 0 5] +b=[1+%i,2+4*%i 3+1*%i; 4 5 6+2*%i] +d=[1+%i,5+%i 3; 7+3*%i 0 5] + +//d2d2 +disp(a-c) +disp(a-a) +//d2z2 +disp(a-d) +//z2d2 +disp(d-a) +//z2z2 +disp(b-b) +disp(b-d) + +//d2d0 +disp(a-1) +//d0d2 +disp(1-a) +//d2z0 +disp(a-%i) +//z0d2 +disp(%i-a) + + +//z2d0 +disp(b-1) +//d0z2 +disp(1-b) +//z2z0 +disp(b-%i) +//z0z2 +disp(%i-b) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpPlus.sci b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpPlus.sci new file mode 100644 index 0000000..3cef146 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpPlus.sci @@ -0,0 +1,47 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE +function mainfunction()
+ +//test addition + +//d0d0 +disp (1+1) +//d0z0 +disp (1+%i) +//z0d0 +disp (%i+1) +//z0z0 +disp (%i+%i) + +a=[1 2 3; 4 5 6] +b=[1+%i,2 3; 4 5 6] + + +//d2d2 +disp(a+a) +//d2z2 +disp(a+b) +//z2d2 +disp(b+a) +//z2z2 +disp(b+b) + +//d2d0 +disp(a+1) +//d0d2 +disp(1+a) +//d2z0 +disp(a+%i) +//z0d2 +disp(%i+a) +//z2z2 + +//z2d0 +disp(b+1) +//d0z2 +disp(1+b) +//z2z0 +disp(b+%i) +//z0z2 +disp(%i+b) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpSlash_OpDotSlash.sci b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpSlash_OpDotSlash.sci new file mode 100644 index 0000000..5523a19 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpSlash_OpDotSlash.sci @@ -0,0 +1,67 @@ +//SCI2C: DEFAULT_PRECISION= FLOAT +function mainfunction()
+ +//test division + +//d0d0 +disp (5/3) +//d0z0 +disp (1/%i) +//z0d0 +disp (%i/5) +//z0z0 +disp (%i/(3*%i)) + +a=[1 2 3; 5 5 6] +c=[4 2 3 ;8 8 4; 3 4 5] +b=[1+%i,2+4*%i 3+1*%i; 4 5 6+2*%i] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] + +//d2d2 +disp("d2d2") +disp(a/c) +disp(a./a) +//d2z2 +disp("d2z2") +disp(a/d) +disp(a./b) +//z2d2 +disp("z2d2") +disp(d/c) +disp(b./a) +//z2z2 +disp("z2z2") +disp(b/d) +disp(b./b) + + + + +//d2d0 +disp("d2d0") +disp(a/2) +//d0d2 +disp("d0d2") +disp(1/c) +//d2z0 +disp("d2z0") +disp(a/%i) +//z0d2 +disp("z0d2") +disp(%i/c) + + +//z2d0 +disp("z2d0") +disp(b/5) +//d0z2 +disp("d0z2") +disp(1/d) +//z2z0 +disp("z2z0") +disp(b/%i) +//z0z2 +disp("z0z2") +disp(%i/d) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpStar_OpDotStar.sci b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpStar_OpDotStar.sci new file mode 100644 index 0000000..93d5025 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/operations/mainfunctionOpStar_OpDotStar.sci @@ -0,0 +1,58 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE +function mainfunction() + +//test multiplication + +//d0d0 +disp (5/3) +//d0z0 +disp (1/%i) +//z0d0 +disp (%i/5) +//z0z0 +disp (%i/(3*%i)) + +a=[1 2 3; 4 5 6] +c=[4 2 3 ;8 8 4; 3 4 5] +b=[1+%i,2+4*%i 3+1*%i; 4 5 6+2*%i] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] +e=[4 2 ;3 8 ;8-1*%i 4; 3+4*%i 4] + +//d2d2 +disp(a*c) +disp(a.*a) +//d2z2 +disp(a*d) +disp(a.*b) +//z2d2 +disp(e*a) +disp(b.*a) +//z2z2 +disp(b*d) +disp(b.*b) + + + + +//d2d0 +disp(a*1) +//d0d2 +disp(1*a) +//d2z0 +disp(a*%i) +//z0d2 +disp(%i*a) + + +//z2d0 +disp(b*1) +//d0z2 +disp(1*b) +//z2z0 +disp(b*%i) +//z0z2 +disp(%i*b) + +endfunction + + diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionConvol.sci b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionConvol.sci new file mode 100644 index 0000000..41c3860 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionConvol.sci @@ -0,0 +1,47 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test convol + +disp (convol(3,5)) +disp (convol(3+2*%i,5-%i)) + +disp (convol(3,5+3*%i)) +disp (convol(3+2*%i,2)) + +c=[1 2 3] +d=[4 5 6 7 8] +e=[2+3*%i 4+4*%i 7-5*%i 8+%i] +f=[1+5*%i 3-2*%i 1-%i] + +disp (convol(3,d)) +disp (convol(3,f)) +disp (convol(c,2)) +disp (convol(e,5)) + +disp (convol(3-%i,d)) +disp (convol(3+2*%i,f)) +disp (convol(c,2+2*%i)) +disp (convol(e,5+%i)) + +disp (convol(c,d)) +disp (convol(c,f)) +disp (convol(e,c)) +disp (convol(e,f)) + +//the following lines don't exist in Scilab but are in Sci2C + +//g=[1 2; 3 4] +//h=[4 5; 6 7] +//i=[2+3*%i 4+4*%i; 7-5*%i 8+%i] +//j=[1+5*%i 4+4*%i; 3-2*%i 1-%i] + +//disp (convol(g,h)) +//disp (convol(g,j)) +//disp (convol(i,h)) +//disp (convol(i,j)) + + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionFft.sci b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionFft.sci new file mode 100644 index 0000000..e9d11ac --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionFft.sci @@ -0,0 +1,38 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ + +// test fftshift + +//1 input argument +disp(fft(4)) + +disp(fft([3 4 2 1; 1 4 5 2])); + +disp(fft(4-%i)) + + +disp(fft([3+%i*2 4 2-%i 1; 1-%i*2 4 5 2])); + +//2 input arguments + +disp(fft(4,1)) + +disp(fft([3 4 2 1; 1 4 5 2],1)); + +disp(fft(4-%i,1)) + + +disp(fft([3+%i*2 4 2-%i 1; 1-%i*2 4 5 2],1)); + +disp(fft(4,-1)) + +disp(fft([3 4 2 1; 1 4 5 2],-1)); + +disp(fft(4-%i,-1)) + + +disp(fft([3+%i*2 4 2-%i 1; 1-%i*2 4 5 2],-1)); + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionFftShift.sci b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionFftShift.sci new file mode 100644 index 0000000..b562894 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionFftShift.sci @@ -0,0 +1,30 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ + +// test fftshift + +disp(fftshift(4)) +disp(fftshift(5,1)) +disp(fftshift(6,2)) + +disp(fftshift(4-%i)) +disp(fftshift(4-%i*2,1)) +disp(fftshift(4-%i*3,2)) + +a=[2 3 4 8; 8 4 5 6;1 2 3 4; 14 5 8 7; 1 2 6 7] +b=[2 3 4 8;1 2 6+3*%i 7] + + +disp(fftshift(a)) +disp(fftshift(a,1)) +disp(fftshift(a,2)) + + +disp(fftshift(b)) +disp(fftshift(b,1)) +disp(fftshift(b,2)) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionIfft.sci b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionIfft.sci new file mode 100644 index 0000000..3da3e39 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionIfft.sci @@ -0,0 +1,24 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test ifft + +//real +disp (ifft(4)) + +a=[1 0 5; -2 4 0 ; -4 -2 -1] + +disp (ifft(a)) + + +//complex +disp (ifft(4-2*%i)) + + +b=[1+%i 0+0*%i; 5-2*%i 4+0*%i] + +disp (ifft(b)) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionLev.sci b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionLev.sci new file mode 100644 index 0000000..274567d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/signalProcessing/mainfunctionLev.sci @@ -0,0 +1,38 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test lev + +//reals + +b=[1 2 3 4] + +disp(lev(b)) + +[u,v]=lev(b) +disp(u) +disp(v) + +[x,y,z]=lev(b) +disp(x) +disp(y) +disp(z) + +//complexes + +c=[1+2*%i 2 3-3*%i 4+%i] + +disp(lev(c)) + +[uc,vc]=lev(c) +disp(uc) +disp(vc) + +[xc,yc,zc]=lev(c) +disp(xc) +disp(yc) +disp(zc) + + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionMean.sci b/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionMean.sci new file mode 100644 index 0000000..ab4b0bc --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionMean.sci @@ -0,0 +1,21 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + + +function mainfunction()
+ +//test mean + + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] + + + +disp (mean(c)) +disp (mean(c,1)) +disp (mean(c,2)) +disp (mean(d)) +disp (mean(d,1)) +disp (mean(d,2)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionSum.sci b/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionSum.sci new file mode 100644 index 0000000..7302398 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionSum.sci @@ -0,0 +1,20 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test sum + + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] + + + +disp (sum(c)) +disp (sum(c,1)) +disp (sum(c,2)) +disp (sum(d)) +disp (sum(d,1)) +disp (sum(d,2)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionVariance.sci b/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionVariance.sci new file mode 100644 index 0000000..716d61e --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/statistic Functions/mainfunctionVariance.sci @@ -0,0 +1,20 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction()
+ +//test variance + + +c=[4 2 3 ;8 8 4; 3 4 5] +d=[4 2 3 ;8 8-1*%i 4; 3+4*%i 4 5] + + + +disp (variance(c)) +disp (variance(c,1)) +disp (variance(c,2)) +disp (variance(d)) +disp (variance(d,1)) +disp (variance(d,2)) + +endfunction diff --git a/src/Scilab2C/SCI2CTests/Mes_tests/type/mainfunctionReal_Imag.sci b/src/Scilab2C/SCI2CTests/Mes_tests/type/mainfunctionReal_Imag.sci new file mode 100644 index 0000000..02b5c3a --- /dev/null +++ b/src/Scilab2C/SCI2CTests/Mes_tests/type/mainfunctionReal_Imag.sci @@ -0,0 +1,20 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction() +
+disp(real(4)); +disp(imag(4)); + +disp(real(1+2*%i)); +disp(imag(1+2*%i)); + +a=[4 2 7 5;4 8 6 1]; + +disp(real(a)); +disp(imag(a)); + +b=a+%i*2*a +disp(real(b)); +disp(imag(b)); + +endfunction diff --git a/src/Scilab2C/SCI2CTests/test000_TrigonIdentity/SCI2CInputParameters.sce b/src/Scilab2C/SCI2CTests/test000_TrigonIdentity/SCI2CInputParameters.sce new file mode 100644 index 0000000..84590e7 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test000_TrigonIdentity/SCI2CInputParameters.sce @@ -0,0 +1,89 @@ +// -----------------------------------------------------------------
+// === hArtes/PoliBa/GAP SCI2C tool ===
+// === Authors: ===
+// === Raffaele Nutricato ===
+// === raffaele.nutricato@tiscali.it ===
+// === Alberto Morea ===
+// === ===
+// === *************** ===
+// === USER PARAMETERS ===
+// === *************** ===
+// === ===
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+
+// ------------------------------------------
+// --- Specify Paths of User Scilab code. ---
+// ------------------------------------------
+// UserSciCodeMainDir = 'D:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\svnhartes\src\Scilab2C\SCI2CTests\test999_WorkingDir';
+UserSciCodeMainDir = '../SCI2CTests/test999_WorkingDir';
+
+// --- Path + filename of the .sci main file of the code to be translated. ---
+// It is the entry point.
+UserScilabMainFile = fullfile(UserSciCodeMainDir,'scilabcode\mainfunction.sci');
+
+// --- List of the paths containing the .sci files written by the user. ---
+UserSciFilesPaths = ...
+ [...
+ fullfile(UserSciCodeMainDir,'scilabcode');...
+ ];
+
+// --------------------------
+// --- End Specify paths. ---
+// --------------------------
+
+
+// ----------------------------
+// --- Select the run mode. ---
+// ----------------------------
+//RunMode = 'GenLibraryStructure';
+//RunMode = 'Translate';
+RunMode = 'All';
+
+// --- Select one of the following options. ---
+
+// 'GenLibraryStructure';
+// Generates the library structure and exits. It is very
+// useful when the user wants to manually change the files stored in that structure
+// before running the translation. 'GenLibraryStructure' option forces SCI2C to remove
+// the already existing WorkingDir and OutCCCodeDir directories.
+
+// 'Translate';
+// Performs the translation without generating the library structure. It means that the library
+// structure must be already existing. This is useful when the user doesn't want to spend time
+// to generate again that structure or when he wants to force the SCI2C tool to access to
+// a manually-changed library structure. 'Translate' option forces SCI2C to don't remove
+// the already existing WorkingDir. Only OutCCCodeDir directory will be removed.
+
+// 'All';
+// Performs all the actions listed above.
+
+// --------------------------------
+// --- End Select the run mode. ---
+// --------------------------------
+
+
+// ----------------------------
+// --- Translation Options. ---
+// ----------------------------
+// --- Enable (1) / Disable (0) copy of Scilab code into C code. ---
+// If 1 the Scilab code will be copied into the C code in order to show
+// how each Scilab code line has been translated into C code.
+CopySciCodeIntoCCode = 1;
+
+// --- Select the path style for the C code. ---
+// It can be:
+// windows
+// unix
+// cygwin
+CCompilerPathStyle = 'cygwin';
+
+// --- Path + File name of the main SCI2C library header file.
+// Sci2CLibMainHeaderFName = 'D:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\svnhartes\src\Scilab2C\Scilab2C\CFiles\sci2cincludes\sci2clib.h';
+Sci2CLibMainHeaderFName = '../../../Scilab2C/CFiles/sci2cincludes/sci2clib.h';
+// --------------------------------
+// --- End Translation Options. ---
+// --------------------------------
diff --git a/src/Scilab2C/SCI2CTests/test000_TrigonIdentity/scilabcode/mainfunction.sci b/src/Scilab2C/SCI2CTests/test000_TrigonIdentity/scilabcode/mainfunction.sci new file mode 100644 index 0000000..e39f764 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test000_TrigonIdentity/scilabcode/mainfunction.sci @@ -0,0 +1,30 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ +// ------------------------------ +// --- Simple Scalar Addition --- +// ------------------------------ +a = 1; +b = 2; +c = 0; +c = a + b; +disp(c); + +// ------------------------------ +// --- Trigonometric Identity --- +// ------------------------------ +x = (1:3)' * (4:9); +y = (sin(x).^2) + (cos(x).^2); +disp(x); +disp(y-ones(3,6)); + +// ------------------------------- +// --- Computation of Distance --- +// ------------------------------- +// generate a vector w +w = cos(sin(cos(x*3)*2).* x+ones(3,6).*cos(x-sin(y*2))); +distxw = sqrt(x.^2 + w.^2); +disp(distxw); +endfunction +
\ No newline at end of file diff --git a/src/Scilab2C/SCI2CTests/test001_LinearRegression/SCI2CInputParameters.sce b/src/Scilab2C/SCI2CTests/test001_LinearRegression/SCI2CInputParameters.sce new file mode 100644 index 0000000..84590e7 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test001_LinearRegression/SCI2CInputParameters.sce @@ -0,0 +1,89 @@ +// -----------------------------------------------------------------
+// === hArtes/PoliBa/GAP SCI2C tool ===
+// === Authors: ===
+// === Raffaele Nutricato ===
+// === raffaele.nutricato@tiscali.it ===
+// === Alberto Morea ===
+// === ===
+// === *************** ===
+// === USER PARAMETERS ===
+// === *************** ===
+// === ===
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+
+// ------------------------------------------
+// --- Specify Paths of User Scilab code. ---
+// ------------------------------------------
+// UserSciCodeMainDir = 'D:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\svnhartes\src\Scilab2C\SCI2CTests\test999_WorkingDir';
+UserSciCodeMainDir = '../SCI2CTests/test999_WorkingDir';
+
+// --- Path + filename of the .sci main file of the code to be translated. ---
+// It is the entry point.
+UserScilabMainFile = fullfile(UserSciCodeMainDir,'scilabcode\mainfunction.sci');
+
+// --- List of the paths containing the .sci files written by the user. ---
+UserSciFilesPaths = ...
+ [...
+ fullfile(UserSciCodeMainDir,'scilabcode');...
+ ];
+
+// --------------------------
+// --- End Specify paths. ---
+// --------------------------
+
+
+// ----------------------------
+// --- Select the run mode. ---
+// ----------------------------
+//RunMode = 'GenLibraryStructure';
+//RunMode = 'Translate';
+RunMode = 'All';
+
+// --- Select one of the following options. ---
+
+// 'GenLibraryStructure';
+// Generates the library structure and exits. It is very
+// useful when the user wants to manually change the files stored in that structure
+// before running the translation. 'GenLibraryStructure' option forces SCI2C to remove
+// the already existing WorkingDir and OutCCCodeDir directories.
+
+// 'Translate';
+// Performs the translation without generating the library structure. It means that the library
+// structure must be already existing. This is useful when the user doesn't want to spend time
+// to generate again that structure or when he wants to force the SCI2C tool to access to
+// a manually-changed library structure. 'Translate' option forces SCI2C to don't remove
+// the already existing WorkingDir. Only OutCCCodeDir directory will be removed.
+
+// 'All';
+// Performs all the actions listed above.
+
+// --------------------------------
+// --- End Select the run mode. ---
+// --------------------------------
+
+
+// ----------------------------
+// --- Translation Options. ---
+// ----------------------------
+// --- Enable (1) / Disable (0) copy of Scilab code into C code. ---
+// If 1 the Scilab code will be copied into the C code in order to show
+// how each Scilab code line has been translated into C code.
+CopySciCodeIntoCCode = 1;
+
+// --- Select the path style for the C code. ---
+// It can be:
+// windows
+// unix
+// cygwin
+CCompilerPathStyle = 'cygwin';
+
+// --- Path + File name of the main SCI2C library header file.
+// Sci2CLibMainHeaderFName = 'D:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\svnhartes\src\Scilab2C\Scilab2C\CFiles\sci2cincludes\sci2clib.h';
+Sci2CLibMainHeaderFName = '../../../Scilab2C/CFiles/sci2cincludes/sci2clib.h';
+// --------------------------------
+// --- End Translation Options. ---
+// --------------------------------
diff --git a/src/Scilab2C/SCI2CTests/test001_LinearRegression/scilabcode/mainfunction.sci b/src/Scilab2C/SCI2CTests/test001_LinearRegression/scilabcode/mainfunction.sci new file mode 100644 index 0000000..a29a1c9 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test001_LinearRegression/scilabcode/mainfunction.sci @@ -0,0 +1,55 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ +// Knowing that +// (1) P * (V^gamma) = C +// Where +// P = Pressure +// V = Volume +// gamma,C = constants depending on the particular gas used. +// (2) log10(P) = log10(C) - gamma*log10(V) +// (3) x = log10(V) +// (4) y = log10(P) +// than (2) becomes: +// y = a + b*x; +// Where +// a = log10(C) +// b = -gamma +// Then thanks to this transformation it is possible to perform +// a linear regression to estimate gamma and C! + +Volume = [54.3 61.8 72.4 88.7 118.6 194.0]; +Pressure = [61.2 49.5 37.6 28.4 19.2 10.1]; +x = log10(Volume); +y = log10(Pressure); + +a = (sum(y)*sum(x.^2)-sum(x)*sum(x.*y))./(length(x)*sum(x.^2)-sum(x).*sum(x)); +b = (length(x)*sum(x.*y)-sum(x)*sum(y))./(length(x)*sum(x.^2)-sum(x).*sum(x)); + +// Other way to compute a and b +beq = sum((x-mean(x)).*(y-mean(y)))./sum((x-mean(x)).^2);
+aeq = mean(y)-mean(x)*beq;
+ +C = 10 .^a; +gamma = -b; + +disp('C') +disp(C) + +disp('gamma'); +disp(gamma); + +disp('a'); +disp(a) +disp('aeq'); +disp(aeq) + +disp('b'); +disp(b) +disp('beq'); +disp(beq) + +// plot(Volume,Pressure); +// plot(Volume,(C ./(Volume.^gamma)),'r') +endfunction diff --git a/src/Scilab2C/SCI2CTests/test999_WorkingDir/SCI2CInputParameters.sce b/src/Scilab2C/SCI2CTests/test999_WorkingDir/SCI2CInputParameters.sce new file mode 100644 index 0000000..52d8c7d --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test999_WorkingDir/SCI2CInputParameters.sce @@ -0,0 +1,89 @@ +// -----------------------------------------------------------------
+// === hArtes/PoliBa/GAP SCI2C tool ===
+// === Authors: ===
+// === Raffaele Nutricato ===
+// === raffaele.nutricato@tiscali.it ===
+// === Alberto Morea ===
+// === ===
+// === *************** ===
+// === USER PARAMETERS ===
+// === *************** ===
+// === ===
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+
+// ------------------------------------------
+// --- Specify Paths of User Scilab code. ---
+// ------------------------------------------
+// UserSciCodeMainDir = 'D:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\svnhartes\src\Scilab2C\SCI2CTests\test999_WorkingDir';
+UserSciCodeMainDir = '../SCI2CTests/test999_WorkingDir';
+
+// --- Path + filename of the .sci main file of the code to be translated. ---
+// It is the entry point.
+UserScilabMainFile = fullfile(UserSciCodeMainDir,'scilabcode/mainfunction.sci');
+
+// --- List of the paths containing the .sci files written by the user. ---
+UserSciFilesPaths = ...
+ [...
+ fullfile(UserSciCodeMainDir,'scilabcode');...
+ ];
+
+// --------------------------
+// --- End Specify paths. ---
+// --------------------------
+
+
+// ----------------------------
+// --- Select the run mode. ---
+// ----------------------------
+//RunMode = 'GenLibraryStructure';
+//RunMode = 'Translate';
+RunMode = 'All';
+
+// --- Select one of the following options. ---
+
+// 'GenLibraryStructure';
+// Generates the library structure and exits. It is very
+// useful when the user wants to manually change the files stored in that structure
+// before running the translation. 'GenLibraryStructure' option forces SCI2C to remove
+// the already existing WorkingDir and OutCCCodeDir directories.
+
+// 'Translate';
+// Performs the translation without generating the library structure. It means that the library
+// structure must be already existing. This is useful when the user doesn't want to spend time
+// to generate again that structure or when he wants to force the SCI2C tool to access to
+// a manually-changed library structure. 'Translate' option forces SCI2C to don't remove
+// the already existing WorkingDir. Only OutCCCodeDir directory will be removed.
+
+// 'All';
+// Performs all the actions listed above.
+
+// --------------------------------
+// --- End Select the run mode. ---
+// --------------------------------
+
+
+// ----------------------------
+// --- Translation Options. ---
+// ----------------------------
+// --- Enable (1) / Disable (0) copy of Scilab code into C code. ---
+// If 1 the Scilab code will be copied into the C code in order to show
+// how each Scilab code line has been translated into C code.
+CopySciCodeIntoCCode = 1;
+
+// --- Select the path style for the C code. ---
+// It can be:
+// windows
+// unix
+// cygwin
+CCompilerPathStyle = 'unix';
+
+// --- Path + File name of the main SCI2C library header file.
+// Sci2CLibMainHeaderFName = 'D:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\svnhartes\src\Scilab2C\Scilab2C\CFiles\sci2cincludes\sci2clib.h';
+Sci2CLibMainHeaderFName = '../../../Scilab2C/CFiles/sci2cincludes/sci2clib.h';
+// --------------------------------
+// --- End Translation Options. ---
+// --------------------------------
diff --git a/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci new file mode 100644 index 0000000..e39f764 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci @@ -0,0 +1,30 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE
+ +function mainfunction()
+ +// ------------------------------ +// --- Simple Scalar Addition --- +// ------------------------------ +a = 1; +b = 2; +c = 0; +c = a + b; +disp(c); + +// ------------------------------ +// --- Trigonometric Identity --- +// ------------------------------ +x = (1:3)' * (4:9); +y = (sin(x).^2) + (cos(x).^2); +disp(x); +disp(y-ones(3,6)); + +// ------------------------------- +// --- Computation of Distance --- +// ------------------------------- +// generate a vector w +w = cos(sin(cos(x*3)*2).* x+ones(3,6).*cos(x-sin(y*2))); +distxw = sqrt(x.^2 + w.^2); +disp(distxw); +endfunction +
\ No newline at end of file |