diff options
author | imushir | 2015-11-27 15:57:30 +0530 |
---|---|---|
committer | imushir | 2015-11-27 15:57:30 +0530 |
commit | 7ee19f77e6efc937e8b5a1a3b5ed1cb1419514bb (patch) | |
tree | 8b04f20e255e1501a13fc2d48cb25026c6fa5fe7 /src/c/elementaryFunctions/pow | |
parent | 2a31d542d5978830b714accc7b8cb6cf9c69d31d (diff) | |
download | Scilab2C_fossee_old-7ee19f77e6efc937e8b5a1a3b5ed1cb1419514bb.tar.gz Scilab2C_fossee_old-7ee19f77e6efc937e8b5a1a3b5ed1cb1419514bb.tar.bz2 Scilab2C_fossee_old-7ee19f77e6efc937e8b5a1a3b5ed1cb1419514bb.zip |
added c files for u8 u16 i8 i16
Diffstat (limited to 'src/c/elementaryFunctions/pow')
20 files changed, 395 insertions, 2 deletions
diff --git a/src/c/elementaryFunctions/pow/dpows.c b/src/c/elementaryFunctions/pow/dpows.c index c291bf7..cce8919 100644 --- a/src/c/elementaryFunctions/pow/dpows.c +++ b/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/src/c/elementaryFunctions/pow/dpows.c~ b/src/c/elementaryFunctions/pow/dpows.c~ new file mode 100644 index 0000000..cce8919 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i16powa.c b/src/c/elementaryFunctions/pow/i16powa.c new file mode 100644 index 0000000..e8e87fd --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i16powa.c~ b/src/c/elementaryFunctions/pow/i16powa.c~ new file mode 100644 index 0000000..e8e87fd --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i16pows.c b/src/c/elementaryFunctions/pow/i16pows.c new file mode 100644 index 0000000..c8068c7 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i16pows.c~ b/src/c/elementaryFunctions/pow/i16pows.c~ new file mode 100644 index 0000000..c8068c7 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i8powa.c b/src/c/elementaryFunctions/pow/i8powa.c new file mode 100644 index 0000000..e17b666 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i8powa.c~ b/src/c/elementaryFunctions/pow/i8powa.c~ new file mode 100644 index 0000000..e17b666 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i8pows.c b/src/c/elementaryFunctions/pow/i8pows.c new file mode 100644 index 0000000..3566c41 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/i8pows.c~ b/src/c/elementaryFunctions/pow/i8pows.c~ new file mode 100644 index 0000000..3566c41 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u16powa.c b/src/c/elementaryFunctions/pow/u16powa.c new file mode 100644 index 0000000..65ba77e --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u16powa.c~ b/src/c/elementaryFunctions/pow/u16powa.c~ new file mode 100644 index 0000000..65ba77e --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u16pows.c b/src/c/elementaryFunctions/pow/u16pows.c new file mode 100644 index 0000000..34672b0 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u16pows.c~ b/src/c/elementaryFunctions/pow/u16pows.c~ new file mode 100644 index 0000000..34672b0 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u8powa.c b/src/c/elementaryFunctions/pow/u8powa.c new file mode 100644 index 0000000..b69431c --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u8powa.c~ b/src/c/elementaryFunctions/pow/u8powa.c~ new file mode 100644 index 0000000..b69431c --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u8pows.c b/src/c/elementaryFunctions/pow/u8pows.c new file mode 100644 index 0000000..786b919 --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/u8pows.c~ b/src/c/elementaryFunctions/pow/u8pows.c~ new file mode 100644 index 0000000..4b5042f --- /dev/null +++ b/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/src/c/elementaryFunctions/pow/zpows.c b/src/c/elementaryFunctions/pow/zpows.c index 1a7059b..4fe771a 100644 --- a/src/c/elementaryFunctions/pow/zpows.c +++ b/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/src/c/elementaryFunctions/pow/zpows.c~ b/src/c/elementaryFunctions/pow/zpows.c~ new file mode 100644 index 0000000..1a7059b --- /dev/null +++ b/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)); +} |