diff options
author | Sunil Shetye | 2019-05-16 12:18:48 +0530 |
---|---|---|
committer | Sunil Shetye | 2019-05-29 11:08:01 +0530 |
commit | 26b77d7593b5ee0792b6b556f5569ea4227c2b02 (patch) | |
tree | 8f92052234b01bf39b9c3a6e3cb12b3962d96b1b /macros/FunctionAnnotation/FA_SZ_OPPLUS.sci | |
parent | 5a73e6bec4a12db7afae9de300e39256f754d8d3 (diff) | |
download | scilab2c-26b77d7593b5ee0792b6b556f5569ea4227c2b02.tar.gz scilab2c-26b77d7593b5ee0792b6b556f5569ea4227c2b02.tar.bz2 scilab2c-26b77d7593b5ee0792b6b556f5569ea4227c2b02.zip |
convert to unix format
Diffstat (limited to 'macros/FunctionAnnotation/FA_SZ_OPPLUS.sci')
-rw-r--r-- | macros/FunctionAnnotation/FA_SZ_OPPLUS.sci | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci b/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci index f439e23e..8ea8d86f 100644 --- a/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci +++ b/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci @@ -1,93 +1,93 @@ -function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type)
-// function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type)
-// -----------------------------------------------------------------
-// Returns the size of the output computed by OPPLUS operator,
-// including the string operations.
-//
-// Assuming:
-// size(in1) = [in1r,in1c]
-// size(in2) = [in2r,in2c]
-// size(out) = [outr,outc]
-//
-// we have the following combinations:
-// in1 in2 outr outc
-// -----------------------
-// S S in2r in2c
-// S M in2r in2c
-// M S in1r in1c
-// M M in1r in1c
-//
-// Where S means that the input is a scalar
-// and M means that the input is a matrix.
-// There is also the case related to the string catenation!
-// This is the main difference between - and + operators.
-//
-// Input data:
-// in1size: size of input number 1. It is an array of 2 strings.
-// The first string specifies the number of rows.
-// The second string specifies the number of columns.
-//
-// in2size: size of input number 2. It is an array of 2 strings.
-// The first string specifies the number of rows.
-// The second string specifies the number of columns.
-//
-// Output data:
-// opoutsize: size of output. It is an array of 2 strings.
-// The first string specifies the number of rows.
-// The second string specifies the number of columns.
-//
-// Status:
-// 08-Dec-2007 -- Raffaele Nutricato: Author.
-// 08-Dec-2007 -- Alberto Morea: Test Ok.
-//
-// Copyright 2007 Raffaele Nutricato & Alberto Morea.
-// Contact: raffaele.nutricato@tiscali.it
-// -----------------------------------------------------------------
-
-// ------------------------------
-// --- Check input arguments. ---
-// ------------------------------
-SCI2CNInArgCheck(argn(2),4,4);
-
-// ------------------------
-// --- Generate Output. ---
-// ------------------------
-// --- Get dimensions of input arguments. ---
-in1size = string(in1size);
-in2size = string(in2size);
-in1type = string(in1type);
-in2type = string(in2type);
-in1dim = GetSymbolDimension(in1size);
-
-if ((in1type ~= 'g') & (in2type ~= 'g'))
- opoutsize = FA_SZ_OPPLUSA(in1size,in2size);
-elseif ((in1type == 'g') & (in2type == 'g'))
- opoutsize(1) = '1';
- if (isnum(in1size(1)) & isnum(in2size(1)))
- in1num = eval(in1size(1));
- in2num = eval(in2size(1));
- if (in1num > 1 | in2num > 1)
- error(9999, 'String catenation can be performed only on strings of 1 x N size not N x 1 size');
- //NUT: mi pare che non possano proprio esistere stringe di dimensione Nx1 perche' in
- //NUT: scilab esiste il tipo string che e' di size 1x1 e sono io a trasformarlo in
- //NUT: 1xN per cui se uso sempre questa convenzione non sbaglio mai.
- //NUT: ho provato in scilab a fare la trasposta di una stringa e ottengo sempre 1x1.
- end
- end
- if (isnum(in1size(2)) & isnum(in2size(2)))
- in1num = eval(in1size(2));
- in2num = eval(in2size(2));
- opoutsize(2) = string(in1num+in2num-1);
- if isnan(opoutsize(2))
- opoutsize(2) = '__SCI2CNANSIZE';
- else
- opoutsize(2) = string(opoutsize(2));
- end
- else
- opoutsize(2) = '('+string(in1size(2))+'+'+string(in2size(2))+'-1)';
- end
-else
- error(9999, 'Unexpected type combination for ""+"" operator (type1,type2): ('+in1type+in2type+').');
-end
-
-endfunction
+function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) +// function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPPLUS operator, +// including the string operations. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in1c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// There is also the case related to the string catenation! +// This is the main difference between - and + operators. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),4,4); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1size = string(in1size); +in2size = string(in2size); +in1type = string(in1type); +in2type = string(in2type); +in1dim = GetSymbolDimension(in1size); + +if ((in1type ~= 'g') & (in2type ~= 'g')) + opoutsize = FA_SZ_OPPLUSA(in1size,in2size); +elseif ((in1type == 'g') & (in2type == 'g')) + opoutsize(1) = '1'; + if (isnum(in1size(1)) & isnum(in2size(1))) + in1num = eval(in1size(1)); + in2num = eval(in2size(1)); + if (in1num > 1 | in2num > 1) + error(9999, 'String catenation can be performed only on strings of 1 x N size not N x 1 size'); + //NUT: mi pare che non possano proprio esistere stringe di dimensione Nx1 perche' in + //NUT: scilab esiste il tipo string che e' di size 1x1 e sono io a trasformarlo in + //NUT: 1xN per cui se uso sempre questa convenzione non sbaglio mai. + //NUT: ho provato in scilab a fare la trasposta di una stringa e ottengo sempre 1x1. + end + end + if (isnum(in1size(2)) & isnum(in2size(2))) + in1num = eval(in1size(2)); + in2num = eval(in2size(2)); + opoutsize(2) = string(in1num+in2num-1); + if isnan(opoutsize(2)) + opoutsize(2) = '__SCI2CNANSIZE'; + else + opoutsize(2) = string(opoutsize(2)); + end + else + opoutsize(2) = '('+string(in1size(2))+'+'+string(in2size(2))+'-1)'; + end +else + error(9999, 'Unexpected type combination for ""+"" operator (type1,type2): ('+in1type+in2type+').'); +end + +endfunction |