diff options
author | Brijeshcr | 2017-07-21 17:27:46 +0530 |
---|---|---|
committer | Brijeshcr | 2017-07-21 17:27:46 +0530 |
commit | 07d9e48f562ecdfc20192c0af6cb06a413caf30e (patch) | |
tree | a57b1a927353f525a4a815ae52cd859f685d04ef | |
parent | 1a31eaf396c7cbb94a6e82776d3f64c857182bbe (diff) | |
parent | 388b2e5e833667609f9ddca5f86f5859c8819399 (diff) | |
download | Scilab2C_fossee_old-07d9e48f562ecdfc20192c0af6cb06a413caf30e.tar.gz Scilab2C_fossee_old-07d9e48f562ecdfc20192c0af6cb06a413caf30e.tar.bz2 Scilab2C_fossee_old-07d9e48f562ecdfc20192c0af6cb06a413caf30e.zip |
Median modified
89 files changed, 1529 insertions, 24 deletions
diff --git a/demos/Abhinav_Demos/Column.sci b/demos/Abhinav_Demos/Column.sci new file mode 100644 index 0000000..b9dc55b --- /dev/null +++ b/demos/Abhinav_Demos/Column.sci @@ -0,0 +1,26 @@ +// Test file for "Column" function for the data types double, float, double complex, string , uint16. +// All the below statements are added to initialize variables in different data types +//The function written doesn't work for string or character scalar as of now. + + +function Column() + a=[1,2,3,4; 5,6,7,8; 98,162,6587,0] + disp( iscolumn(a)) + disp('') + b= float(a) + disp(iscolumn(b)) + c= [1,2,34,5] + d= uint16(c) + disp(iscolumn(d)) + disp('') + f= [1;2;3;4] + disp(iscolumn(f)) + disp('') + u= uint16(c) + disp(iscolumn(u)) + disp('') + g= [%i] + disp(iscolumn(g)) + disp('') + +endfunction diff --git a/demos/Abhinav_Demos/Row.sci b/demos/Abhinav_Demos/Row.sci new file mode 100644 index 0000000..264b174 --- /dev/null +++ b/demos/Abhinav_Demos/Row.sci @@ -0,0 +1,25 @@ +// Test file for "Column" function for the data types double, float, double complex, string , uint16. +// All the below statements are added to initialize variables in different data types +//The function written doesn't work for string or character scalar as of now. + + +function Row() + a=[1,2,3,4; 5,6,7,8; 98,162,6587,0] + disp( isrow(a)) + disp('') + b= float(a) + disp(isrow(b)) + c= [1,2,34,5] + d= uint16(c) + disp(isrow(d)) + disp('') + f= [1;2;3;4] + disp(isrow(f)) + disp('') + u= uint16(c) + disp(isrow(u)) + disp('') + g= [%i*1; 7] + disp(isrow(g)) + disp('') +endfunction diff --git a/demos/Abhinav_Demos/deviation.sci b/demos/Abhinav_Demos/deviation.sci new file mode 100644 index 0000000..99eb5b1 --- /dev/null +++ b/demos/Abhinav_Demos/deviation.sci @@ -0,0 +1,41 @@ +function deviation() + +a=[ 211.128 2912 4.12 123 ; 53211 12.312 21 0] +disp('Double') + +disp(mad(a, 'r')) +disp('') + +disp(mad(a, 'c')) +disp('') + +disp(mad(a)) +disp('') + +disp('Float') + +b= float(a) +disp(mad(b, 'r')) +disp('') + +disp(mad(b, 'c')) +disp('') + +disp(mad(b)) +disp('') + + +disp('DoubleComplex') + +c= [%i*971+ 231, 87+%i*16, 2400+%i*1721; 981,0, %i*1213] +disp(mad(c, 'r')) +disp('') + +disp(mad(c, 'c')) +disp('') + +disp(mad(c)) +disp('') + +endfunction + diff --git a/demos/Abhinav_Demos/is_matrix.sci b/demos/Abhinav_Demos/is_matrix.sci new file mode 100644 index 0000000..540189e --- /dev/null +++ b/demos/Abhinav_Demos/is_matrix.sci @@ -0,0 +1,41 @@ + +// Test file for "ismatrix" function for the data types double, float, double complex, uint16, string + +function is_matrix() + disp('Double') + a= [1 ,25, 52] + disp(ismatrix(a)) + disp('') + b=1.2131 + disp(ismatrix(b)) + disp('') + + disp('Float') + c=float(a) + disp(ismatrix(c)) + disp('') + d=float(b) + disp(ismatrix(d)) + disp('') + + disp('String') + e= ['af' 'as' '12'; '121' 'king' 'queen' ] + disp(ismatrix(e)) + disp('') + f='Light' + disp(ismatrix(f)) + disp('') + + disp('doubleComplex') + g=[%i*2; %i*91+100] + disp(ismatrix(g)) + disp('') + h= %i*98.12 + 121 + disp(ismatrix(h)) + disp('') + + disp('Uint16') + i= [12, 231 ,213, 123] + disp(ismatrix(i)) + disp('') +endfunction diff --git a/demos/Abhinav_Demos/matrixreshape.sci b/demos/Abhinav_Demos/matrixreshape.sci new file mode 100644 index 0000000..38fa0a5 --- /dev/null +++ b/demos/Abhinav_Demos/matrixreshape.sci @@ -0,0 +1,18 @@ + +// Test file for "matrix" function for the data types double, float, double complex, uint16 + +function matrixreshape() + a=[1,2,3,4;5,6,7,8;8,9,1,2] + b=float(a) + c= uint16(b) + d=[%i*2,3,4,5;%i+34,45,32,23; 1,%i*54,8690,1] + +double1= matrix(a,4,3) +float1= matrix (b,4,3) +uint161= matrix(c,4,3) +complex1= matrix(d,4,3) +disp( double1) +disp( float1) +disp( uint161) +disp( complex1) +endfunction diff --git a/demos/Abhinav_Demos/med.sci b/demos/Abhinav_Demos/med.sci new file mode 100644 index 0000000..821ca1f --- /dev/null +++ b/demos/Abhinav_Demos/med.sci @@ -0,0 +1,66 @@ +function med() + +a=float([12,287,312,52; 4,5,456,512; 12, 4, 6,213]) + + +disp('Float') + + +disp(median(a, 'r')) +disp('') + +disp(median(a, 'c')) +disp('') + +disp(median(a)) +disp('') + + +b=[12,287,312,52; 4,5,456,512; 12, 4, 6,213] + + +disp('Double') + + +disp(median(b, 'r')) +disp('') + +disp(median(b, 'c')) +disp('') + +disp(median(b)) +disp('') + + + +disp('uint16') + + +c=uint16([12,287,312,52; 4,5,456,512; 12, 4, 6,213]) +disp(median(c, 'r')) +disp('') + +disp(median(c, 'c')) +disp('') + +disp(median(c)) +disp('') + + +disp('doubleComplex') + + +d= [%i*21, 65+%i*7, %i*121, 56; %i*6112, 12 ,3, 0] +disp(median(d, 'r')) +disp('') + +disp(median(d, 'c')) +disp('') + +disp(median(d)) +disp('') + + + +endfunction + diff --git a/demos/Abhinav_Demos/modula.sci b/demos/Abhinav_Demos/modula.sci new file mode 100644 index 0000000..8f56e6c --- /dev/null +++ b/demos/Abhinav_Demos/modula.sci @@ -0,0 +1,57 @@ +function modula() + +a=312 +b=18.12 +disp('Double') + +disp(pmodulo(a,b)) + +disp(pmodulo(a,-b)) + +disp(pmodulo(-a,b)) + +disp(pmodulo(-a,-b)) + +k=[12 , -134 , 1213; -12.12, -0.12, 91281] +l=[12, ,1212 ,12; -91288.12, -0.912, -10000] + +disp(pmodulo(k,l)) + +disp('Float') +c= float(312) +d=float(121.212) + +disp(pmodulo(c,d)) + +disp(pmodulo(c,-d)) + +disp(pmodulo(-c,d)) + +disp(pmodulo(-c,-d)) + +e=float([12 , -134 , 1213; -12.12, -0.12, 91281]) +f=float([12, ,1212 ,12; -91288.12, -0.912, -10000]) + +disp( pmodulo(e,f)) + +disp('Uint16') + +g= int16(112) +h= int16(121) + +disp(pmodulo(g,h)) + +disp(pmodulo(g,-h)) + +disp(pmodulo(-g,h)) + +disp(pmodulo(-g,-h)) + +i= int16([12 , -134 , 1213; -12.12, -12.54, 91281]) + +j= int16([12, ,1212 ,12; 1121, -6000, -10000]) +disp( pmodulo(i,j)) + + +endfunction + diff --git a/demos/Abhinav_Demos/nan_max.sci b/demos/Abhinav_Demos/nan_max.sci new file mode 100644 index 0000000..769a92a --- /dev/null +++ b/demos/Abhinav_Demos/nan_max.sci @@ -0,0 +1,33 @@ +function nan_max() + +x=[%nan 0.121 %nan 0.5 0.8; 0.12 %nan 9 12 %nan] + +disp('Double') + +disp(nanmax(x)) +disp('') + +disp(nanmax(x , 'r')) +disp('') + +disp(nanmax(x, 'c')) +disp('') + +y= uint16(x) + +disp('Float') + +disp(nanmax(y)) +disp('') + +disp(nanmax(y , 'r')) +disp('') + +disp(nanmax(y, 'c')) +disp('') + + + + +endfunction + diff --git a/demos/Abhinav_Demos/nonzero.sci b/demos/Abhinav_Demos/nonzero.sci new file mode 100644 index 0000000..14a1416 --- /dev/null +++ b/demos/Abhinav_Demos/nonzero.sci @@ -0,0 +1,15 @@ + +// Test file for "nonzero" function for the data types double, float, double complex, uint16 + +function nonzero() + a=[12,4,4; 12,51,6] // double array + disp(nnz(a)) + b=0 //double scalar + disp(nnz(b)) + f= float(a) //float array + disp(nnz(f)) + z=%i*2+0 // doubleComplex scalar + disp(nnz(z)) + + +endfunction diff --git a/demos/Abhinav_Demos/nthroot1.sci b/demos/Abhinav_Demos/nthroot1.sci new file mode 100644 index 0000000..201338b --- /dev/null +++ b/demos/Abhinav_Demos/nthroot1.sci @@ -0,0 +1,23 @@ +// Test file for "nthroot" function for the data types double, float, double complex. + + +function nthroot1() + b= [1,2,3,4;5,6,7,8] + c=[45,12,4,12; 23,34,5,6] + d= nthroot(b,c) +disp(d) +disp('') +e=34 +f= nthroot(b,e) +disp(f) +disp('') +k=nthroot(3.2123,12) +disp(k) +disp('') + +m= float(b) +l= float(c) +disp(nthroot(m,l)) + + +endfunction diff --git a/demos/Abhinav_Demos/scalar.sci b/demos/Abhinav_Demos/scalar.sci new file mode 100644 index 0000000..6b280ea --- /dev/null +++ b/demos/Abhinav_Demos/scalar.sci @@ -0,0 +1,12 @@ +// Test file for "isscalar" function for the data types double, float, double complex. +function scalar() + a=[1,2,3,4] + disp(isscalar(a)) + b= float(a) + disp(isscalar(b)) + c= %i*2+34 + disp(isscalar(c)) + + + +endfunction diff --git a/demos/Abhinav_Demos/square.sci b/demos/Abhinav_Demos/square.sci new file mode 100644 index 0000000..172f73c --- /dev/null +++ b/demos/Abhinav_Demos/square.sci @@ -0,0 +1,13 @@ +// Test file for "Column" function for the data types double, float, double complex, string. +// All the below statements are added to initialize variables in different data types + + +function square() + a=[1,2,3,4; 5,6,7,8; 98,162,6587,0] + disp(issquare(a)) + disp('') + b= [%i+25, 1, %i*5+12] + disp(issquare(b)) + disp('') + +endfunction diff --git a/demos/Abhinav_Demos/vector.sci b/demos/Abhinav_Demos/vector.sci new file mode 100644 index 0000000..dedd8f1 --- /dev/null +++ b/demos/Abhinav_Demos/vector.sci @@ -0,0 +1,16 @@ +// Test file for "vector" function for the data types double, float, double complex. +function vector() + a=[1,2,3,4] + disp(isvector(a)) + disp('') + b= %i+2 + disp(isvector(b)) + disp('') + c= float([1,3,4;1,2,3]) + disp(isvector(c)) + disp('') + d= [%i*812; %i*12] + disp(isvector(d)) + disp('') + +endfunction diff --git a/includes/sci2clib.h b/includes/sci2clib.h index d7d9e4f..caad1f1 100644 --- a/includes/sci2clib.h +++ b/includes/sci2clib.h @@ -185,6 +185,12 @@ extern "C" { /*interfacing nthroot*/ #include "nthroot.h" #include "int_nthroot.h" +/*interfacing pmodulo*/ +#include "pmodulo.h" +#include "int_pmodulo.h" +/*interfacing nanmax*/ +#include "nanmax.h" +#include "int_nanmax.h" /*interfacing issquare*/ #include "issquare.h" #include "int_issquare.h" diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar Binary files differindex ed68182..526697f 100644 --- a/jar/scilab_en_US_help.jar +++ b/jar/scilab_en_US_help.jar diff --git a/macros/ASTManagement/lib b/macros/ASTManagement/lib Binary files differdeleted file mode 100644 index dee4362..0000000 --- a/macros/ASTManagement/lib +++ /dev/null diff --git a/macros/CCodeGeneration/lib b/macros/CCodeGeneration/lib Binary files differdeleted file mode 100644 index 3d4fed1..0000000 --- a/macros/CCodeGeneration/lib +++ /dev/null diff --git a/macros/ErrorMessages/lib b/macros/ErrorMessages/lib Binary files differdeleted file mode 100644 index ba3b9a5..0000000 --- a/macros/ErrorMessages/lib +++ /dev/null diff --git a/macros/FunctionAnnotation/lib b/macros/FunctionAnnotation/lib Binary files differdeleted file mode 100644 index 239105c..0000000 --- a/macros/FunctionAnnotation/lib +++ /dev/null diff --git a/macros/FunctionList/lib b/macros/FunctionList/lib Binary files differdeleted file mode 100644 index 1c722dd..0000000 --- a/macros/FunctionList/lib +++ /dev/null diff --git a/macros/GeneralFunctions/lib b/macros/GeneralFunctions/lib Binary files differdeleted file mode 100644 index 7586a91..0000000 --- a/macros/GeneralFunctions/lib +++ /dev/null diff --git a/macros/Hardware/AVR/lib b/macros/Hardware/AVR/lib Binary files differdeleted file mode 100644 index ed4c52b..0000000 --- a/macros/Hardware/AVR/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Digital/lib b/macros/Hardware/RasberryPi/Digital/lib Binary files differdeleted file mode 100644 index ba42ba7..0000000 --- a/macros/Hardware/RasberryPi/Digital/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/I2C/lib b/macros/Hardware/RasberryPi/I2C/lib Binary files differdeleted file mode 100644 index 561476c..0000000 --- a/macros/Hardware/RasberryPi/I2C/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Interrupt/lib b/macros/Hardware/RasberryPi/Interrupt/lib Binary files differdeleted file mode 100644 index 97a61ac..0000000 --- a/macros/Hardware/RasberryPi/Interrupt/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Misc/lib b/macros/Hardware/RasberryPi/Misc/lib Binary files differdeleted file mode 100644 index c718615..0000000 --- a/macros/Hardware/RasberryPi/Misc/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/SPI/lib b/macros/Hardware/RasberryPi/SPI/lib Binary files differdeleted file mode 100644 index a16d474..0000000 --- a/macros/Hardware/RasberryPi/SPI/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Serial/lib b/macros/Hardware/RasberryPi/Serial/lib Binary files differdeleted file mode 100644 index a007f00..0000000 --- a/macros/Hardware/RasberryPi/Serial/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Setup/lib b/macros/Hardware/RasberryPi/Setup/lib Binary files differdeleted file mode 100644 index 83655c9..0000000 --- a/macros/Hardware/RasberryPi/Setup/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Shift/lib b/macros/Hardware/RasberryPi/Shift/lib Binary files differdeleted file mode 100644 index 2b12025..0000000 --- a/macros/Hardware/RasberryPi/Shift/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Soft/lib b/macros/Hardware/RasberryPi/Soft/lib Binary files differdeleted file mode 100644 index 09ecede..0000000 --- a/macros/Hardware/RasberryPi/Soft/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/Timing/lib b/macros/Hardware/RasberryPi/Timing/lib Binary files differdeleted file mode 100644 index d271c90..0000000 --- a/macros/Hardware/RasberryPi/Timing/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/gertBoard/lib b/macros/Hardware/RasberryPi/gertBoard/lib Binary files differdeleted file mode 100644 index e8db080..0000000 --- a/macros/Hardware/RasberryPi/gertBoard/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/lcd/lib b/macros/Hardware/RasberryPi/lcd/lib Binary files differdeleted file mode 100644 index c2b693f..0000000 --- a/macros/Hardware/RasberryPi/lcd/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/lcd128x64/lib b/macros/Hardware/RasberryPi/lcd128x64/lib Binary files differdeleted file mode 100644 index 94dfda8..0000000 --- a/macros/Hardware/RasberryPi/lcd128x64/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/lib b/macros/Hardware/RasberryPi/lib Binary files differdeleted file mode 100644 index 49ed811..0000000 --- a/macros/Hardware/RasberryPi/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/mcp/lib b/macros/Hardware/RasberryPi/mcp/lib Binary files differdeleted file mode 100644 index d411aad..0000000 --- a/macros/Hardware/RasberryPi/mcp/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/pcf/lib b/macros/Hardware/RasberryPi/pcf/lib Binary files differdeleted file mode 100644 index da6a8da..0000000 --- a/macros/Hardware/RasberryPi/pcf/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/piGlow/lib b/macros/Hardware/RasberryPi/piGlow/lib Binary files differdeleted file mode 100644 index 3f30f85..0000000 --- a/macros/Hardware/RasberryPi/piGlow/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/pinMap/lib b/macros/Hardware/RasberryPi/pinMap/lib Binary files differdeleted file mode 100644 index 133363e..0000000 --- a/macros/Hardware/RasberryPi/pinMap/lib +++ /dev/null diff --git a/macros/Hardware/RasberryPi/pwm/lib b/macros/Hardware/RasberryPi/pwm/lib Binary files differdeleted file mode 100644 index 8711baf..0000000 --- a/macros/Hardware/RasberryPi/pwm/lib +++ /dev/null diff --git a/macros/ImageProcessing/core/lib b/macros/ImageProcessing/core/lib Binary files differdeleted file mode 100644 index 40b7b0a..0000000 --- a/macros/ImageProcessing/core/lib +++ /dev/null diff --git a/macros/ImageProcessing/highgui/lib b/macros/ImageProcessing/highgui/lib Binary files differdeleted file mode 100644 index 0d7f88a..0000000 --- a/macros/ImageProcessing/highgui/lib +++ /dev/null diff --git a/macros/ImageProcessing/imgproc/lib b/macros/ImageProcessing/imgproc/lib Binary files differdeleted file mode 100644 index 63b5e7e..0000000 --- a/macros/ImageProcessing/imgproc/lib +++ /dev/null diff --git a/macros/Scilab-Arduino/lib b/macros/Scilab-Arduino/lib Binary files differdeleted file mode 100644 index a62fd4e..0000000 --- a/macros/Scilab-Arduino/lib +++ /dev/null diff --git a/macros/SymbolTable/lib b/macros/SymbolTable/lib Binary files differdeleted file mode 100644 index 4379c83..0000000 --- a/macros/SymbolTable/lib +++ /dev/null diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 1de6c84..436d8bc 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -982,6 +982,70 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// -------------------
+// --- Class Pmodulo. ---
+// -------------------
+ClassName = 'Pmodulo';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+//---Function list class. ----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y');
+PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+PrintStringInfo('i160i160'+ArgSeparator+'i160',ClassFileName,'file','y');
+PrintStringInfo('i162i162'+ArgSeparator+'i162',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'pmodulo';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+// -------------------
+// --- Class Nanmax. ---
+// -------------------
+ClassName = 'Nanmax';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_SEL1(IN(1).SZ(1),IN(2).VAL)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_SEL2(IN(1).SZ(2),IN(2).VAL)',ClassFileName,'file','y');
+//---Function list class. ----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'s0',ClassFileName,'file','y');
+PrintStringInfo('s2g2'+ArgSeparator+'s2',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'nanmax';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
// -------------------
// --- Class Issquare. ---
// -------------------
@@ -1106,6 +1170,8 @@ PrintStringInfo('g2'+ArgSeparator+'g0',ClassFileName,'file','y'); PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y');
PrintStringInfo('z2'+ArgSeparator+'g0',ClassFileName,'file','y');
PrintStringInfo('z0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('u162'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('u160'+ArgSeparator+'g0',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'ismatrix';
@@ -1911,6 +1977,11 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'median'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
FunctionName = 'st_deviation'; // BJ : Not implemented
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -7298,6 +7369,38 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex //------------------------------------
+//---- Class NNZ---------------------
+//------------------------------------
+ClassName = 'NNZ';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u16''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'u160',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'nnz';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
//---- Class TRIU ---------------------
//------------------------------------
ClassName = 'TRIU';
diff --git a/macros/ToolInitialization/lib b/macros/ToolInitialization/lib Binary files differdeleted file mode 100644 index 670a52e..0000000 --- a/macros/ToolInitialization/lib +++ /dev/null diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index 25c84b4..90b80df 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -132,6 +132,8 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/elementaryFunctions/includes/asech.h" "src/c/elementaryFunctions/includes/isrow.h" "src/c/elementaryFunctions/includes/nthroot.h" + "src/c/elementaryFunctions/includes/pmodulo.h" + "src/c/elementaryFunctions/includes/nanmax.h" "src/c/elementaryFunctions/includes/issquare.h" "src/c/elementaryFunctions/includes/isscalar.h" "src/c/elementaryFunctions/includes/isvector.h" diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index b9985a6..4982900 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -103,6 +103,8 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_linspace.h" "src/c/elementaryFunctions/interfaces/int_isrow.h" "src/c/elementaryFunctions/interfaces/int_nthroot.h" + "src/c/elementaryFunctions/interfaces/int_pmodulo.h" + "src/c/elementaryFunctions/interfaces/int_nanmax.h" "src/c/elementaryFunctions/interfaces/int_issquare.h" "src/c/elementaryFunctions/interfaces/int_isscalar.h" "src/c/elementaryFunctions/interfaces/int_isvector.h" diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index 1301292..cbb0a1e 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -308,6 +308,12 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/matrixOperations/matrix/smatrixa.c" "src/c/matrixOperations/matrix/u16matrixa.c" "src/c/matrixOperations/matrix/zmatrixa.c" + "src/c/matrixOperations/nnz/dnnza.c" + "src/c/matrixOperations/nnz/dnnzs.c" + "src/c/matrixOperations/nnz/snnza.c" + "src/c/matrixOperations/nnz/snnzs.c" + "src/c/matrixOperations/nnz/znnza.c" + "src/c/matrixOperations/nnz/znnzs.c" "src/c/matrixOperations/triu/dtriua.c" "src/c/matrixOperations/triu/striua.c" "src/c/matrixOperations/triu/u8triua.c" @@ -798,7 +804,18 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/nthroot/snthroota.c" "src/c/elementaryFunctions/nthroot/snthroot1a.c" "src/c/elementaryFunctions/nthroot/snthroots.c" - + "src/c/elementaryFunctions/pmodulo/dpmodulos.c" + "src/c/elementaryFunctions/pmodulo/dpmoduloa.c" + "src/c/elementaryFunctions/pmodulo/spmodulos.c" + "src/c/elementaryFunctions/pmodulo/spmoduloa.c" + "src/c/elementaryFunctions/pmodulo/i16pmodulos.c" + "src/c/elementaryFunctions/pmodulo/i16pmoduloa.c" + "src/c/elementaryFunctions/nanmax/dnanmaxa.c" + "src/c/elementaryFunctions/nanmax/dnanmaxcola.c" + "src/c/elementaryFunctions/nanmax/dnanmaxrowa.c" + "src/c/elementaryFunctions/nanmax/snanmaxa.c" + "src/c/elementaryFunctions/nanmax/snanmaxcola.c" + "src/c/elementaryFunctions/nanmax/snanmaxrowa.c" "src/c/elementaryFunctions/isscalar/disscalara.c" "src/c/elementaryFunctions/isscalar/disscalars.c" "src/c/elementaryFunctions/isscalar/gisscalars.c" @@ -817,14 +834,24 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/elementaryFunctions/iscolumn/ziscolumns.c" "src/c/elementaryFunctions/iscolumn/u16iscolumna.c" "src/c/elementaryFunctions/iscolumn/u16iscolumns.c" + "src/c/elementaryFunctions/isvector/disvectora.c" + "src/c/elementaryFunctions/isvector/disvectors.c" + "src/c/elementaryFunctions/isvector/gisvectors.c" + "src/c/elementaryFunctions/isvector/gisvectora.c" + "src/c/elementaryFunctions/isvector/sisvectors.c" + "src/c/elementaryFunctions/isvector/sisvectora.c" + "src/c/elementaryFunctions/isvector/zisvectora.c" + "src/c/elementaryFunctions/isvector/zisvectors.c" "src/c/elementaryFunctions/ismatrix/dismatrixa.c" "src/c/elementaryFunctions/ismatrix/dismatrixs.c" - //"src/c/elementaryFunctions/ismatrix/gismatrixs.c" - //"src/c/elementaryFunctions/ismatrix/gismatrixa.c" - //"src/c/elementaryFunctions/ismatrix/sismatrixs.c" - //"src/c/elementaryFunctions/ismatrix/sismatrixa.c" - //"src/c/elementaryFunctions/ismatrix/zismatrixa.c" - //"src/c/elementaryFunctions/ismatrix/zismatrixs.c" + "src/c/elementaryFunctions/ismatrix/gismatrixs.c" + "src/c/elementaryFunctions/ismatrix/gismatrixa.c" + "src/c/elementaryFunctions/ismatrix/sismatrixs.c" + "src/c/elementaryFunctions/ismatrix/sismatrixa.c" + "src/c/elementaryFunctions/ismatrix/zismatrixa.c" + "src/c/elementaryFunctions/ismatrix/zismatrixs.c" + "src/c/elementaryFunctions/ismatrix/u16ismatrixa.c" + "src/c/elementaryFunctions/ismatrix/u16ismatrixs.c" "src/c/elementaryFunctions/acscd/dacscda.c" "src/c/elementaryFunctions/acscd/dacscds.c" "src/c/elementaryFunctions/acscd/sacscda.c" @@ -915,6 +942,27 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/statisticsFunctions/meanf/zmeanfdz.c" "src/c/statisticsFunctions/meanf/cmeanfsc.c" "src/c/statisticsFunctions/meanf/zcolumnmeanfa.c" + "src/c/statisticsFunctions/median/dmediana.c" + "src/c/statisticsFunctions/median/dmedianrowa.c" + "src/c/statisticsFunctions/median/dmediancola.c" + "src/c/statisticsFunctions/median/smediana.c" + "src/c/statisticsFunctions/median/smedianrowa.c" + "src/c/statisticsFunctions/median/smediancola.c" + "src/c/statisticsFunctions/median/u16mediana.c" + "src/c/statisticsFunctions/median/u16medianrowa.c" + "src/c/statisticsFunctions/median/u16mediancola.c" + "src/c/statisticsFunctions/median/zmediana.c" + "src/c/statisticsFunctions/median/zmediancola.c" + "src/c/statisticsFunctions/median/zmedianrowa.c" + "src/c/statisticsFunctions/mad/dmada.c" + "src/c/statisticsFunctions/mad/dmadrowa.c" + "src/c/statisticsFunctions/mad/dmadcola.c" + "src/c/statisticsFunctions/mad/smada.c" + "src/c/statisticsFunctions/mad/smadrowa.c" + "src/c/statisticsFunctions/mad/smadcola.c" + "src/c/statisticsFunctions/mad/zmada.c" + "src/c/statisticsFunctions/mad/zmadrowa.c" + "src/c/statisticsFunctions/mad/zmadcola.c" "src/c/statisticsFunctions/prod/srowproda.c" "src/c/statisticsFunctions/prod/drowproda.c" "src/c/statisticsFunctions/prod/dproda.c" diff --git a/macros/findDeps/lib b/macros/findDeps/lib Binary files differdeleted file mode 100644 index afcd3ca..0000000 --- a/macros/findDeps/lib +++ /dev/null diff --git a/macros/lib b/macros/lib Binary files differdeleted file mode 100644 index 551263e..0000000 --- a/macros/lib +++ /dev/null diff --git a/src/c/elementaryFunctions/includes/ismatrix.h b/src/c/elementaryFunctions/includes/ismatrix.h index 072bfdc..0dd8b4a 100644 --- a/src/c/elementaryFunctions/includes/ismatrix.h +++ b/src/c/elementaryFunctions/includes/ismatrix.h @@ -17,6 +17,7 @@ #include "types.h" #include "doubleComplex.h" #include "floatComplex.h" +#include "uint16.h" #ifdef __cplusplus extern "C" { @@ -30,6 +31,8 @@ char gismatrixa(char*); char gismatrixs(char); char zismatrixa(doubleComplex*); char zismatrixs(doubleComplex); +char u16ismatrixa(uint16*); +char u16ismatrixs(uint16); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/elementaryFunctions/includes/isvector.h b/src/c/elementaryFunctions/includes/isvector.h index 5f45abb..75599cd 100644 --- a/src/c/elementaryFunctions/includes/isvector.h +++ b/src/c/elementaryFunctions/includes/isvector.h @@ -22,13 +22,13 @@ extern "C" { #endif -char disvectora(double* , int); +char disvectora(double* , int, int); char disvectors(double); -char sisvectora( float* , int); +char sisvectora( float* , int, int); char sisvectors( float); -char gisvectora(char* , int); +char gisvectora(char* , int, int ); char gisvectors(char); -char zisvectora(doubleComplex*, int); +char zisvectora(doubleComplex*, int, int); char zisvectors(doubleComplex); #ifdef __cplusplus diff --git a/src/c/elementaryFunctions/includes/nanmax.h b/src/c/elementaryFunctions/includes/nanmax.h new file mode 100644 index 0000000..bea83f7 --- /dev/null +++ b/src/c/elementaryFunctions/includes/nanmax.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __NANMAX_H__ +#define __NANMAX_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmaxa (double* , int); +void dnanmaxrowa (double*, int , int, double*); +void dnanmaxcola (double*, int , int, double*); + +float snanmaxa (float* , int); +void snanmaxrowa (float*, int , int, float*); +void snanmaxcola (float*, int , int, float*); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/pmodulo.h b/src/c/elementaryFunctions/includes/pmodulo.h new file mode 100644 index 0000000..d46febc --- /dev/null +++ b/src/c/elementaryFunctions/includes/pmodulo.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __PMODULO_H__ +#define __PMODULO_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dpmoduloa(double*, int ,double*, double*); +double dpmodulos(double, double); + +void spmoduloa(float*, int ,float*, float*); +float spmodulos(float, float); + +void i16pmoduloa(int16*, int ,int16*, int16*); +int16 i16pmodulos(int16, int16); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_ismatrix.h b/src/c/elementaryFunctions/interfaces/int_ismatrix.h index 56dfc85..96352d1 100644 --- a/src/c/elementaryFunctions/interfaces/int_ismatrix.h +++ b/src/c/elementaryFunctions/interfaces/int_ismatrix.h @@ -21,6 +21,8 @@ #define g0ismatrixg0(in) gismatrixs(in) #define z2ismatrixg0(in, size) zismatrixa(in) #define z0ismatrixg0(in) zismatrixs(in) +#define u162ismatrixg0(in, size) u16ismatrixa(in) +#define u160ismatrixg0(in) u16ismatrixs(in) #endif diff --git a/src/c/elementaryFunctions/interfaces/int_isvector.h b/src/c/elementaryFunctions/interfaces/int_isvector.h index 6d943bd..a4edaea 100644 --- a/src/c/elementaryFunctions/interfaces/int_isvector.h +++ b/src/c/elementaryFunctions/interfaces/int_isvector.h @@ -13,13 +13,13 @@ #ifndef __INT_ISVECTOR_H__ #define __INT_ISVECTOR_H__ -#define d2isvectorg0(in, size ) disvectora(in, size[0]) +#define d2isvectorg0(in, size ) disvectora(in, size[0], size[1]) #define d0isvectorg0(in) disvectors(in) -#define s2isvectorg0(in , size) sisvectora(in, size[0]) +#define s2isvectorg0(in , size) sisvectora(in, size[0], size[1]) #define s0isvectorg0(in) sisvectors(in) -#define g2isvectorg0(in, size) gisvectora(in, size[0]) +#define g2isvectorg0(in, size) gisvectora(in, size[0], size[1]) #define g0isvectorg0(in) gisvectors(in) -#define z2isvectorg0(in, size) zisvectora(in , size[0]) +#define z2isvectorg0(in, size) zisvectora(in , size[0], size[1]) #define z0isvectorg0(in) zisvectors(in) diff --git a/src/c/elementaryFunctions/interfaces/int_nanmax.h b/src/c/elementaryFunctions/interfaces/int_nanmax.h new file mode 100644 index 0000000..dd3df71 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nanmax.h @@ -0,0 +1,27 @@ + /*This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_NANMAX_H__ +#define __INT_NANMAX_H__ + +#define d2nanmaxd0(in1, size) dnanmaxa(in1,size[0]* size[1]) +#define d2g2nanmaxd2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmaxrowa(in1, size1[0], size1[1], out) : dnanmaxcola(in1, size1[0] , size1[1], out) + +#define s2nanmaxs0(in1, size) snanmaxa(in1,size[0]* size[1]) +#define s2g2nanmaxs2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanmaxrowa(in1, size1[0], size1[1], out) : snanmaxcola(in1, size1[0] , size1[1], out) + + +//#define i160i160pmoduloi160(in1, in2) i16pmodulos(in1,in2) +//#define i162i162pmoduloi162(in1, size1, in2, size2, out) i16pmoduloa(in1,size1[0]*size1[1],in2, out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_pmodulo.h b/src/c/elementaryFunctions/interfaces/int_pmodulo.h new file mode 100644 index 0000000..72b1277 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_pmodulo.h @@ -0,0 +1,26 @@ + /*This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_PMODULO_H__ +#define __INT_PMODULO_H__ + +#define d0d0pmodulod0(in1, in2) dpmodulos(in1,in2) +#define d2d2pmodulod2(in1, size1, in2, size2, out) dpmoduloa(in1,size1[0]*size1[1],in2, out) + +#define s0s0pmodulos0(in1, in2) spmodulos(in1,in2) +#define s2s2pmodulos2(in1, size1, in2, size2, out) spmoduloa(in1,size1[0]*size1[1],in2, out) + +#define i160i160pmoduloi160(in1, in2) i16pmodulos(in1,in2) +#define i162i162pmoduloi162(in1, size1, in2, size2, out) i16pmoduloa(in1,size1[0]*size1[1],in2, out) + + +#endif diff --git a/src/c/elementaryFunctions/ismatrix/dismatrixs.c b/src/c/elementaryFunctions/ismatrix/dismatrixs.c index f1c99dc..15edcf2 100644 --- a/src/c/elementaryFunctions/ismatrix/dismatrixs.c +++ b/src/c/elementaryFunctions/ismatrix/dismatrixs.c @@ -17,6 +17,6 @@ #include "types.h" char dismatrixs(double in) { - char out= 'F' ; + char out= 'T' ; return out; } diff --git a/src/c/elementaryFunctions/ismatrix/gismatrixa.c b/src/c/elementaryFunctions/ismatrix/gismatrixa.c new file mode 100644 index 0000000..f728814 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/gismatrixa.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char gismatrixa(char* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/gismatrixs.c b/src/c/elementaryFunctions/ismatrix/gismatrixs.c new file mode 100644 index 0000000..61a3062 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/gismatrixs.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char gismatrixs(char in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/sismatrixa.c b/src/c/elementaryFunctions/ismatrix/sismatrixa.c new file mode 100644 index 0000000..44335b8 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/sismatrixa.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char sismatrixa(float* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/sismatrixs.c b/src/c/elementaryFunctions/ismatrix/sismatrixs.c new file mode 100644 index 0000000..d6c6f23 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/sismatrixs.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char sismatrixs(float in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c b/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c new file mode 100644 index 0000000..c16d54c --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +char u16ismatrixa(uint16* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c b/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c new file mode 100644 index 0000000..6431357 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +char u16ismatrixs(uint16 in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/zismatrixa.c b/src/c/elementaryFunctions/ismatrix/zismatrixa.c new file mode 100644 index 0000000..32d7260 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/zismatrixa.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +char zismatrixa(doubleComplex* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/zismatrixs.c b/src/c/elementaryFunctions/ismatrix/zismatrixs.c new file mode 100644 index 0000000..d38592c --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/zismatrixs.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +char zismatrixs(doubleComplex in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/isvector/disvectora.c b/src/c/elementaryFunctions/isvector/disvectora.c index 3c41027..a96485b 100644 --- a/src/c/elementaryFunctions/isvector/disvectora.c +++ b/src/c/elementaryFunctions/isvector/disvectora.c @@ -15,9 +15,9 @@ #include <math.h> #include "isvector.h" #include "types.h" -char disvectora(double* inp, int size1) +char disvectora(double* inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/isvector/gisvectora.c b/src/c/elementaryFunctions/isvector/gisvectora.c index d2e261e..758fa87 100644 --- a/src/c/elementaryFunctions/isvector/gisvectora.c +++ b/src/c/elementaryFunctions/isvector/gisvectora.c @@ -16,9 +16,9 @@ #include "isvector.h" #include "types.h" #include "string.h" -char gisvectora(char *inp, int size1) +char gisvectora(char *inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/isvector/sisvectora.c b/src/c/elementaryFunctions/isvector/sisvectora.c index 09ad651..d6a4821 100644 --- a/src/c/elementaryFunctions/isvector/sisvectora.c +++ b/src/c/elementaryFunctions/isvector/sisvectora.c @@ -15,9 +15,9 @@ #include <math.h> #include "isvector.h" #include "types.h" -char sisvectora(float* inp, int size1) +char sisvectora(float* inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/isvector/zisvectora.c b/src/c/elementaryFunctions/isvector/zisvectora.c index fba7812..0ed64a6 100644 --- a/src/c/elementaryFunctions/isvector/zisvectora.c +++ b/src/c/elementaryFunctions/isvector/zisvectora.c @@ -17,9 +17,9 @@ #include "isvector.h" #include "types.h" -char zisvectora(doubleComplex *inp, int size1) +char zisvectora(doubleComplex *inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxa.c b/src/c/elementaryFunctions/nanmax/dnanmaxa.c new file mode 100644 index 0000000..4ff4a1a --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxa.c @@ -0,0 +1,53 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +double dnanmaxa(double* in, int size) +{ +double high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + + } + + + } + + + } + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxcola.c b/src/c/elementaryFunctions/nanmax/dnanmaxcola.c new file mode 100644 index 0000000..9db0742 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxcola.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxcola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dnanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c b/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c new file mode 100644 index 0000000..191fa01 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnanmaxa( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxa.c b/src/c/elementaryFunctions/nanmax/snanmaxa.c new file mode 100644 index 0000000..1eab1ac --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxa.c @@ -0,0 +1,53 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +float snanmaxa(float* in, int size) +{ +float high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + + } + + + } + + + } + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxcola.c b/src/c/elementaryFunctions/nanmax/snanmaxcola.c new file mode 100644 index 0000000..b408052 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxcola.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxcola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= snanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxrowa.c b/src/c/elementaryFunctions/nanmax/snanmaxrowa.c new file mode 100644 index 0000000..ab1ce0c --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxrowa.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= snanmaxa( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/znanmaxa.c b/src/c/elementaryFunctions/nanmax/znanmaxa.c new file mode 100644 index 0000000..6283bf1 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/znanmaxa.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +#include "doubleComplex.h" +#include "abs.h" + +doubleComplex znanmaxa(doubleComplex* in, int size) +{ +doubleComplex high=0; int k=0; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + k= 1; + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( zabss(in[i]) > zabss(high)) + { + high= in[i]; + + } + + + } + + + } + + +if(k != 0) +return high; +else +return - 0.0/0.0; +} diff --git a/src/c/elementaryFunctions/nanmax/znanmaxcola.c b/src/c/elementaryFunctions/nanmax/znanmaxcola.c new file mode 100644 index 0000000..ffb96b2 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/znanmaxcola.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znanmaxcola(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= znanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/znanmaxrowa.c b/src/c/elementaryFunctions/nanmax/znanmaxrowa.c new file mode 100644 index 0000000..e035e77 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/znanmaxrowa.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znanmaxrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= znanmaxa( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/pmodulo/dpmoduloa.c b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c new file mode 100644 index 0000000..0817987 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" +void dpmoduloa(double* inp1, int size, double* inp2, double* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= dpmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/dpmodulos.c b/src/c/elementaryFunctions/pmodulo/dpmodulos.c new file mode 100644 index 0000000..6144177 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/dpmodulos.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" + +double dpmodulos(double inp1, double inp2) +{ + if( inp1>0 && inp2>0) + + { + return fmod(inp1,inp2); + + } + + + if( inp1>0 && inp2<0) + + { + + return fmod(inp1,inp2); + + } + + + if(inp1<0 && inp2>0) + + { + + return ((fmod(inp1,inp2))+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((fmod(inp1,inp2))-(inp2)); + + } + +} diff --git a/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c new file mode 100644 index 0000000..bb76d7f --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "int16.h" +#include "pmodulo.h" +#include "types.h" +void i16pmoduloa(int16* inp1, int size, int16* inp2, int16* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= i16pmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/i16pmodulos.c b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c new file mode 100644 index 0000000..f7f86c5 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c @@ -0,0 +1,55 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "int16.h" +#include "pmodulo.h" +#include "types.h" + +int16 i16pmodulos(int16 inp1, int16 inp2) +{ + if( inp1>0 && inp2>0) + + { + return inp1%inp2; + + } + + + if( inp1>0 && inp2<0) + + { + + return inp1%inp2; + + } + + + if(inp1<0 && inp2>0) + + { + + return ((inp1%inp2)+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((inp1%inp2)-(inp2)); + + } + +} diff --git a/src/c/elementaryFunctions/pmodulo/spmoduloa.c b/src/c/elementaryFunctions/pmodulo/spmoduloa.c new file mode 100644 index 0000000..87b2a2f --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/spmoduloa.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" +void spmoduloa(float* inp1, int size, float* inp2, float* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= spmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/spmodulos.c b/src/c/elementaryFunctions/pmodulo/spmodulos.c new file mode 100644 index 0000000..9ab6bc4 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/spmodulos.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" + +float spmodulos(float inp1, float inp2) +{ + if( inp1>0 && inp2>0) + + { + return fmod(inp1,inp2); + + } + + + if( inp1>0 && inp2<0) + + { + + return fmod(inp1,inp2); + + } + + + if(inp1<0 && inp2>0) + + { + + return ((fmod(inp1,inp2))+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((fmod(inp1,inp2))-(inp2)); + + } + +} |