diff options
author | imushir | 2015-11-27 15:57:30 +0530 |
---|---|---|
committer | imushir | 2015-11-27 15:57:30 +0530 |
commit | 28f3476f927e5efcbbc2a7279d3ebbf74b1b4230 (patch) | |
tree | 552d64962433d87ab204ab9eeaa4527acc3d0171 /2.3-1/src/c/elementaryFunctions/pow | |
parent | 4120e7350530c14e18dd34d451bb4e825dea93f1 (diff) | |
download | Scilab2C-28f3476f927e5efcbbc2a7279d3ebbf74b1b4230.tar.gz Scilab2C-28f3476f927e5efcbbc2a7279d3ebbf74b1b4230.tar.bz2 Scilab2C-28f3476f927e5efcbbc2a7279d3ebbf74b1b4230.zip |
added c files for u8 u16 i8 i16
Diffstat (limited to '2.3-1/src/c/elementaryFunctions/pow')
20 files changed, 395 insertions, 2 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/pow/dpows.c b/2.3-1/src/c/elementaryFunctions/pow/dpows.c index c291bf71..cce89196 100644 --- a/2.3-1/src/c/elementaryFunctions/pow/dpows.c +++ b/2.3-1/src/c/elementaryFunctions/pow/dpows.c @@ -13,6 +13,7 @@ #include <math.h> #include "pow.h" -double dpows(double x, double p) { +double dpows(double x, double p) +{ return pow(x, p); } diff --git a/2.3-1/src/c/elementaryFunctions/pow/dpows.c~ b/2.3-1/src/c/elementaryFunctions/pow/dpows.c~ new file mode 100644 index 00000000..cce89196 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/dpows.c~ @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +double dpows(double x, double p) +{ + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i16powa.c b/2.3-1/src/c/elementaryFunctions/pow/i16powa.c new file mode 100644 index 00000000..e8e87fd3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i16powa.c @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void i16powa(int16* x, int size, int16* power, int16 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i16pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i16powa.c~ b/2.3-1/src/c/elementaryFunctions/pow/i16powa.c~ new file mode 100644 index 00000000..e8e87fd3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i16powa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void i16powa(int16* x, int size, int16* power, int16 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i16pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i16pows.c b/2.3-1/src/c/elementaryFunctions/pow/i16pows.c new file mode 100644 index 00000000..c8068c75 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i16pows.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +int16 i16pows(int16 x, int16 p) { + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i16pows.c~ b/2.3-1/src/c/elementaryFunctions/pow/i16pows.c~ new file mode 100644 index 00000000..c8068c75 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i16pows.c~ @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +int16 i16pows(int16 x, int16 p) { + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i8powa.c b/2.3-1/src/c/elementaryFunctions/pow/i8powa.c new file mode 100644 index 00000000..e17b666d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i8powa.c @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void i8powa(int8* x, int size, int8* power, int8 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i8pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i8powa.c~ b/2.3-1/src/c/elementaryFunctions/pow/i8powa.c~ new file mode 100644 index 00000000..e17b666d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i8powa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void i8powa(int8* x, int size, int8* power, int8 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i8pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i8pows.c b/2.3-1/src/c/elementaryFunctions/pow/i8pows.c new file mode 100644 index 00000000..3566c417 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i8pows.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +int8 i8pows(int8 x, int8 p) { + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/i8pows.c~ b/2.3-1/src/c/elementaryFunctions/pow/i8pows.c~ new file mode 100644 index 00000000..3566c417 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/i8pows.c~ @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +int8 i8pows(int8 x, int8 p) { + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u16powa.c b/2.3-1/src/c/elementaryFunctions/pow/u16powa.c new file mode 100644 index 00000000..65ba77e7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u16powa.c @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void u16powa(uint16* x, int size, uint16* power, uint16 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u16pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u16powa.c~ b/2.3-1/src/c/elementaryFunctions/pow/u16powa.c~ new file mode 100644 index 00000000..65ba77e7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u16powa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void u16powa(uint16* x, int size, uint16* power, uint16 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u16pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u16pows.c b/2.3-1/src/c/elementaryFunctions/pow/u16pows.c new file mode 100644 index 00000000..34672b0f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u16pows.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +uint16 u16pows(uint16 x, uint16 p) { + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u16pows.c~ b/2.3-1/src/c/elementaryFunctions/pow/u16pows.c~ new file mode 100644 index 00000000..34672b0f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u16pows.c~ @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +uint16 u16pows(uint16 x, uint16 p) { + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u8powa.c b/2.3-1/src/c/elementaryFunctions/pow/u8powa.c new file mode 100644 index 00000000..b69431c7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u8powa.c @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void u8powa(uint8* x, int size, uint8* power, uint8 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u8pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u8powa.c~ b/2.3-1/src/c/elementaryFunctions/pow/u8powa.c~ new file mode 100644 index 00000000..b69431c7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u8powa.c~ @@ -0,0 +1,25 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" + +void u8powa(uint8* x, int size, uint8* power, uint8 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u8pows(x[i], power[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u8pows.c b/2.3-1/src/c/elementaryFunctions/pow/u8pows.c new file mode 100644 index 00000000..786b9194 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u8pows.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +uint8 u8pows(uint8 x, uint8 p) +{ + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/u8pows.c~ b/2.3-1/src/c/elementaryFunctions/pow/u8pows.c~ new file mode 100644 index 00000000..4b5042ff --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/u8pows.c~ @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include <math.h> +#include "pow.h" + +uint8 u8pows(uint8 x, uint8 p) { + return pow(x, p); +} diff --git a/2.3-1/src/c/elementaryFunctions/pow/zpows.c b/2.3-1/src/c/elementaryFunctions/pow/zpows.c index 1a7059b2..4fe771ab 100644 --- a/2.3-1/src/c/elementaryFunctions/pow/zpows.c +++ b/2.3-1/src/c/elementaryFunctions/pow/zpows.c @@ -14,7 +14,7 @@ #include "log.h" #include "exp.h" -doubleComplex zpows(doubleComplex z, doubleComplex power) { +doubleComplex zpows(doubleComplex z, doubleComplex power) { /*Cas z=0 */ if ( (zreals(z)==0) && (zimags(z)==0) ){ /* Cas 0^0 */ diff --git a/2.3-1/src/c/elementaryFunctions/pow/zpows.c~ b/2.3-1/src/c/elementaryFunctions/pow/zpows.c~ new file mode 100644 index 00000000..1a7059b2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/pow/zpows.c~ @@ -0,0 +1,28 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * 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 + * + */ + +#include "pow.h" +#include "log.h" +#include "exp.h" + +doubleComplex zpows(doubleComplex z, doubleComplex power) { + /*Cas z=0 */ + if ( (zreals(z)==0) && (zimags(z)==0) ){ + /* Cas 0^0 */ + if ( (zreals(power)==0) && (zimags(power)==0) ) return DoubleComplex(1,0); + /* Cas 0^x, x!=0 */ + return DoubleComplex(0,0); + } + + /* Cas z!=0 */ + return zexps(zmuls(zlogs(z), power)); +} |