diff options
author | siddhu8990 | 2017-04-19 14:57:49 +0530 |
---|---|---|
committer | siddhu8990 | 2017-04-19 14:57:49 +0530 |
commit | b9cfdca438347fe4d28f7caff3cb7b382e455d3a (patch) | |
tree | 948593b7d89741f804919a74f2e5e34b39adb0a0 /2.3-1/src/c/elementaryFunctions | |
parent | 586db6343e7b472d8dc3e63a82f4c73f99cdcbd7 (diff) | |
download | Scilab2C-b9cfdca438347fe4d28f7caff3cb7b382e455d3a.tar.gz Scilab2C-b9cfdca438347fe4d28f7caff3cb7b382e455d3a.tar.bz2 Scilab2C-b9cfdca438347fe4d28f7caff3cb7b382e455d3a.zip |
Merged Shamik's work
Diffstat (limited to '2.3-1/src/c/elementaryFunctions')
185 files changed, 3875 insertions, 1 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c new file mode 100644 index 00000000..b48876e3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c @@ -0,0 +1,14 @@ +#include "cosd.h" +#include <math.h> + +void dcosda(double* in,int size,double* out) +{ + double val=0.0; + val =3.14159265/180.0; + int i=0; + for (i=0;i<size;i++) + { + out[i] = cos(in[i]*val); + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c new file mode 100644 index 00000000..45507577 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c @@ -0,0 +1,11 @@ +#include <math.h> +#include "cos.h" +#include "cosd.h" + +double dcosds(double in) +{ + if(cos((M_PI/180.0)*in)==0.0) + return 0.0; + else + return (cos((M_PI/180.0)*in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c new file mode 100644 index 00000000..5224899b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c @@ -0,0 +1,9 @@ +#include "cos.h" +#include "cosd.h" + +void scosda(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = scosds(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c new file mode 100644 index 00000000..e99a1952 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c @@ -0,0 +1,11 @@ +#include <math.h> +#include "cosd.h" +#include "cos.h" + +float scosds(float in) +{ + if(cosf((M_PI/180.0)*in)==0.0) + return 0.0; + else + return (cosf((M_PI/180.0)*in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c new file mode 100644 index 00000000..3cf032a1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c @@ -0,0 +1,16 @@ +#include "cotd.h" +#include <math.h> +#define PI 3.14159265 + +void dcotda(double* in,int size,double* out) +{ + double val; + int i=0; + val = PI / 180.0; + for(i=0;i<size;i++) + { + out[i]=1/tan(in[i]*val); + /*printf("The cotangent of %lf degrees is %lf \n", in[i], out[i]);*/ + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c new file mode 100644 index 00000000..4ba95b84 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c @@ -0,0 +1,9 @@ +#include <math.h> +#include "cotd.h" + +double dcotds(double in) +{ +if(in==0) +printf("Inf\n"); + return (1/tan((M_PI/180.0)*in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c new file mode 100644 index 00000000..fd5a1e11 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c @@ -0,0 +1,9 @@ + +#include "cotd.h" + +void scotda(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = scosds(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c new file mode 100644 index 00000000..d635dbcd --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "cotd.h" + +float scotds(float in) +{ + return (1/tanf((M_PI/180.0)*in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c new file mode 100644 index 00000000..4e794512 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c @@ -0,0 +1,12 @@ +#include "coth.h" +#include <math.h> + +void ccotha(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccoths(in[i]); + } + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c new file mode 100644 index 00000000..564b8e69 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c @@ -0,0 +1,14 @@ +#include <math.h> +#include "coth.h" +#include <math.h> +#include "tanh.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex ccoths(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0), ctanhs(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c new file mode 100644 index 00000000..f6304f58 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c @@ -0,0 +1,14 @@ +#include "coth.h" +#include <math.h> + +void dcotha(double* in,int size,double* out) +{ + double val; + int i=0; + for(i=0;i<size;i++) + { + out[i]=cosh(in[i])/sinh(in[i]); + /*printf("The cotangent of %lf is %lf\n", in[i], out[i]);*/ + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c new file mode 100644 index 00000000..bf6bb78d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "coth.h" +#include "cosh.h" +#include "cos.h" +#include "sinh.h" +#include "sin.h" + +double dcoths(double in) { + return (cosh(in)/sinh(in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/scotha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/scotha.c new file mode 100644 index 00000000..3fdf37f7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/scotha.c @@ -0,0 +1,14 @@ +#include "coth.h" +#include <math.h> + +void scotha(float* in,int size,float* out) +{ + float val; + int i=0; + for(i=0;i<size;i++) + { + out[i]=cosh(in[i])/sinh(in[i]); + /*printf("The cotangent of %lf is %lf\n", in[i], out[i]);*/ + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/scoths.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/scoths.c new file mode 100644 index 00000000..107945e5 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/scoths.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "coth.h" +#include "cosh.h" +#include "cos.h" +#include "sinh.h" +#include "sin.h" + +float scoths(float in) { + return (cosh(in)/sinh(in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c new file mode 100644 index 00000000..dcbb2844 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c @@ -0,0 +1,11 @@ +#include "coth.h" +#include <math.h> + +void zcotha(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcoths(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c new file mode 100644 index 00000000..2eed86bb --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c @@ -0,0 +1,14 @@ +#include "coth.h" +#include "tanh.h" +#include "tan.h" +#include <math.h> +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcoths(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),ztanhs(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c new file mode 100644 index 00000000..5f5504a5 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c @@ -0,0 +1,11 @@ +#include "csc.h" +#include <math.h> + +void ccsca(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccscs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c new file mode 100644 index 00000000..af8b3eb2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c @@ -0,0 +1,16 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex ccscs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),csins(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c new file mode 100644 index 00000000..eeedea52 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c @@ -0,0 +1,10 @@ +#include "csc.h" + +void dcsca(double* in,int size,double* out) +{ + int i = 0; + for (i = 0;i<size;++i) + { + out[i] = dcscs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c new file mode 100644 index 00000000..31a6944e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c @@ -0,0 +1,9 @@ +#include "csc.h" +#include <math.h> + +double dcscs(double in) +{ + double out; + out=1/sin(in); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/scsca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/scsca.c new file mode 100644 index 00000000..3e6963ac --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/scsca.c @@ -0,0 +1,10 @@ +#include "csc.h" + +void scsca(float* in,int size,float* out) +{ + int i = 0; + for (i = 0;i<size;++i) + { + out[i] = scscs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/scscs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/scscs.c new file mode 100644 index 00000000..6d1b1b7f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/scscs.c @@ -0,0 +1,9 @@ +#include "csc.h" +#include <math.h> + +float scscs(float in) +{ + float out; + out=1/sin(in); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c new file mode 100644 index 00000000..4b8cdad6 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c @@ -0,0 +1,11 @@ +#include "csc.h" +#include <math.h> + +void zcsca(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcscs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c new file mode 100644 index 00000000..c0b692dc --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c @@ -0,0 +1,19 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcscs(doubleComplex z) +{ + doubleComplex out; + //out = zrdivs(DoubleComplex(1,0),zsins(z)); + double real = zreals(z); + double imag = zimags(z); + printf("%d , %d",real,imag); +return zrdivs(1+0*%i,(DoubleComplex(dsins(real) * dcoshs(imag), dcoss(real) * dsinhs(imag)))); + //return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c new file mode 100644 index 00000000..d18d3c71 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c @@ -0,0 +1,12 @@ +#include "csc.h" +#include "cscd.h" +#include <math.h> + +void ccscda(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccscds(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c new file mode 100644 index 00000000..8f1f9f75 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c @@ -0,0 +1,17 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "cscd.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex ccscds(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),csins(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c new file mode 100644 index 00000000..43e00430 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c @@ -0,0 +1,15 @@ +#include "cscd.h" +#include <math.h> +#define PI 3.14159265 + +void dcscda(double* in,int size,double* out) +{ + double val; + int i=0; + val = PI / 180.0; + for(i=0;i<size;i++) + { + out[i]=1/sin(in[i]*val); + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c new file mode 100644 index 00000000..d9a0df9a --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c @@ -0,0 +1,11 @@ +#include "cscd.h" +#include <math.h> + +double dcscds(double in) +{ + double val; + val = (M_PI) / 180.0; + double out; + out=1/sin(in*val); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c new file mode 100644 index 00000000..761d9413 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c @@ -0,0 +1,10 @@ +#include "cscd.h" + +void scscda(float* in,int size,float* out) +{ + int i = 0; + for (i = 0;i<size;++i) + { + out[i] = scscds(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c new file mode 100644 index 00000000..d4348549 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c @@ -0,0 +1,10 @@ +#include "cscd.h" +#include <math.h> + +float scscds(float in) +{ + float out,val; + val=(M_PI)/180.0; + out=1/sin(in*val); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c new file mode 100644 index 00000000..02f9e3b2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c @@ -0,0 +1,12 @@ +#include "csc.h" +#include "cscd.h" +#include <math.h> + +void zcscda(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcscds(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c new file mode 100644 index 00000000..351c8ff2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c @@ -0,0 +1,17 @@ +#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "cscd.h" +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcscds(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zsins(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c new file mode 100644 index 00000000..02a9ec1d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c @@ -0,0 +1,11 @@ +#include "csch.h" +#include <math.h> + +void ccscha(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = ccschs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c new file mode 100644 index 00000000..177a9fa4 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c @@ -0,0 +1,14 @@ +#include "csch.h" +#include "sinh.h" +#include "sin.h" +#include <math.h> +#include "floatComplex.h" +#include "division.h" + +floatComplex ccschs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),csinhs(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c new file mode 100644 index 00000000..ce87b6f8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c @@ -0,0 +1,8 @@ +#include "csch.h" + +void dcscha(double* in, int size, double* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = dcschs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c new file mode 100644 index 00000000..3b22544f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c @@ -0,0 +1,9 @@ +#include "csch.h" +#include <math.h> + +double dcschs(double in) +{ + double out; + out=1/sinh(in); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/scscha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/scscha.c new file mode 100644 index 00000000..880ffaae --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/scscha.c @@ -0,0 +1,8 @@ +#include "csch.h" + +void scscha(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = scschs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/scschs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/scschs.c new file mode 100644 index 00000000..8cd4e628 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/scschs.c @@ -0,0 +1,9 @@ +#include "csch.h" +#include <math.h> + +float scschs(float in) +{ + float out; + out=1/sinh(in); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c new file mode 100644 index 00000000..ae659dec --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c @@ -0,0 +1,11 @@ +#include "csch.h" +#include <math.h> + +void zcscha(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zcschs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c new file mode 100644 index 00000000..f3a9b227 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c @@ -0,0 +1,14 @@ +#include "csch.h" +#include "sinh.h" +#include "sin.h" +#include <math.h> +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zcschs(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zsinhs(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/cseca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/cseca.c new file mode 100644 index 00000000..139360af --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/cseca.c @@ -0,0 +1,11 @@ +#include "sec.h" +#include <math.h> + +void cseca(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = csecs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/csecs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/csecs.c new file mode 100644 index 00000000..51ea2242 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/csecs.c @@ -0,0 +1,13 @@ +#include "sec.h" +#include "cos.h" +#include <math.h> +#include "floatComplex.h" +#include "division.h" + +floatComplex csecs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),ccoss(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/dseca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/dseca.c new file mode 100644 index 00000000..986b52f3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/dseca.c @@ -0,0 +1,11 @@ +#include "sec.h" +#include <math.h> + +void dseca(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=1/cos(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c new file mode 100644 index 00000000..9135ad14 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "sec.h" + +double dsecs(double in) +{ + return (1/cos(in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/sseca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/sseca.c new file mode 100644 index 00000000..f5fd81bc --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/sseca.c @@ -0,0 +1,8 @@ +#include "sec.h" + +void sseca(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = ssecs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c new file mode 100644 index 00000000..2c9e018f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "sec.h" + +float ssecs(float in) +{ + return (1/cos(in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/zseca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/zseca.c new file mode 100644 index 00000000..7a80291f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/zseca.c @@ -0,0 +1,11 @@ +#include "sec.h" +#include <math.h> + +void zseca(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zsecs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c new file mode 100644 index 00000000..b5468db5 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c @@ -0,0 +1,57 @@ +/*//#include "sec.h" +//#include "cos.h" +//#include <math.h> +//#include "doubleComplex.h" +//#include "division.h" +*/ + +/*#include <math.h> +#include "sin.h" +#include "cos.h" +#include "sinh.h" +#include "cosh.h" +#include "csc.h" +#include "division.h" +*/ +#include <complex.h> +#include <stdio.h> + +/*doubleComplex zsecs(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zcoss(z)); + return out; +} +*/ +void zsecs(double complex z) +{ + + //double complex out; + /*out = zrdivs(DoubleComplex(1,0),zcoss(z)); + return out; +}*/ + + double complex out = 1.0/(ccos(z)); + if(cimag(out)==0.0) + { + printf("%.7lf\n",creal(out)); + //out=creal(out); + } + else if(creal(out)==0.0) + { + printf("%.7lfi\n",cimag(out)); + //out=cimag(out); + } + else if(creal(out)!=0.0 && cimag(out)<0.0) + { + printf("%.7lf %.7lfi\n",creal(out),cimag(out)); + //out=x; + } + else + { + printf("%.7lf + %.7lfi\n", creal(out), cimag(out)); + //out=x; + } + //return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c new file mode 100644 index 00000000..028595cd --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c @@ -0,0 +1,11 @@ +#include "secd.h" +#include <math.h> + +void dsecda(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=dsecds(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c new file mode 100644 index 00000000..7b08a467 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c @@ -0,0 +1,8 @@ +#include <math.h> +#include "sec.h" +#include "secd.h" + +double dsecds(double in) +{ + return (1/cos((M_PI/180.0)*in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c new file mode 100644 index 00000000..6267f943 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c @@ -0,0 +1,9 @@ +#include "sec.h" +#include "secd.h" + +void ssecda(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = ssecds(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c new file mode 100644 index 00000000..3fabb225 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c @@ -0,0 +1,7 @@ +#include <math.h> +#include "secd.h" +#include "sec.h" + +float ssecds(float in) { + return (1/cos((M_PI/180.0)*in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/csecha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/csecha.c new file mode 100644 index 00000000..dcd76d59 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/csecha.c @@ -0,0 +1,11 @@ +#include "sech.h" +#include <math.h> + +void csecha(floatComplex* in, int size,floatComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = csechs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/csechs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/csechs.c new file mode 100644 index 00000000..37ba6d95 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/csechs.c @@ -0,0 +1,15 @@ +#include "sech.h" +#include "sec.h" +#include <math.h> +#include "cos.h" +#include "cosh.h" +#include "floatComplex.h" +#include "division.h" + +floatComplex csechs(floatComplex z) +{ + + floatComplex out; + out = crdivs(FloatComplex(1,0),ccoshs(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c new file mode 100644 index 00000000..cfab81ff --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c @@ -0,0 +1,10 @@ +#include "sech.h" +#include <math.h> +void dsecha(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=dsechs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c new file mode 100644 index 00000000..10ca392a --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "sech.h" +#include "cosh.h" +#include "cos.h" + + +double dsechs(double in) +{ + return (1/cosh(in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c new file mode 100644 index 00000000..1d265639 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c @@ -0,0 +1,10 @@ +#include "sech.h" +#include <math.h> +void ssecha(float* in,int size,float* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=ssechs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c new file mode 100644 index 00000000..f582fd79 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c @@ -0,0 +1,10 @@ +#include <math.h> +#include "sech.h" +#include "cosh.h" +#include "cos.h" + + +float ssechs(float in) +{ + return (1/cosh(in)); +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c new file mode 100644 index 00000000..c48f8dab --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c @@ -0,0 +1,11 @@ +#include "sech.h" +#include <math.h> + +void zsecha(doubleComplex* in, int size,doubleComplex* out) +{ + int i = 0; + for (i=0;i<size;i++) + { + out[i] = zsechs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c new file mode 100644 index 00000000..93c95b3f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c @@ -0,0 +1,15 @@ +#include "sech.h" +#include "sec.h" +#include <math.h> +#include "cos.h" +#include "cosh.h" +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zsechs(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zcoshs(z)); + return out; +} diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c new file mode 100644 index 00000000..210670bb --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c @@ -0,0 +1,31 @@ +# include <stdio.h> +# include <math.h> + +void dfactors(double in,double* out) +{ + int i=0,k=0; + int n=(int)in; + while (n%2 == 0) + { + //printf("%d ", 2); + out[k++]=2; + n = n/2; + } + + for (i = 3; i <= sqrt(n); i = i+2) + { + while (n%i == 0) + { + out[k++]=i; + //printf("%d ", i); + n = n/i; + } + } + + if (n > 2) + { + out[k++]=n; + //printf ("%d ", n); + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c new file mode 100644 index 00000000..9a37140e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c @@ -0,0 +1,31 @@ +# include <stdio.h> +# include <math.h> + +void sfactors(float in,float* out) +{ + int i=0,k=0; + int n=(int)in; + while (n%2 == 0) + { + //printf("%d ", 2); + out[k++]=2; + n = n/2; + } + + for (i = 3; i <= sqrt(n); i = i+2) + { + while (n%i == 0) + { + out[k++]=i; + //printf("%d ", i); + n = n/i; + } + } + + if (n > 2) + { + out[k++]=n; + //printf ("%d ", n); + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactoriala.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactoriala.c new file mode 100644 index 00000000..de06aaa2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactoriala.c @@ -0,0 +1,12 @@ +#include "factorial.h" +#include <math.h> + +void dfactoriala(double* in,int size,double* out) +{ + int i=0; + for (i=0;i<size;i++) + { + out[i] = dfactorials(in[i]); + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactorials.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactorials.c new file mode 100644 index 00000000..28c787e9 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactorials.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <math.h> +#include "factorial.h" + +double dfactorials(double in) +{ + int i,n; + long long int fact=1; + n=(int)in; + if (n < 0) + printf("Error! Factorial of a negative number doesn't exist."); + else if (n>170) + printf("Inf"); + else + { + for(i=1; i<=n; i++) + { + fact=fact*i; + //printf("\n %lld",fact); + } + } + + return fact; +} diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactoriala.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactoriala.c new file mode 100644 index 00000000..e7d820b2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactoriala.c @@ -0,0 +1,12 @@ +#include "factorial.h" +#include <math.h> + +void sfactoriala(float* in,int size,float* out) +{ + int i=0; + for (i=0;i<size;i++) + { + out[i] = dfactorials(in[i]); + } +} + diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactorials.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactorials.c new file mode 100644 index 00000000..b660702d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactorials.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <math.h> +#include "factorial.h" + +float sfactorials(float in) +{ + int i,n; + long long int fact=1; + n=(int)in; + if (n < 0) + printf("Error! Factorial of a negative number doesn't exist."); + else if(n>170) + printf("Inf"); + else + { + for(i=1; i<=n; i++) + { + fact *= i; + } + } + + return fact; +} diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c new file mode 100644 index 00000000..5ecb92e1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c @@ -0,0 +1,24 @@ +#include<stdio.h> +#include "primes.h" +void dprimess(double in, double* out) +{ + int i=0,j=0,k=0,n=0,counter=0; + n=(int)in; + for(i=2;i<=n;i++) + { + counter=0; + for(j=2;j<i;j++) + { + if(i%j==0) + { + counter=1; + break; + } + } + if(counter==0) + { + out[k++]=i; + + } + } +} diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c new file mode 100644 index 00000000..14aa2365 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c @@ -0,0 +1,24 @@ +#include<stdio.h> +#include "primes.h" +void sprimess(float in, float* out) +{ + int i=0,j=0,k=0,n=0,counter=0; + n=(int)in; + for(i=2;i<=n;i++) + { + counter=0; + for(j=2;j<i;j++) + { + if(i%j==0) + { + counter=1; + break; + } + } + if(counter==0) + { + out[k]=i; + k++; + } + } +} diff --git a/2.3-1/src/c/elementaryFunctions/float/dfloata.c b/2.3-1/src/c/elementaryFunctions/float/dfloata.c new file mode 100644 index 00000000..e27b0a11 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/dfloata.c @@ -0,0 +1,7 @@ +#include "float.h" + +void dfloata(double* x, int size, float* out) { + int i = 0; + for (i=0;i<size;i++) + out[i] = dfloats(x[i]); +} diff --git a/2.3-1/src/c/elementaryFunctions/float/dfloats.c b/2.3-1/src/c/elementaryFunctions/float/dfloats.c new file mode 100644 index 00000000..a56c24c3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/dfloats.c @@ -0,0 +1,5 @@ +#include "float.h" + +float dfloats(double x) { + return (float) x; +} diff --git a/2.3-1/src/c/elementaryFunctions/float/i16floata.c b/2.3-1/src/c/elementaryFunctions/float/i16floata.c new file mode 100644 index 00000000..e2366b7d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/i16floata.c @@ -0,0 +1,6 @@ +#include "float.h" + +void i16floata(int16* x, int size, float* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16floats(x[i]); +} diff --git a/2.3-1/src/c/elementaryFunctions/float/i16floats.c b/2.3-1/src/c/elementaryFunctions/float/i16floats.c new file mode 100644 index 00000000..c0c073c7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/i16floats.c @@ -0,0 +1,5 @@ +#include "float.h" + +float i16floats(int16 x) { + return (float) x; +} diff --git a/2.3-1/src/c/elementaryFunctions/float/i8floata.c b/2.3-1/src/c/elementaryFunctions/float/i8floata.c new file mode 100644 index 00000000..b578fe56 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/i8floata.c @@ -0,0 +1,6 @@ +#include "float.h" + +void i8floata(int8* x, int size, float* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8floats(x[i]); +} diff --git a/2.3-1/src/c/elementaryFunctions/float/i8floats.c b/2.3-1/src/c/elementaryFunctions/float/i8floats.c new file mode 100644 index 00000000..15e4fc70 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/i8floats.c @@ -0,0 +1,5 @@ +#include "float.h" + +float i8floats(int8 x) { + return (float) x; +} diff --git a/2.3-1/src/c/elementaryFunctions/float/sfloata.c b/2.3-1/src/c/elementaryFunctions/float/sfloata.c new file mode 100644 index 00000000..c7583ba8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/sfloata.c @@ -0,0 +1,7 @@ +#include "float.h" + +void sfloata(float* x, int size, float* out) { + int i = 0; + for (i=0;i<size;i++) + out[i] = sfloats(x[i]); +} diff --git a/2.3-1/src/c/elementaryFunctions/float/sfloats.c b/2.3-1/src/c/elementaryFunctions/float/sfloats.c new file mode 100644 index 00000000..e579186c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/sfloats.c @@ -0,0 +1,5 @@ +#include "float.h" + +float sfloats(float x) { + return (float) x; +} diff --git a/2.3-1/src/c/elementaryFunctions/float/u16floata.c b/2.3-1/src/c/elementaryFunctions/float/u16floata.c new file mode 100644 index 00000000..28867cb9 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/u16floata.c @@ -0,0 +1,6 @@ +#include "float.h" + +void u16floata(uint16* x, int size, float* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16floats(x[i]); +} diff --git a/2.3-1/src/c/elementaryFunctions/float/u16floats.c b/2.3-1/src/c/elementaryFunctions/float/u16floats.c new file mode 100644 index 00000000..f46275de --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/u16floats.c @@ -0,0 +1,5 @@ +#include "float.h" + +float u16floats(uint16 x) { + return (float) x; +} diff --git a/2.3-1/src/c/elementaryFunctions/float/u8floata.c b/2.3-1/src/c/elementaryFunctions/float/u8floata.c new file mode 100644 index 00000000..84554204 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/u8floata.c @@ -0,0 +1,6 @@ +#include "float.h" + +void u8floata(uint8* x, int size, float* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8floats(x[i]); +} diff --git a/2.3-1/src/c/elementaryFunctions/float/u8floats.c b/2.3-1/src/c/elementaryFunctions/float/u8floats.c new file mode 100644 index 00000000..f2b4c261 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/float/u8floats.c @@ -0,0 +1,5 @@ +#include "float.h" + +float u8floats(uint8 x) { + return (float) x; +} diff --git a/2.3-1/src/c/elementaryFunctions/includes/base2dec.h b/2.3-1/src/c/elementaryFunctions/includes/base2dec.h new file mode 100644 index 00000000..426388ef --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/base2dec.h @@ -0,0 +1,28 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __BASE2DEC_H__ +#define __BASE2DEC_H__ + + + #ifdef __cplusplus + extern "C" { + #endif + +double gbase2decs(char* in,int size,int base); +double dbase2decs(double in,int base); +//void ghex2deca(char* in,int size,double* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__BASE2DEC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/bin2dec.h b/2.3-1/src/c/elementaryFunctions/includes/bin2dec.h new file mode 100644 index 00000000..792e3689 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/bin2dec.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __BIN2DEC_H__ +#define __BIN2DEC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +long double dbin2decs(long double in); +int8 i8bin2decs(int8 in); +//int16 i16bin2decs(int16 in); +uint8 u8bin2decs(uint8 in); +uint16 u16bin2decs(uint16 in); + +void dbin2deca(double* in,int size,double* out); +void i8bin2deca(int8* in,int size,int8* out); +//void i16bin2deca(int16* in,int size,int16* out); +void u8bin2deca(uint8* in,int size,uint8* out); +void u16bin2deca(uint16* in,int size,uint16* out); + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__BIN2DEC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/cosd.h b/2.3-1/src/c/elementaryFunctions/includes/cosd.h new file mode 100644 index 00000000..7cb59be1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/cosd.h @@ -0,0 +1,28 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __COSD_H__ +#define __COSD_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dcosda(double* in,int size,double* out); +void scosda(float* in,int size,float* out); +double dcosds(double in); +float scosds(float in); + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__COSD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/cotd.h b/2.3-1/src/c/elementaryFunctions/includes/cotd.h new file mode 100644 index 00000000..d2140cb0 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/cotd.h @@ -0,0 +1,29 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __COTD_H__ +#define __COTD_H__ + + + #ifdef __cplusplus + extern "C" { + #endif + +void dcotda(double* in,int size,double* out); +double dcotds(double in); +void scotda(float* in,int size,float* out); +float scotds(float in); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__COTD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/coth.h b/2.3-1/src/c/elementaryFunctions/includes/coth.h new file mode 100644 index 00000000..ac3f82c7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/coth.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __COTH_H__ +#define __COTH_H__ +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dcotha(double* in,int size,double* out); +double dcoths(double in); +void scotha(float* in,int size,float* out); +float scoths(float in); +doubleComplex zcoths(doubleComplex z); +void zcotha(doubleComplex* in, int size,doubleComplex* out); +void ccotha(floatComplex* in, int size,floatComplex* out); +floatComplex ccoths(floatComplex z); + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__COTH_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/csc.h b/2.3-1/src/c/elementaryFunctions/includes/csc.h new file mode 100644 index 00000000..6914c933 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/csc.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __CSC_H__ +#define __CSC_H__ +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dcsca(double* in,int size,double* out); +double dcscs(double in); +void scsca(float* in,int size,float* out); +float scscs(float in); +doubleComplex zcscs(doubleComplex z); +void zcsca(doubleComplex* in, int size,doubleComplex* out); +floatComplex ccscs(floatComplex z); +void ccsca(floatComplex* in, int size,floatComplex* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__CSC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/cscd.h b/2.3-1/src/c/elementaryFunctions/includes/cscd.h new file mode 100644 index 00000000..fad31551 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/cscd.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __CSCD_H__ +#define __CSCD_H__ +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dcscda(double* in,int size,double* out); +double dcscds(double in); +void scscda(float* in,int size,float* out); +float scscds(float in); + +void ccscda(floatComplex* in,int size,floatComplex* out); +floatComplex ccscds(floatComplex in); +void zcscda(doubleComplex* in,int size,doubleComplex* out); +doubleComplex zcscds(doubleComplex in); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__CSCD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/csch.h b/2.3-1/src/c/elementaryFunctions/includes/csch.h new file mode 100644 index 00000000..fd7b8cd1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/csch.h @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __CSCH_H__ +#define __CSCH_H__ +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dcscha(double* in,int size,double* out); +double dcschs(double in); +void scscha(float* in,int size,float* out); +float scschs(float in); + +void ccscha(floatComplex* in,int size,floatComplex* out); +floatComplex ccschs(floatComplex in); +void zcscha(doubleComplex* in,int size,doubleComplex* out); +doubleComplex zcschs(doubleComplex in); + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__CSCH_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/dec2base.h b/2.3-1/src/c/elementaryFunctions/includes/dec2base.h new file mode 100644 index 00000000..aa830072 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/dec2base.h @@ -0,0 +1,29 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __DEC2BASE_H__ +#define __DEC2BASE_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void ddec2bases(double in,int base,int n,char* out); +void ddec2basea(double* in,int size,int base,int n,char* out); +void sdec2bases(float in,int base,int n,char* out); +void sdec2basea(float* in,int size,int base,int n,char* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__DEC2BASE_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/dec2bin.h b/2.3-1/src/c/elementaryFunctions/includes/dec2bin.h new file mode 100644 index 00000000..d0917bba --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/dec2bin.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __DEC2BIN_H__ +#define __DEC2BIN_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void ddec2bins(double in,int n,double* out); +void i8dec2bins(int8 in,int n,int8* out); +void i16dec2bins(int16 in,int n,int16* out); +void u8dec2bins(uint8 in,int n,uint8* out); +void u16dec2bins(uint16 in,int n,uint16* out); + +void ddec2bina(double* in,int size,int n,double* out); +void i8dec2bina(int8* in,int size,int n,int8* out); +void i16dec2bina(int16* in,int size,int n,int16* out); +void u8dec2bina(uint8* in,int size,int n,uint8* out); +void u16dec2bina(uint16* in,int size,int n,uint16* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__DEC2BIN_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/dec2hex.h b/2.3-1/src/c/elementaryFunctions/includes/dec2hex.h new file mode 100644 index 00000000..e973a871 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/dec2hex.h @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __DEC2HEX_H__ +#define __DEC2HEX_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void ddec2hexs(double in,char* out); +void i8dec2hexs(int8 in,char* out); +void i16dec2hexs(int16 in,char* out); +void u8dec2hexs(uint8 in,char* out); +void u16dec2hexs(uint16 in,char* out); + +void ddec2hexa(double* in,int size,char* out); +void i8dec2hexa(int8* in,int size,char* out); +void i16dec2hexa(int16* in,int size,char* out); +void u8dec2hexa(uint8* in,int size,char* out); +void u16dec2hexa(uint16* in,int size,char* out); + + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__DEC2HEX_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/dec2oct.h b/2.3-1/src/c/elementaryFunctions/includes/dec2oct.h new file mode 100644 index 00000000..b0e38fa5 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/dec2oct.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __DEC2oct_H__ +#define __DEC2oct_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void ddec2octs(double in,double* out); +void i8dec2octs(int8 in,int8* out); +void i16dec2octs(int16 in,int16* out); +void u8dec2octs(uint8 in,uint8* out); +void u16dec2octs(uint16 in,uint16* out); + +void ddec2octa(double* in,int size,double* out); +void i8dec2octa(int8* in,int size,int8* out); +void i16dec2octa(int16* in,int size,int16* out); +void u8dec2octa(uint8* in,int size,uint8* out); +void u16dec2octa(uint16* in,int size,uint16* out); + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__DEC2oct_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/factor.h b/2.3-1/src/c/elementaryFunctions/includes/factor.h new file mode 100644 index 00000000..bec7277b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/factor.h @@ -0,0 +1,27 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __FACTOR_H__ +#define __FACTOR_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfactors(double in,double* out); +void sfactors(float in,float* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__FACTOR_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/factorial.h b/2.3-1/src/c/elementaryFunctions/includes/factorial.h new file mode 100644 index 00000000..077191e3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/factorial.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __FACTORIAL_H__ +#define __FACTORIAL_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dfactorials(double in); +//int8 i8factorials(int8 in); +//int16 i16factorials(int16 in); +//uint8 u8factorials(uint8 in); +//uint16 u16factorials(uint16 in); + +void dfactoriala(double* in,int size,double* out); +//void i8factoriala(int8* in,int size,int8* out); +//void i16factoriala(int16* in,int size,int16* out); +//void u8factoriala(uint8* in,int size,uint8* out); +//void u16factoriala(uint16* in,int size,uint16* out); + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__FACTORIAL_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/float.h b/2.3-1/src/c/elementaryFunctions/includes/float.h new file mode 100644 index 00000000..885564b2 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/float.h @@ -0,0 +1,54 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Arnaud Torset + * Author - Shamik Guha + * 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 + * + */ + +#ifndef __FLOAT_H__ +#define __FLOAT_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + float(X) returns the unsigned char part of the double value +*/ + +EXTERN_ELEMFUNCT float sfloats(float in); + +EXTERN_ELEMFUNCT float dfloats(double in); + +EXTERN_ELEMFUNCT float i8floats(int8 in); + +EXTERN_ELEMFUNCT float u16floats(uint16 in); + +EXTERN_ELEMFUNCT float i16floats(int16 in); + +EXTERN_ELEMFUNCT void sfloata(float* in, int size, float* out); + +EXTERN_ELEMFUNCT void dfloata(double* in, int size, float* out); + +EXTERN_ELEMFUNCT void i8floata(int8* in, int size, float* out); + +EXTERN_ELEMFUNCT void u16floata(uint16* in, int size, float* out); + +EXTERN_ELEMFUNCT void i16floata(int16* in, int size, float* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__FLOAT_H__ */ + diff --git a/2.3-1/src/c/elementaryFunctions/includes/hex2dec.h b/2.3-1/src/c/elementaryFunctions/includes/hex2dec.h new file mode 100644 index 00000000..f16a8541 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/hex2dec.h @@ -0,0 +1,27 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __HEX2DEC_H__ +#define __HEX2DEC_H__ + + + #ifdef __cplusplus + extern "C" { + #endif + +double ghex2decs(char* in,int size); +double dhex2decs(double in); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__HEX2DEC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/interp1.h b/2.3-1/src/c/elementaryFunctions/includes/interp1.h new file mode 100644 index 00000000..caf42439 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/interp1.h @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INTERP1_H__ +#define __INTERP1_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +double dinterp1s(double* x, int size, double* y,int size2, double xin, char* method,int size3); +//void i8interp1s(int8 in,char* out); +//void i16interp1s(int16 in,char* out); +//void u8interp1s(uint8 in,char* out); +//void u16interp1s(uint16 in,char* out); + +//void dinterp1a(double* in,int size,char* out); +//void i8interp1a(int8* in,int size,char* out); +//void i16interp1a(int16* in,int size,char* out); +//void u8interp1a(uint8* in,int size,char* out); +//void u16interp1a(uint16* in,int size,char* out); + + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INTERP1_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/oct2dec.h b/2.3-1/src/c/elementaryFunctions/includes/oct2dec.h new file mode 100644 index 00000000..0b454d11 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/oct2dec.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __OCT2DEC_H__ +#define __OCT2DEC_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +double doct2decs(double in); +int8 i8oct2decs(int8 in); +int16 i16oct2decs(int16 in); +uint8 u8oct2decs(uint8 in); +uint16 u16oct2decs(uint16 in); + +void doct2deca(double* in,int size,double* out); +void i8oct2deca(int8* in,int size,int8* out); +void i16oct2deca(int16* in,int size,int16* out); +void u8oct2deca(uint8* in,int size,uint8* out); +void u16oct2deca(uint16* in,int size,uint16* out); + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__OCT2DEC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/primes.h b/2.3-1/src/c/elementaryFunctions/includes/primes.h new file mode 100644 index 00000000..c541df9e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/primes.h @@ -0,0 +1,28 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __PRIMES_H__ +#define __PRIMES_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +void dprimess(double in,double* out); +void sprimess(float in,float* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__PRIMES_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/sec.h b/2.3-1/src/c/elementaryFunctions/includes/sec.h new file mode 100644 index 00000000..08120ed5 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/sec.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __SEC_H__ +#define __SEC_H__ +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +//#include "doubleComplex.h" +#include <complex.h> +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dseca(double* in,int size,double* out); +double dsecs(double in); +void sseca(float* in,int size,float* out); +float ssecs(float in); + +void zsecs(double complex z); +//void zseca(doubleComplex* in, int size,doubleComplex* out); +floatComplex csecs(floatComplex z); +void cseca(floatComplex* in, int size,floatComplex* out); + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__SEC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/secd.h b/2.3-1/src/c/elementaryFunctions/includes/secd.h new file mode 100644 index 00000000..bf9c653d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/secd.h @@ -0,0 +1,28 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __SECD_H__ +#define __SECD_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dsecda(double* in,int size,double* out); +void ssecda(float* in,int size,float* out); +double dsecds(double in); +float ssecds(float in); + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__SECD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/sech.h b/2.3-1/src/c/elementaryFunctions/includes/sech.h new file mode 100644 index 00000000..9b85396a --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/sech.h @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __SECH_H__ +#define __SECH_H__ +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + + #ifdef __cplusplus + extern "C" { + #endif + +void dsecha(double* in,int size,double* out); +double dsechs(double in); +void ssecha(float* in,int size,float* out); +float ssechs(float in); + +void csecha(floatComplex* in,int size,floatComplex* out); +floatComplex csechs(floatComplex in); +void zsecha(doubleComplex* in,int size,doubleComplex* out); +doubleComplex zsechs(doubleComplex in); + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__SECH_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_base2dec.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_base2dec.h new file mode 100644 index 00000000..8d5e68eb --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_base2dec.h @@ -0,0 +1,27 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_base2dec_H__ +#define __INT_base2dec_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define g2d0base2decd0(in,size,base) gbase2decs(in,size[1],base) +#define d0d0base2decd0(in,base) dbase2decs(in,base) +//#define g2d0base2decd2(in,size,out) gbase2deca(in,size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_base2dec_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_bin2dec.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_bin2dec.h new file mode 100644 index 00000000..c8e07b09 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_bin2dec.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_bin2dec_H__ +#define __INT_bin2dec_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0bin2decd0(in) dbin2decs(in) +#define i80bin2deci80(in) i8bin2decs(in) +//#define i160bin2deci160(in) i16bin2decs(in) +#define u80bin2decu80(in) u8bin2decs(in) +#define u160bin2decu160(in) u16bin2decs(in) + +#define d2bin2decd2(in,size,out) dbin2deca(in,size[0]*size[1],out) +#define i82bin2deci82(in,size,out) i8bin2deca(in,size[0]*size[1],out) +//#define i162bin2deci162(in,size,out) i16bin2deca(in,size[0]*size[1],out) +#define u82bin2decu82(in,size,out) u8bin2deca(in,size[0]*size[1],out) +#define u162bin2decu162(in,size,out) u16bin2deca(in,size[0]*size[1],out) + + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_bin2dec_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_cosd.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_cosd.h new file mode 100644 index 00000000..9ca9945b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_cosd.h @@ -0,0 +1,28 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_COSD_H__ +#define __INT_COSD_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2cosdd2(in,size,out) dcosda(in,size[1],out) +#define d0cosdd0(in) dcosds(in) +#define s2cosds2(in,size,out) scosda(in,size[1],out) +#define s0cosds0(in) scosds(in) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_COSD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_cotd.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_cotd.h new file mode 100644 index 00000000..382f7802 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_cotd.h @@ -0,0 +1,28 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_COTD_H__ +#define __INT_COTD_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2cotdd2(in,size,out) dcotda(in,size[1],out) +#define s2cotds2(in,size,out) scotda(in,size[1],out) +#define d0cotdd0(in) dcotds(in) +#define s0cotds0(in) scotds(in) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_COTD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_coth.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_coth.h new file mode 100644 index 00000000..db8887a3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_coth.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_COTH_H__ +#define __INT_COTH_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2cothd2(in,size,out) dcotha(in,size[1],out) +#define s2coths2(in,size,out) scotha(in,size[1],out) +#define d0cothd0(in) dcoths(in) +#define s0coths0(in) scoths(in) +#define z0cothz0(in) zcoths(in) +#define z2cothz2(in,size,out) zcoths(in,size[1],out) +#define c0cothc0(in) ccoths(in) +#define c2cothc2(in,size,out) ccoths(in,size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_COTH_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_csc.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_csc.h new file mode 100644 index 00000000..74038c97 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_csc.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_CSC_H__ +#define __INT_CSC_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2cscd2(in,size,out) dcsca(in,size[1],out) +#define d0cscd0(in) dcscs(in) +#define s2cscs2(in,size,out) scsca(in,size[1],out) +#define s0cscs0(in) scscs(in) +#define z2cscz2(in,size,out) zcsca(in,size[1],out) +#define z0cscz0(in) zcscs(in) +#define c2cscc2(in,size,out) ccsca(in,size[1],out) +#define c0cscc0(in) ccscs(in) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_CSC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_cscd.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_cscd.h new file mode 100644 index 00000000..99bc49a3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_cscd.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_CSCD_H__ +#define __INT_CSCD_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2cscdd2(in,size,out) dcscda(in,size[1],out) +#define d0cscdd0(in) dcscds(in) +#define s2cscds2(in,size,out) scscda(in,size[1],out) +#define s0cscds0(in) scscds(in) +#define z0cscdz0(in) zcscds(in) +#define z2cscdz2(in,size,out) zcscds(in,size[1],out) +#define c0cscdc0(in) ccscds(in) +#define c2cscdc2(in,size,out) ccscds(in,size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_CSCD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_csch.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_csch.h new file mode 100644 index 00000000..ce355895 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_csch.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_CSCH_H__ +#define __INT_CSCH_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2cschd2(in,size,out) dcscha(in,size[1],out) +#define d0cschd0(in) dcschs(in) +#define s2cschs2(in,size,out) scscha(in,size[1],out) +#define s0cschs0(in) scschs(in) +#define z0cschz0(in) zcschs(in) +#define z2cschz2(in,size,out) zcschs(in,size[1],out) +#define c0cschc0(in) ccschs(in) +#define c2cschc2(in,size,out) ccschs(in,size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_CSC_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2base.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2base.h new file mode 100644 index 00000000..637f099c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2base.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_dec2base_H__ +#define __INT_dec2base_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0d0dec2baseg2(in,base,out) ddec2bases(in,base,0,out) +#define s0d0dec2baseg2(in,base,out) sdec2bases(in,base,0,out) + +#define d2d0dec2baseg2(in,size,out) ddec2basea(in,size[0]*size[1],base,0,out) +#define s2d0dec2baseg2(in,size,out) sdec2basea(in,size[0]*size[1],base,0,out) + +#define d0d0d0dec2baseg2(in,base,n,out) ddec2bases(in,base,n,out) +#define s0d0d0dec2baseg2(in,base,n,out) sdec2bases(in,base,n,out) + +#define d2d0d0dec2baseg2(in,size,base,n,out) ddec2basea(in,size[0]*size[1],base,n,out) +#define s2d0d0dec2baseg2(in,size,base,n,out) sdec2basea(in,size[0]*size[1],base,n,out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_dec2base_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2bin.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2bin.h new file mode 100644 index 00000000..c6f2008b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2bin.h @@ -0,0 +1,48 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_dec2bin_H__ +#define __INT_dec2bin_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0dec2bind2(in,out) ddec2bins(in,0,out) +#define i80dec2bini82(in,out) i8dec2bins(in,0,out) +#define i160dec2bini162(in,out) i16dec2bins(in,0,out) +#define u80dec2binu82(in,out) u8dec2bins(in,0,out) +#define u160dec2binu162(in,out) u16dec2bins(in,0,out) + +#define d2dec2bind2(in,size,out) ddec2bina(in,size[0]*size[1],0,out) +#define i82dec2bini82(in,size,out) i8dec2bina(in,size[0]*size[1],0,out) +#define i162dec2bini162(in,size,out) i16dec2bina(in,size[0]*size[1],0,out) +#define u82dec2binu82(in,size,out) u8dec2bina(in,size[0]*size[1],0,out) +#define u162dec2binu162(in,size,out) u16dec2bina(in,size[0]*size[1],0,out) + +#define d0d0dec2bind2(in,n,out) ddec2bins(in,n,out) +#define i80d0dec2bini82(in,n,out) i8dec2bins(in,n,out) +#define i160d0dec2bini162(in,n,out) i16dec2bins(in,n,out) +#define u80d0dec2binu82(in,n,out) u8dec2bins(in,n,out) +#define u160d0dec2binu162(in,n,out) u16dec2bins(in,n,out) + +#define d2d0dec2bind2(in,size,n,out) ddec2bina(in,size[0]*size[1],n,out) +#define i82d0dec2bini82(in,size,n,out) i8dec2bina(in,size[0]*size[1],n,out) +#define i162d0dec2bini162(in,size,n,out) i16dec2bina(in,size[0]*size[1],n,out) +#define u82d0dec2binu82(in,size,n,out) u8dec2bina(in,size[0]*size[1],n,out) +#define u162d0dec2binu162(in,size,n,out) u16dec2bina(in,size[0]*size[1],n,out) + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_dec2bin_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2hex.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2hex.h new file mode 100644 index 00000000..bed85be1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2hex.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_dec2hex_H__ +#define __INT_dec2hex_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0dec2hexg2(in,out) ddec2hexs(in,out) +#define i80dec2hexg2(in,out) i8dec2hexs(in,out) +#define i160dec2hexg2(in,out) i16dec2hexs(in,out) +#define u80dec2hexg2(in,out) u8dec2hexs(in,out) +#define u160dec2hexg2(in,out) u16dec2hexs(in,out) + +#define d2dec2hexg2(in,size,out) ddec2hexa(in,size[0]*size[1],out) +#define i82dec2hexg2(in,size,out) i8dec2hexa(in,size[0]*size[1],out) +#define i162dec2hexg2(in,size,out) i16dec2hexa(in,size[0]*size[1],out) +#define u82dec2hexg2(in,size,out) u8dec2hexa(in,size[0]*size[1],out) +#define u162dec2hexg2(in,size,out) u16dec2hexa(in,size[0]*size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_dec2hex_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2oct.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2oct.h new file mode 100644 index 00000000..5cf61be1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_dec2oct.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_dec2oct_H__ +#define __INT_dec2oct_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0dec2octd2(in,out) ddec2octs(in,out) +#define i80dec2octi82(in,out) i8dec2octs(in,out) +#define i160dec2octi162(in,out) i16dec2octs(in,out) +#define u80dec2octu82(in,out) u8dec2octs(in,out) +#define u160dec2octu162(in,out) u16dec2octs(in,out) + +#define d2dec2octd2(in,size,out) ddec2octa(in,size[0]*size[1],out) +#define i82dec2octi82(in,size,out) i8dec2octa(in,size[0]*size[1],out) +#define i162dec2octi162(in,size,out) i16dec2octa(in,size[0]*size[1],out) +#define u82dec2octu82(in,size,out) u8dec2octa(in,size[0]*size[1],out) +#define u162dec2octu162(in,size,out) u16dec2octa(in,size[0]*size[1],out) + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_dec2oct_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_factor.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_factor.h new file mode 100644 index 00000000..5e0991aa --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_factor.h @@ -0,0 +1,29 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_FACTOR_H__ +#define __INT_FACTOR_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0factord2(in,out) dfactors(in,out) +#define s0factors2(in,out) sfactors(in,out) + + + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_FACTOR_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_factorial.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_factorial.h new file mode 100644 index 00000000..446b5135 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_factorial.h @@ -0,0 +1,31 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_FACTORIAL_H__ +#define __INT_FACTORIAL_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0factoriald0(in) dfactorials(in) +#define s0factorials0(in) sfactorials(in) + +#define d2factoriald2(in,size,out) dfactoriala(in,size[0]*size[1],out) +#define s2factorials2(in,size,out) sfactoriala(in,size[0]*size[1],out) + + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_FACTORIAL_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_float.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_float.h new file mode 100644 index 00000000..df9aa395 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_float.h @@ -0,0 +1,38 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * Author - Shamik Guha + * 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 + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_FLOAT_H__ +#define __INT_FLOAT_H__ + +#define s0floats0(in) sfloats(in) + +#define d0floats0(in) dfloats(in) + +#define i80floats0(in) i8floats(in) + +#define u160floats0(in) u16floats(in) + +#define i160floats0(in) i16floats(in) + +#define s2floats2(in,size,out) sfloata(in, size[0]*size[1], out) + +#define d2floats2(in,size,out) dfloata(in, size[0]*size[1], out) + +#define i82floats2(in,size,out) i8floata(in, size[0]*size[1], out) + +#define u162floats2(in,size,out) u16floata(in, size[0]*size[1], out) + +#define i162floats2(in,size,out) i16floata(in, size[0]*size[1], out) + +#endif /* !__INT_FLOAT_H__ */ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_hex2dec.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_hex2dec.h new file mode 100644 index 00000000..d5589369 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_hex2dec.h @@ -0,0 +1,26 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_hex2dec_H__ +#define __INT_hex2dec_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define g2hex2decd0(in,size) ghex2decs(in,size[1]) +#define d0hex2decd0(in) dhex2decs(in) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_hex2dec_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_interp1.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_interp1.h new file mode 100644 index 00000000..bafe915e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_interp1.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_INTERP1_H__ +#define __INT_INTERP1_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2d2d0g2interp1d0(x,size,y,size2,xin,method,size3) dinterp1s(x,size[1],y,size2[1],xin,method,size3[1]) +//#define i80interp1g2(in,out) i8interp1s(in,out) +//#define i160interp1g2(in,out) i16interp1s(in,out) +//#define u80interp1g2(in,out) u8interp1s(in,out) +//#define u160interp1g2(in,out) u16interp1s(in,out) + +//#define d2interp1g2(in,size,out) dinterp1a(in,size[0]*size[1],out) +//#define i82interp1g2(in,size,out) i8interp1a(in,size[0]*size[1],out) +//#define i162interp1g2(in,size,out) i16interp1a(in,size[0]*size[1],out) +//#define u82interp1g2(in,size,out) u8interp1a(in,size[0]*size[1],out) +//#define u162interp1g2(in,size,out) u16interp1a(in,size[0]*size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_interp1_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_oct2dec.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_oct2dec.h new file mode 100644 index 00000000..0f5d1f24 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_oct2dec.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_oct2dec_H__ +#define __INT_oct2dec_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0oct2decd0(in) doct2decs(in) +#define i80oct2deci80(in) i8oct2decs(in) +#define i160oct2deci160(in) i16oct2decs(in) +#define u80oct2decu80(in) u8oct2decs(in) +#define u160oct2decu160(in) u16oct2decs(in) + +#define d2oct2decd2(in,size,out) doct2deca(in,size[0]*size[1],out) +#define i82oct2deci82(in,size,out) i8oct2deca(in,size[0]*size[1],out) +#define i162oct2deci162(in,size,out) i16oct2deca(in,size[0]*size[1],out) +#define u82oct2decu82(in,size,out) u8oct2deca(in,size[0]*size[1],out) +#define u162oct2decu162(in,size,out) u16oct2deca(in,size[0]*size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_oct2dec_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_primes.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_primes.h new file mode 100644 index 00000000..d48a6831 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_primes.h @@ -0,0 +1,29 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_PRIMES_H__ +#define __INT_PRIMES_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d0primesd2(in,out) dprimess(in,out) +#define s0primess2(in,out) sprimess(in,out) + + + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_PRIMES_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_sec.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_sec.h new file mode 100644 index 00000000..b07cdfc9 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_sec.h @@ -0,0 +1,34 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_SEC_H__ +#define __INT_SEC_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2secd2(in,size,out) dseca(in,size[1],out) +#define d0secd0(in) dsecs(in) +#define s2secs2(in,size,out) sseca(in,size[1],out) +#define s0secs0(in) ssecs(in) + +#define z2secz2(in,size,out) zseca(in,size[1],out) +#define z0secz0(in) zsecs(in) +#define c2secc2(in,size,out) cseca(in,size[1],out) +#define c0secc0(in) csecs(in) + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_SEC__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_secd.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_secd.h new file mode 100644 index 00000000..9304eb04 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_secd.h @@ -0,0 +1,28 @@ + /* 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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_SECD_H__ +#define __INT_SECD_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2secdd2(in,size,out) dsecda(in,size[1],out) +#define d0secdd0(in) dsecds(in) +#define s2secds2(in,size,out) ssecda(in,size[1],out) +#define s0secds0(in) ssecds(in) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_SECD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_sech.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_sech.h new file mode 100644 index 00000000..1cd42218 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_sech.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_SECH_H__ +#define __INT_SECH_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define d2sechd2(in,size,out) dsecha(in,size[1],out) +#define s2sechs2(in,size,out) ssecha(in,size[1],out) +#define d0sechd0(in) dsechs(in) +#define s0sechs0(in) ssechs(in) +#define z0sechz0(in) zsechs(in) +#define z2sechz2(in,size,out) zsechs(in,size[1],out) +#define c0sechc0(in) csechs(in) +#define c2sechc2(in,size,out) csechs(in,size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_SECH_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interpolation/dinterp1s.c b/2.3-1/src/c/elementaryFunctions/interpolation/dinterp1s.c new file mode 100644 index 00000000..17aeb876 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interpolation/dinterp1s.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include "interp1.h" +double dinterp1s(double* x, int size, double* y,int size2, double xin, char* method,int size3) +{ + double x0=x[0]; + double x1=x[size-1]; + double y0=y[0]; + double y1=y[size2-1]; + double a = (y1 - y0) / (x1 - x0); + double b = ((-a)*x0) + y0; + double yout = 0.0; + yout=(double) ((a*xin) + b); + return yout; +} + +/* +int main(void) +{ + double x0=3, y0=0, x1=5, y1=8; + double x=4; + double y = linear_interpolation(x0, y0, x1, y1, x); + printf("(%f, %f), (%f, %f) for %f = %f\n", x0, y0, x1, y1, x, y); + return 0; + +} +*/ diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/base2dec/dbase2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/base2dec/dbase2decs.c new file mode 100644 index 00000000..51c42e02 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/base2dec/dbase2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "base2dec.h" +#include <stdio.h> +#include <math.h> + +double dbase2decs(double in,int base) +{ + int n=0,rem=0, base1=1; + double out=0.0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base1); + n = n / 10 ; + base1 = base1 * base; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/base2dec/gbase2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/base2dec/gbase2decs.c new file mode 100644 index 00000000..9acf2666 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/base2dec/gbase2decs.c @@ -0,0 +1,160 @@ +#include<stdio.h> +#include<math.h> +#include "base2dec.h" +#include <string.h> + +double gbase2decs(char* in,int size,int base) +{ + size-=2; + int i=0,val=0,j=0; + double o=0.0; + for(i=0; in[i]!='\0'; i++) + { + //printf("%c \n",in[i]); + switch(in[i]) + { + case '0': + val = 0; + break; + case '1': + val = 1; + break; + case '2': + val = 2; + break; + case '3': + val = 3; + break; + case '4': + val = 4; + break; + case '5': + val = 5; + break; + case '6': + val = 6; + break; + case '7': + val = 7; + break; + case '8': + val = 8; + break; + case '9': + val = 9; + break; + case 'a': + case 'A': + val = 10; + break; + case 'b': + case 'B': + val = 11; + break; + case 'c': + case 'C': + val = 12; + break; + case 'd': + case 'D': + val = 13; + break; + case 'e': + case 'E': + val = 14; + break; + case 'f': + case 'F': + val = 15; + break; + case 'g': + case 'G': + val = 16; + break; + case 'h': + case 'H': + val = 17; + break; + case 'i': + case 'I': + val = 18; + break; + case 'j': + case 'J': + val = 19; + break; + case 'k': + case 'K': + val = 20; + break; + case 'l': + case 'L': + val = 21; + break; + case 'm': + case 'M': + val = 22; + break; + case 'n': + case 'N': + val = 23; + break; + case 'o': + case 'O': + val = 24; + break; + case 'p': + case 'P': + val = 25; + break; + case 'q': + case 'Q': + val = 26; + break; + case 'r': + case 'R': + val = 27; + break; + case 's': + case 'S': + val = 28; + break; + case 't': + case 'T': + val = 29; + break; + case 'u': + case 'U': + val = 30; + break; + case 'v': + case 'V': + val = 31; + break; + case 'w': + case 'W': + val = 32; + break; + case 'x': + case 'X': + val = 33; + break; + case 'y': + case 'Y': + val = 34; + break; + case 'z': + case 'Z': + val = 35; + break; + } + o = o + (val * pow(base, size)); + //printf("%f\n",out[0]); + //o=(int)out[0]; + //o=o/16; + //printf("%d %d %d\n",o,val,(val * pow(16, size))); + //j++; + size--; + } + return o; + } diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c new file mode 100644 index 00000000..9baf4bda --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c @@ -0,0 +1,10 @@ +#include "bin2dec.h" + +void dbin2deca(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=dbin2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c new file mode 100644 index 00000000..1d3cf3aa --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "bin2dec.h" +#include <stdlib.h> +#include <stdio.h> +long double dbin2decs(long double in) +{ + int base=1, rem=0; + long double out=0.0; + int in1; + in1=(int)in; + while (in1 != 0) + { + rem = in1 % 10; + out = out + (rem * base); + in1 = in1 / 10 ; + base = base * 2; + } + return out; + // printf("Decimal equivalent is: %f \n",out); +} + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c new file mode 100644 index 00000000..1ebc973c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c @@ -0,0 +1,10 @@ +#include "bin2dec.h" + +void i16bin2deca(int16* in,int size,int16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=i16bin2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c new file mode 100644 index 00000000..0f395416 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "bin2dec.h" +#include <stdlib.h> +#include <stdio.h> +int16 i16bin2decs(int16 in) +{ + int base=1, rem=0; + int16 out=0; + int in1; + in1=(int)in; + while (in1 != 0) + { + rem = in1 % 10; + out = out + (rem * base); + in1 = in1 / 10 ; + base = base * 2; + } + return out; + // printf("Decimal equivalent is: %f \n",out); +} + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c new file mode 100644 index 00000000..ad76143e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c @@ -0,0 +1,10 @@ +#include "bin2dec.h" + +void i8bin2deca(int8* in,int size,int8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=i8bin2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c new file mode 100644 index 00000000..1863e51a --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "bin2dec.h" +#include <stdlib.h> +#include <stdio.h> +int8 i8bin2decs(int8 in) +{ + int base=1, rem=0; + int8 out=0; + int in1; + in1=(int)in; + while (in1 != 0) + { + rem = in1 % 10; + out = out + (rem * base); + in1 = in1 / 10 ; + base = base * 2; + } + return out; + // printf("Decimal equivalent is: %f \n",out); +} + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c new file mode 100644 index 00000000..2a4ac15d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c @@ -0,0 +1,10 @@ +#include "bin2dec.h" + +void u16bin2deca(uint16* in,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=u16bin2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c new file mode 100644 index 00000000..0e58b94f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "bin2dec.h" +#include <stdlib.h> +#include <stdio.h> +uint16 u16bin2decs(uint16 in) +{ + int base=1, rem=0; + uint16 out=0; + int in1; + in1=(int)in; + while (in1 != 0) + { + rem = in1 % 10; + out = out + (rem * base); + in1 = in1 / 10 ; + base = base * 2; + } + return out; + // printf("Decimal equivalent is: %f \n",out); +} + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c new file mode 100644 index 00000000..f775664c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c @@ -0,0 +1,10 @@ +#include "bin2dec.h" + +void u8bin2deca(uint8* in,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=u8bin2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c new file mode 100644 index 00000000..41986007 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "bin2dec.h" +#include <stdlib.h> +#include <stdio.h> +uint8 u8bin2decs(uint8 in) +{ + int base=1, rem=0; + uint8 out=0; + int in1; + in1=(int)in; + while (in1 != 0) + { + rem = in1 % 10; + out = out + (rem * base); + in1 = in1 / 10 ; + base = base * 2; + } + return out; + // printf("Decimal equivalent is: %f \n",out); +} + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2basea.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2basea.c new file mode 100644 index 00000000..eeadcb76 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2basea.c @@ -0,0 +1,10 @@ +#include "dec2base.h" + +void ddec2basea(double* in,int size,int base,int n,char* out) +{ + int i=0; + for(i=0;i<size;i++) + { + ddec2bases(in[i],base,n,&(out[i*3])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2bases.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2bases.c new file mode 100644 index 00000000..9dc7c82e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2bases.c @@ -0,0 +1,60 @@ +#include <string.h> +#include <math.h> +#include "dec2base.h" +#include <stdio.h> + +void ddec2bases(double in,int base,int n,char* out) +{ + int quot; + //printf("%d\n",n); + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + //printf("%d",quot); + while(quot!=0) + { + temp=quot%base; + //printf("%d\n",temp); + if(temp < 10) + { temp = temp + 48; + //printf("%d\n",temp); + } + else + { + temp = temp + 55; + //printf("%d\n",temp); + } + out[i++]=temp; + //printf("%c\n",out[i-1]); + quot = quot/base; + } +//printf("%d\n",i); + if(n>i-1) + { + for(j=i;j<=n;j++) + { out[j]='0'; + //printf(" %c %c \n",out[j],out[i]); + } + } + if(n==0) + { + j=i-1; + n=i; + } + else + j=n-1; + + out[n]='\0'; + //for(k=0;k<=n;k++) + //printf("%c\n",out[k]); + i=0; + while(i<j) + { + tmp=out[i]; + //printf("%c\n",out[i]); + out[i]=out[j]; + out[j]=tmp; + //printf("%c\n",out[j]); + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2basea.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2basea.c new file mode 100644 index 00000000..51e12388 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2basea.c @@ -0,0 +1,10 @@ +#include "dec2base.h" + +void sdec2basea(float* in,int size,int base,int n,char* out) +{ + int i=0; + for(i=0;i<size;i++) + { + sdec2bases(in[i],base,n,&(out[i*3])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2bases.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2bases.c new file mode 100644 index 00000000..9abe2168 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2bases.c @@ -0,0 +1,34 @@ +#include <string.h> +#include <math.h> +#include "dec2base.h" +#include <stdio.h> + +void sdec2bases(float in,int base,int n,char* out) +{ + int quot; + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + while(quot!=0) + { + temp=quot%base; + if(temp < 10) + temp = temp + 48; + else + temp = temp + 55; + out[i++]=temp; + quot = quot/base; + } + out[i]='\0'; + j=i-1; + i=0; + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } + + +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bina.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bina.c new file mode 100644 index 00000000..e0648758 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bina.c @@ -0,0 +1,10 @@ +#include "dec2bin.h" + +void ddec2bina(double* in,int size,int n,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + ddec2bins(in[i],n,&(out[i*15])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bins.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bins.c new file mode 100644 index 00000000..c97fc428 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bins.c @@ -0,0 +1,39 @@ +#include <string.h> +#include "dec2bin.h" +#include <stdio.h> +void ddec2bins(double in,int n,double* out) +{ + int quotient,i=0,j=0,tmp=0; + quotient=(int)in; + for(i=0;i<n;i++) + { + out[i]=0.0; + } + i=0; + while(quotient!=0) + { + out[i++]= quotient%2; + quotient=quotient/2; + } + if(n>i-1) + { + for(j=i;j<=n;j++) + out[j]=0.0; + } + if(n==0) + j=i-1; + else + j=n-1; + + i=0; + + while(i<j) + { + tmp=out[i]; + //printf("%f",tmp); + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bina.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bina.c new file mode 100644 index 00000000..1fa251c7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bina.c @@ -0,0 +1,10 @@ +#include "dec2bin.h" + +void i16dec2bina(int16* in,int size,int n,int16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + i16dec2bins(in[i],n,&(out[i*15])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c new file mode 100644 index 00000000..0b06aef1 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c @@ -0,0 +1,32 @@ +#include <string.h> +#include "dec2bin.h" +#include <stdio.h> +void i16dec2bins(int16 in,int n,int16* out) +{ + int quotient,i=0,j=0,tmp=0; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%2; + quotient=quotient/2; + } + if(n>i-1) + { + for(j=i;j<=n;j++) + out[j]=0.0; + } + if(n==0) + j=i-1; + else + j=n-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bina.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bina.c new file mode 100644 index 00000000..2297ae9d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bina.c @@ -0,0 +1,10 @@ +#include "dec2bin.h" + +void i8dec2bina(int8* in,int size,int n,int8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + i8dec2bins(in[i],n,&(out[i*15])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bins.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bins.c new file mode 100644 index 00000000..4f4024c9 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bins.c @@ -0,0 +1,32 @@ +#include <string.h> +#include "dec2bin.h" +#include <stdio.h> +void i8dec2bins(int8 in,int n,int8* out) +{ + int quotient,i=0,j=0,tmp=0; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%2; + quotient=quotient/2; + } + if(n>i-1) + { + for(j=i;j<=n;j++) + out[j]=0.0; + } + if(n==0) + j=i-1; + else + j=n-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bina.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bina.c new file mode 100644 index 00000000..153ce863 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bina.c @@ -0,0 +1,10 @@ +#include "dec2bin.h" + +void u16dec2bina(uint16* in,int size,int n,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + u16dec2bins(in[i],n,&(out[i*15])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bins.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bins.c new file mode 100644 index 00000000..1ade60f4 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bins.c @@ -0,0 +1,32 @@ +#include <string.h> +#include "dec2bin.h" +#include <stdio.h> +void u16dec2bins(uint16 in,int n,uint16* out) +{ + int quotient,i=0,j=0,tmp=0; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%2; + quotient=quotient/2; + } + if(n>i-1) + { + for(j=i;j<=n;j++) + out[j]=0.0; + } + if(n==0) + j=i-1; + else + j=n-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bina.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bina.c new file mode 100644 index 00000000..87fc9187 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bina.c @@ -0,0 +1,10 @@ +#include "dec2bin.h" + +void u8dec2bina(uint8* in,int size,int n,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + u8dec2bins(in[i],n,&(out[i*15])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bins.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bins.c new file mode 100644 index 00000000..971f6c22 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bins.c @@ -0,0 +1,32 @@ +#include <string.h> +#include "dec2bin.h" +#include <stdio.h> +void u8dec2bins(uint8 in,int n,uint8* out) +{ + int quotient,i=0,j=0,tmp=0; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%2; + quotient=quotient/2; + } + if(n>i-1) + { + for(j=i;j<=n;j++) + out[j]=0.0; + } + if(n==0) + j=i-1; + else + j=n-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexa.c new file mode 100644 index 00000000..c3187d24 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexa.c @@ -0,0 +1,10 @@ +#include "dec2hex.h" + +void ddec2hexa(double* in,int size,char* out) +{ + int i=0; + for(i=0;i<size;i++) + { + ddec2hexs(in[i],&(out[i*3])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexs.c new file mode 100644 index 00000000..0adafef7 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexs.c @@ -0,0 +1,39 @@ +#include <string.h> +#include <math.h> +#include "dec2hex.h" +#include <stdio.h> + +void ddec2hexs(double in,char* out) +{ + int quot; + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + while(quot!=0) + { + temp=quot%16; + //To convert integer into character + if(temp < 10) + temp = temp + 48; + else + temp = temp + 55; + + out[i++]=temp; + quot = quot/16; + //printf("%c ",out[i-1]); + } + out[i]='\0'; + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } + //out[i+1]=' '; + + +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexa.c new file mode 100644 index 00000000..f66df8b3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexa.c @@ -0,0 +1,10 @@ +#include "dec2hex.h" + +void i16dec2hexa(int16* in,int size,char* out) +{ + int i=0; + for(i=0;i<size;i++) + { + i16dec2hexs(in[i],&(out[i*3])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexs.c new file mode 100644 index 00000000..f556141d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexs.c @@ -0,0 +1,38 @@ +#include <string.h> +#include <math.h> +#include "dec2hex.h" +#include <stdio.h> + +void i16dec2hexs(int16 in,char* out) +{ + int quot; + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + while(quot!=0) + { + temp=quot%16; + //To convert integer into character + if(temp < 10) + temp = temp + 48; + else + temp = temp + 55; + + out[i++]=temp; + quot = quot/16; + //printf("%c ",out[i-1]); + } + out[i]='\0'; + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } + out[i+1]=' '; + +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexa.c new file mode 100644 index 00000000..a6c9d94d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexa.c @@ -0,0 +1,10 @@ +#include "dec2hex.h" + +void i8dec2hexa(int8* in,int size,char* out) +{ + int i=0; + for(i=0;i<size;i++) + { + i8dec2hexs(in[i],&(out[i*3])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexs.c new file mode 100644 index 00000000..a5a67722 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexs.c @@ -0,0 +1,39 @@ +#include <string.h> +#include <math.h> +#include "dec2hex.h" +#include <stdio.h> + +void i8dec2hexs(int8 in,char* out) +{ + int quot; + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + while(quot!=0) + { + temp=quot%16; + //To convert integer into character + if(temp < 10) + temp = temp + 48; + else + temp = temp + 55; + + out[i++]=temp; + quot = quot/16; + //printf("%c ",out[i-1]); + } + out[i]='\0'; + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } + out[i+1]=' '; + + +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexa.c new file mode 100644 index 00000000..52e1ae80 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexa.c @@ -0,0 +1,10 @@ +#include "dec2hex.h" + +void u16dec2hexa(uint16* in,int size,char* out) +{ + int i=0; + for(i=0;i<size;i++) + { + u16dec2hexs(in[i],&(out[i*3])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c new file mode 100644 index 00000000..1e942e63 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c @@ -0,0 +1,38 @@ +#include <string.h> +#include <math.h> +#include "dec2hex.h" +#include <stdio.h> + +void u16dec2hexs(uint16 in,char* out) +{ + int quot; + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + while(quot!=0) + { + temp=quot%16; + //To convert integer into character + if(temp < 10) + temp = temp + 48; + else + temp = temp + 55; + + out[i++]=temp; + quot = quot/16; + //printf("%c ",out[i-1]); + } + out[i]='\0'; + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } + out[i+1]=' '; + +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexa.c new file mode 100644 index 00000000..0ac48a07 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexa.c @@ -0,0 +1,10 @@ +#include "dec2hex.h" + +void u8dec2hexa(uint8* in,int size,char* out) +{ + int i=0; + for(i=0;i<size;i++) + { + u8dec2hexs(in[i],&(out[i*3])); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexs.c new file mode 100644 index 00000000..154c23f8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexs.c @@ -0,0 +1,38 @@ +#include <string.h> +#include <math.h> +#include "dec2hex.h" +#include <stdio.h> + +void u8dec2hexs(uint8 in,char* out) +{ + int quot; + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + while(quot!=0) + { + temp=quot%16; + //To convert integer into character + if(temp < 10) + temp = temp + 48; + else + temp = temp + 55; + + out[i++]=temp; + quot = quot/16; + //printf("%c ",out[i-1]); + } + out[i]='\0'; + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } + out[i+1]=' '; + +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c new file mode 100644 index 00000000..03fc2dc3 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void ddec2octa(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { ddec2octs(in[i],&(out[i*15])); +} +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c new file mode 100644 index 00000000..d06da303 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void ddec2octs(double in,double* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c new file mode 100644 index 00000000..882b00ba --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c @@ -0,0 +1,10 @@ +#include "dec2oct.h" + +void i16dec2octa(int16* in,int size,int16* out) +{ + int i=0; + for(i=0;i<size;i++) + { +i16dec2octs(in[i],&(out[i*15])); +} +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c new file mode 100644 index 00000000..cb08845a --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void i16dec2octs(int16 in,int16* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c new file mode 100644 index 00000000..221f486b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void i8dec2octa(int8* in,int size,int8* out) +{ + int i=0; + for(i=0;i<size;i++) + { i8dec2octs(in[i],&(out[i*15])); +} +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c new file mode 100644 index 00000000..30ae5b02 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void i8dec2octs(int8 in,int8* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c new file mode 100644 index 00000000..cc0d5434 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void u16dec2octa(uint16* in,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { u16dec2octs(in[i],&(out[i*15])); +} +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c new file mode 100644 index 00000000..4b0bd592 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void u16dec2octs(uint16 in,uint16* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c new file mode 100644 index 00000000..c187077c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void u8dec2octa(uint8* in,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { u8dec2octs(in[i],&(out[i*15])); +} +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c new file mode 100644 index 00000000..9348630f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void u8dec2octs(uint8 in,uint8* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/hex2dec/dhex2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/hex2dec/dhex2decs.c new file mode 100644 index 00000000..cfe05945 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/hex2dec/dhex2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "hex2dec.h" +#include <stdio.h> +#include <math.h> + +double dhex2decs(double in) +{ + int n=0,rem=0, base=1; + double out=0.0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 16; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/hex2dec/ghex2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/hex2dec/ghex2decs.c new file mode 100644 index 00000000..c5b68dbc --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/hex2dec/ghex2decs.c @@ -0,0 +1,81 @@ +#include <string.h> +#include "hex2dec.h" +#include <stdio.h> +#include <math.h> + +double ghex2decs(char* in,int size) +{ + size-=2; + int i=0,val=0,j=0; + double o=0.0; + for(i=0; in[i]!='\0'; i++) + { +/* Finds the decimal equivalent of each hexadecimal digit +*/ + switch(in[i]) + { + case '0': + val = 0; + break; + case '1': + val = 1; + break; + case '2': + val = 2; + break; + case '3': + val = 3; + break; + case '4': + val = 4; + break; + case '5': + val = 5; + break; + case '6': + val = 6; + break; + case '7': + val = 7; + break; + case '8': + val = 8; + break; + case '9': + val = 9; + break; + case 'a': + case 'A': + val = 10; + break; + case 'b': + case 'B': + val = 11; + break; + case 'c': + case 'C': + val = 12; + break; + case 'd': + case 'D': + val = 13; + break; + case 'e': + case 'E': + val = 14; + break; + case 'f': + case 'F': + val = 15; + break; + } + o = o + (val * pow(16, size)); + //printf("%f\n",out[0]); + //o=(int)out[0]; + //o=o/16; + //printf("%d %d %d\n",o,val,(val * pow(16, size))); + //j++; + size--; + } + return o; + } diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c new file mode 100644 index 00000000..6bb5d00f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void doct2deca(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=doct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c new file mode 100644 index 00000000..8f9f0b65 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +double doct2decs(double in) +{ + int n=0,rem=0, base=1; + double out=0.0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c new file mode 100644 index 00000000..1ab843f8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void i16oct2deca(int16* in,int size,int16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=i16oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c new file mode 100644 index 00000000..ea092852 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +int16 i16oct2decs(int16 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + int16 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c new file mode 100644 index 00000000..133806ce --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void i8oct2deca(int8* in,int size,int8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=i8oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c new file mode 100644 index 00000000..1886739a --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +int8 i8oct2decs(int8 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + int8 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c new file mode 100644 index 00000000..cec3a219 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void u16oct2deca(uint16* in,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=u16oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c new file mode 100644 index 00000000..43dd0ac0 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +uint16 u16oct2decs(uint16 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + uint16 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c new file mode 100644 index 00000000..3b356587 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void u8oct2deca(uint8* in,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=u8oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c new file mode 100644 index 00000000..c854bc25 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +uint8 u8oct2decs(uint8 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + uint8 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/special_functions/gamma/dgammas.c b/2.3-1/src/c/elementaryFunctions/special_functions/gamma/dgammas.c new file mode 100644 index 00000000..c466f434 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/special_functions/gamma/dgammas.c @@ -0,0 +1,52 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <gsl/gsl_sf_gamma.h> +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* very simple approximation */ +double st_gamma(double x) +{ + return sqrt(2.0*M_PI/x)*pow(x/M_E, x); +} + +#define A 12 +double sp_gamma(double z) +{ + const int a = A; + static double c_space[A]; + static double *c = NULL; + int k; + double accm; + + if ( c == NULL ) { + double k1_factrl = 1.0; /* (k - 1)!*(-1)^k with 0!==1*/ + c = c_space; + c[0] = sqrt(2.0*M_PI); + for(k=1; k < a; k++) { + c[k] = exp(a-k) * pow(a-k, k-0.5) / k1_factrl; + k1_factrl *= -k; + } + } + accm = c[0]; + for(k=1; k < a; k++) { + accm += c[k] / ( z + k ); + } + accm *= exp(-(z+a)) * pow(z+a, z+0.5); /* Gamma(z+1) */ + return accm/z; +} + +int main() +{ + double x; + + + printf("%15s%15s%15s%15s\n", "Stirling", "Spouge", "GSL", "libm"); + for(x=1.0; x <= 10.0; x+=1.0) { + printf("%15.8lf%15.8lf%15.8lf%15.8lf\n", st_gamma(x/3.0), sp_gamma(x/3.0), + gsl_sf_gamma(x/3.0), tgamma(x/3.0)); + } + return 0; +} diff --git a/2.3-1/src/c/elementaryFunctions/tanh/ctanhs.c b/2.3-1/src/c/elementaryFunctions/tanh/ctanhs.c index 5111dbd7..24c1fa68 100644 --- a/2.3-1/src/c/elementaryFunctions/tanh/ctanhs.c +++ b/2.3-1/src/c/elementaryFunctions/tanh/ctanhs.c @@ -13,7 +13,7 @@ #include "tanh.h" #include "tan.h" -floatComplex ctanhs(floatComplex z) { +floatComplex ctanhs(floatComplex z) { float real = creals(z); float imag = cimags(z); |