summaryrefslogtreecommitdiff
path: root/macros/FunctionAnnotation/FA_SZ_DIFF.sci
diff options
context:
space:
mode:
authorsiddhu89902016-06-14 12:30:32 +0530
committersiddhu89902016-06-14 12:30:32 +0530
commit396de3715ed2615f81325661c264341165f0edb2 (patch)
treec880fb359e61eb0b7ebf12755c4bdae34816f564 /macros/FunctionAnnotation/FA_SZ_DIFF.sci
parentc75fb67154fb5679d6ede9a52d5f5ae15600f9f9 (diff)
downloadScilab2C_fossee_old-396de3715ed2615f81325661c264341165f0edb2.tar.gz
Scilab2C_fossee_old-396de3715ed2615f81325661c264341165f0edb2.tar.bz2
Scilab2C_fossee_old-396de3715ed2615f81325661c264341165f0edb2.zip
Support added for diff, norm functions
Diffstat (limited to 'macros/FunctionAnnotation/FA_SZ_DIFF.sci')
-rw-r--r--macros/FunctionAnnotation/FA_SZ_DIFF.sci39
1 files changed, 39 insertions, 0 deletions
diff --git a/macros/FunctionAnnotation/FA_SZ_DIFF.sci b/macros/FunctionAnnotation/FA_SZ_DIFF.sci
new file mode 100644
index 0000000..df18310
--- /dev/null
+++ b/macros/FunctionAnnotation/FA_SZ_DIFF.sci
@@ -0,0 +1,39 @@
+// 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: Siddhesh Wani
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+
+//This fucntion calulates size of output depending upon input
+function outsize = FA_SZ_DIFF(in1size, in2val, in3val)
+ in1size = string(in1size);
+ in1row = eval(in1size(1));
+ in1col = eval(in1size(2));
+ in2val = string(in2val);
+ in2num = eval(in2val);
+ in3num = eval(in3val);
+
+if(in3num == 0)
+ if((in1row == 1) & (in1col <> 1)) //input is row vector
+ outsize(1) = '1';
+ outsize(2) = string (in1col - in2num);
+ elseif((in1col == 1) & (in1row <> 1)) //input is column vector
+ outsize(1) = string(in1row - in2num);
+ outsize(2) = '1';
+ else // input is matrix. output is a column matrix
+ outsize(1) = string((in1row * in1col)- in2num);
+ outsize(2) = '1';
+ end
+elseif (in3num == 1) //Difference along rows
+ outsize(1) = string(in1row - in2num);
+ outsize(2) = string(in1col);
+elseif (in3num == 2) //Difference along columns
+ outsize(1) = string(in1row);
+ outsize(2) = string(in1col - in2num);
+end
+endfunction \ No newline at end of file