summaryrefslogtreecommitdiff
path: root/src/c/specialFunctions
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-09-29 22:00:40 +0530
committerAbhinav Dronamraju2017-09-29 22:00:40 +0530
commit9bc7ad78e8d7d7acc4b9387aa592542832e80b31 (patch)
tree7fce060665a91de5e5adb12d02003351c3d1fdfc /src/c/specialFunctions
parent33755eb085a3ca8154cf83773b23fbb8aac4ba3e (diff)
parentac0045f12ad3d0938758e9742f4107a334e1afaa (diff)
downloadscilab2c-9bc7ad78e8d7d7acc4b9387aa592542832e80b31.tar.gz
scilab2c-9bc7ad78e8d7d7acc4b9387aa592542832e80b31.tar.bz2
scilab2c-9bc7ad78e8d7d7acc4b9387aa592542832e80b31.zip
NEW FEATURES AND NEW FUNCTIONS
Diffstat (limited to 'src/c/specialFunctions')
-rw-r--r--src/c/specialFunctions/besseli/dbesselia.c111
-rw-r--r--src/c/specialFunctions/besseli/sbesselia.c111
-rw-r--r--src/c/specialFunctions/besselj/dbesselja.c143
-rw-r--r--src/c/specialFunctions/besselj/sbesselja.c142
-rw-r--r--src/c/specialFunctions/besselk/dbesselka.c141
-rw-r--r--src/c/specialFunctions/besselk/sbesselka.c141
-rw-r--r--src/c/specialFunctions/bessely/dbesselya.c167
-rw-r--r--src/c/specialFunctions/bessely/sbesselya.c168
-rw-r--r--src/c/specialFunctions/beta/dbetaa.c22
-rw-r--r--src/c/specialFunctions/beta/dbetas.c21
-rw-r--r--src/c/specialFunctions/beta/sbetaa.c22
-rw-r--r--src/c/specialFunctions/beta/sbetas.c21
-rw-r--r--src/c/specialFunctions/calerf/dcalerfa.c29
-rw-r--r--src/c/specialFunctions/calerf/dcalerfs.c29
-rw-r--r--src/c/specialFunctions/calerf/scalerfa.c29
-rw-r--r--src/c/specialFunctions/calerf/scalerfs.c29
-rw-r--r--src/c/specialFunctions/erf/derfa.c25
-rw-r--r--src/c/specialFunctions/erf/derfs.c22
-rw-r--r--src/c/specialFunctions/erf/serfa.c25
-rw-r--r--src/c/specialFunctions/erf/serfs.c22
-rw-r--r--src/c/specialFunctions/erfc/derfca.c25
-rw-r--r--src/c/specialFunctions/erfc/derfcs.c22
-rw-r--r--src/c/specialFunctions/erfc/serfca.c25
-rw-r--r--src/c/specialFunctions/erfc/serfcs.c22
-rw-r--r--src/c/specialFunctions/erfcx/derfcxa.c26
-rw-r--r--src/c/specialFunctions/erfcx/derfcxs.c23
-rw-r--r--src/c/specialFunctions/erfcx/serfcxa.c26
-rw-r--r--src/c/specialFunctions/erfcx/serfcxs.c23
-rw-r--r--src/c/specialFunctions/erfinv/derfinva.c25
-rw-r--r--src/c/specialFunctions/erfinv/derfinvs.c49
-rw-r--r--src/c/specialFunctions/erfinv/serfinva.c25
-rw-r--r--src/c/specialFunctions/erfinv/serfinvs.c50
-rw-r--r--src/c/specialFunctions/gamma/dgammaa.c21
-rw-r--r--src/c/specialFunctions/gamma/dgammas.c20
-rw-r--r--src/c/specialFunctions/gamma/sgammaa.c21
-rw-r--r--src/c/specialFunctions/gamma/sgammas.c20
-rw-r--r--src/c/specialFunctions/gammaln/dgammalna.c21
-rw-r--r--src/c/specialFunctions/gammaln/dgammalns.c20
-rw-r--r--src/c/specialFunctions/gammaln/sgammalna.c21
-rw-r--r--src/c/specialFunctions/gammaln/sgammalns.c20
-rw-r--r--src/c/specialFunctions/includes/besseli.h34
-rw-r--r--src/c/specialFunctions/includes/besselj.h34
-rw-r--r--src/c/specialFunctions/includes/besselk.h34
-rw-r--r--src/c/specialFunctions/includes/bessely.h35
-rw-r--r--src/c/specialFunctions/includes/beta.h36
-rw-r--r--src/c/specialFunctions/includes/calerf.h41
-rw-r--r--src/c/specialFunctions/includes/erf.h34
-rw-r--r--src/c/specialFunctions/includes/erfc.h36
-rw-r--r--src/c/specialFunctions/includes/erfcx.h37
-rw-r--r--src/c/specialFunctions/includes/erfinv.h35
-rw-r--r--src/c/specialFunctions/includes/gamma.h35
-rw-r--r--src/c/specialFunctions/includes/gammaln.h36
-rw-r--r--src/c/specialFunctions/interfaces/int_besseli.h28
-rw-r--r--src/c/specialFunctions/interfaces/int_besselj.h28
-rw-r--r--src/c/specialFunctions/interfaces/int_besselk.h28
-rw-r--r--src/c/specialFunctions/interfaces/int_bessely.h28
-rw-r--r--src/c/specialFunctions/interfaces/int_beta.h30
-rw-r--r--src/c/specialFunctions/interfaces/int_calerf.h32
-rw-r--r--src/c/specialFunctions/interfaces/int_erf.h32
-rw-r--r--src/c/specialFunctions/interfaces/int_erfc.h32
-rw-r--r--src/c/specialFunctions/interfaces/int_erfcx.h32
-rw-r--r--src/c/specialFunctions/interfaces/int_erfinv.h30
-rw-r--r--src/c/specialFunctions/interfaces/int_gamma.h31
-rw-r--r--src/c/specialFunctions/interfaces/int_gammaln.h31
64 files changed, 2714 insertions, 0 deletions
diff --git a/src/c/specialFunctions/besseli/dbesselia.c b/src/c/specialFunctions/besseli/dbesselia.c
new file mode 100644
index 00000000..14ac1ed3
--- /dev/null
+++ b/src/c/specialFunctions/besseli/dbesselia.c
@@ -0,0 +1,111 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "besseli.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+
+double onebessi( double inp1, double inp2)
+{
+ int j;
+ double bi,bim,bip,tox,result,s,res,t;
+
+
+ if (inp1 < 0)
+ {
+ double dblank;
+ return( dblank );
+ }
+ if (inp1 == 0)
+ {
+ if ((s=fabs(inp2)) < 3.75)
+ {
+ t=inp2/3.75,t=t*t;
+ res=1.0+t*(3.5156229+t*(3.0899424+t*(1.2067492+t*(0.2659732+t*(0.360768e-1+t*0.45813e-2)))));
+ }
+ else
+ {
+ t=3.75/s;
+ res=(exp(s)/sqrt(s))*(0.39894228+t*(0.1328592e-1+t*(0.225319e-2+t*(-0.157565e-2+t*(0.916281e-2+t*(-0.2057706e-1+t*(0.2635537e-1+t*(-0.1647633e-1+t*0.392377e-2))))))));
+ }
+ return res;
+ }
+ if (inp1 == 1)
+ {
+ if ((s=fabs(inp2)) < 3.75)
+ {
+ t=inp2/3.75,t=t*t;
+ res=s*(0.5+t*(0.87890594+t*(0.51498869+t*(0.15084934+t*(0.2658733e-1+t*(0.301532e-2+t*0.32411e-3))))));
+ }
+ else
+ {
+ t=3.75/s;
+ res=0.2282967e-1+t*(-0.2895312e-1+t*(0.1787654e-1-t*0.420059e-2));
+ res=0.39894228+t*(-0.3988024e-1+t*(-0.362018e-2+t*(0.163801e-2+t*(-0.1031555e-1+t*res))));
+ res *= (exp(s)/sqrt(s));
+ }
+ return inp2 < 0.0 ? -res : res;
+ }
+
+
+ if (inp2 == 0.0)
+ return 0.0;
+ else
+ {
+ tox=2.0/fabs(inp2);
+ bip=result=0.0;
+ bi=1.0;
+ for (j=2*(inp1+(int) sqrt(ACC*inp1));j>0;j--)
+ {
+ bim=bip+j*tox*bi;
+ bip=bi;
+ bi=bim;
+ if (fabs(bi) > BIGNO)
+ {
+ result *= BIGNI;
+ bi *= BIGNI;
+ bip *= BIGNI;
+ }
+ if (j == inp1) result=bip;
+ }
+
+ if ((s=fabs(inp2)) < 3.75)
+ {
+ t=inp2/3.75,t=t*t;
+ res=1.0+t*(3.5156229+t*(3.0899424+t*(1.2067492+t*(0.2659732+t*(0.360768e-1+t*0.45813e-2)))));
+ }
+ else
+ {
+ t=3.75/s;
+ res=(exp(s)/sqrt(s))*(0.39894228+t*(0.1328592e-1+t*(0.225319e-2+t*(-0.157565e-2+t*(0.916281e-2+t*(-0.2057706e-1+t*(0.2635537e-1+t*(-0.1647633e-1+t*0.392377e-2))))))));
+ }
+
+ result *= res/bi;
+ return inp2 < 0.0 && (int)inp1%2 == 1 ? -result : result;
+ }
+}
+
+void dbesselia(double* inp1,int size1, double* inp2,int size2, double* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = onebessi(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/besseli/sbesselia.c b/src/c/specialFunctions/besseli/sbesselia.c
new file mode 100644
index 00000000..6e185e0b
--- /dev/null
+++ b/src/c/specialFunctions/besseli/sbesselia.c
@@ -0,0 +1,111 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "besseli.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+
+float fonebessi( float inp1, float inp2)
+{
+ int j;
+ float bi,bim,bip,tox,result,s,res,t;
+
+
+ if (inp1 < 0)
+ {
+ float dblank;
+ return( dblank );
+ }
+ if (inp1 == 0)
+ {
+ if ((s=fabs(inp2)) < 3.75)
+ {
+ t=inp2/3.75,t=t*t;
+ res=1.0+t*(3.5156229+t*(3.0899424+t*(1.2067492+t*(0.2659732+t*(0.360768e-1+t*0.45813e-2)))));
+ }
+ else
+ {
+ t=3.75/s;
+ res=(exp(s)/sqrt(s))*(0.39894228+t*(0.1328592e-1+t*(0.225319e-2+t*(-0.157565e-2+t*(0.916281e-2+t*(-0.2057706e-1+t*(0.2635537e-1+t*(-0.1647633e-1+t*0.392377e-2))))))));
+ }
+ return res;
+ }
+ if (inp1 == 1)
+ {
+ if ((s=fabs(inp2)) < 3.75)
+ {
+ t=inp2/3.75,t=t*t;
+ res=s*(0.5+t*(0.87890594+t*(0.51498869+t*(0.15084934+t*(0.2658733e-1+t*(0.301532e-2+t*0.32411e-3))))));
+ }
+ else
+ {
+ t=3.75/s;
+ res=0.2282967e-1+t*(-0.2895312e-1+t*(0.1787654e-1-t*0.420059e-2));
+ res=0.39894228+t*(-0.3988024e-1+t*(-0.362018e-2+t*(0.163801e-2+t*(-0.1031555e-1+t*res))));
+ res *= (exp(s)/sqrt(s));
+ }
+ return inp2 < 0.0 ? -res : res;
+ }
+
+
+ if (inp2 == 0.0)
+ return 0.0;
+ else
+ {
+ tox=2.0/fabs(inp2);
+ bip=result=0.0;
+ bi=1.0;
+ for (j=2*(inp1+(int) sqrt(ACC*inp1));j>0;j--)
+ {
+ bim=bip+j*tox*bi;
+ bip=bi;
+ bi=bim;
+ if (fabs(bi) > BIGNO)
+ {
+ result *= BIGNI;
+ bi *= BIGNI;
+ bip *= BIGNI;
+ }
+ if (j == inp1) result=bip;
+ }
+
+ if ((s=fabs(inp2)) < 3.75)
+ {
+ t=inp2/3.75,t=t*t;
+ res=1.0+t*(3.5156229+t*(3.0899424+t*(1.2067492+t*(0.2659732+t*(0.360768e-1+t*0.45813e-2)))));
+ }
+ else
+ {
+ t=3.75/s;
+ res=(exp(s)/sqrt(s))*(0.39894228+t*(0.1328592e-1+t*(0.225319e-2+t*(-0.157565e-2+t*(0.916281e-2+t*(-0.2057706e-1+t*(0.2635537e-1+t*(-0.1647633e-1+t*0.392377e-2))))))));
+ }
+
+ result *= res/bi;
+ return inp2 < 0.0 && (int)inp1%2 == 1 ? -result : result;
+ }
+}
+
+void sbesselia(float* inp1,int size1, float* inp2,int size2, float* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = fonebessi(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/besselj/dbesselja.c b/src/c/specialFunctions/besselj/dbesselja.c
new file mode 100644
index 00000000..23a355f5
--- /dev/null
+++ b/src/c/specialFunctions/besselj/dbesselja.c
@@ -0,0 +1,143 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "besselj.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+
+static double bessj0( double x )
+{
+ double ax,z;
+ double xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=57568490574.0+y*(-13362590354.0+y*(651619640.7
+ +y*(-11214424.18+y*(77392.33017+y*(-184.9052456)))));
+ ans2=57568490411.0+y*(1029532985.0+y*(9494680.718
+ +y*(59272.64853+y*(267.8532712+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-0.785398164;
+ ans1=1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4
+ +y*(-0.2073370639e-5+y*0.2093887211e-6)));
+ ans2 = -0.1562499995e-1+y*(0.1430488765e-3
+ +y*(-0.6911147651e-5+y*(0.7621095161e-6
+ -y*0.934935152e-7)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ }
+ return ans;
+}
+
+
+static double bessj1( double x )
+{
+ double ax,z;
+ double xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=x*(72362614232.0+y*(-7895059235.0+y*(242396853.1
+ +y*(-2972611.439+y*(15704.48260+y*(-30.16036606))))));
+ ans2=144725228442.0+y*(2300535178.0+y*(18583304.74
+ +y*(99447.43394+y*(376.9991397+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-2.356194491;
+ ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
+ +y*(0.2457520174e-5+y*(-0.240337019e-6))));
+ ans2=0.04687499995+y*(-0.2002690873e-3
+ +y*(0.8449199096e-5+y*(-0.88228987e-6
+ +y*0.105787412e-6)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ if (x < 0.0) ans = -ans;
+ }
+ return ans;
+}
+
+
+double bessj( int n, double x )
+{
+ int j, jsum, m;
+ double ax, bj, bjm, bjp, sum, tox, ans;
+
+
+ if (n < 0)
+ {
+ double dblank;
+ //setdblack_c( &dblank );
+ return( dblank );
+ }
+ ax=fabs(x);
+ if (n == 0)
+ return( bessj0(ax) );
+ if (n == 1)
+ return( bessj1(ax) );
+
+
+ if (ax == 0.0)
+ return 0.0;
+ else if (ax > (double) n) {
+ tox=2.0/ax;
+ bjm=bessj0(ax);
+ bj=bessj1(ax);
+ for (j=1;j<n;j++) {
+ bjp=j*tox*bj-bjm;
+ bjm=bj;
+ bj=bjp;
+ }
+ ans=bj;
+ } else {
+ tox=2.0/ax;
+ m=2*((n+(int) sqrt(ACC*n))/2);
+ jsum=0;
+ bjp=ans=sum=0.0;
+ bj=1.0;
+ for (j=m;j>0;j--) {
+ bjm=j*tox*bj-bjp;
+ bjp=bj;
+ bj=bjm;
+ if (fabs(bj) > BIGNO) {
+ bj *= BIGNI;
+ bjp *= BIGNI;
+ ans *= BIGNI;
+ sum *= BIGNI;
+ }
+ if (jsum) sum += bj;
+ jsum=!jsum;
+ if (j == n) ans=bjp;
+ }
+ sum=2.0*sum-bj;
+ ans /= sum;
+ }
+ return x < 0.0 && n%2 == 1 ? -ans : ans;
+}
+
+void dbesselja(double* inp1,int size1, double* inp2,int size2, double* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = bessj(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/besselj/sbesselja.c b/src/c/specialFunctions/besselj/sbesselja.c
new file mode 100644
index 00000000..68d2ea4f
--- /dev/null
+++ b/src/c/specialFunctions/besselj/sbesselja.c
@@ -0,0 +1,142 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "besselj.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+
+static float fbessj0( float x )
+{
+ float ax,z;
+ float xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=57568490574.0+y*(-13362590354.0+y*(651619640.7
+ +y*(-11214424.18+y*(77392.33017+y*(-184.9052456)))));
+ ans2=57568490411.0+y*(1029532985.0+y*(9494680.718
+ +y*(59272.64853+y*(267.8532712+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-0.785398164;
+ ans1=1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4
+ +y*(-0.2073370639e-5+y*0.2093887211e-6)));
+ ans2 = -0.1562499995e-1+y*(0.1430488765e-3
+ +y*(-0.6911147651e-5+y*(0.7621095161e-6
+ -y*0.934935152e-7)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ }
+ return ans;
+}
+
+
+static float fbessj1( float x )
+{
+ float ax,z;
+ float xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=x*(72362614232.0+y*(-7895059235.0+y*(242396853.1
+ +y*(-2972611.439+y*(15704.48260+y*(-30.16036606))))));
+ ans2=144725228442.0+y*(2300535178.0+y*(18583304.74
+ +y*(99447.43394+y*(376.9991397+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-2.356194491;
+ ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
+ +y*(0.2457520174e-5+y*(-0.240337019e-6))));
+ ans2=0.04687499995+y*(-0.2002690873e-3
+ +y*(0.8449199096e-5+y*(-0.88228987e-6
+ +y*0.105787412e-6)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ if (x < 0.0) ans = -ans;
+ }
+ return ans;
+}
+
+
+float fbessj( int n, float x )
+{
+ int j, jsum, m;
+ float ax, bj, bjm, bjp, sum, tox, ans;
+
+
+ if (n < 0)
+ {
+ float dblank;
+ return( dblank );
+ }
+ ax=fabs(x);
+ if (n == 0)
+ return( fbessj0(ax) );
+ if (n == 1)
+ return( fbessj1(ax) );
+
+
+ if (ax == 0.0)
+ return 0.0;
+ else if (ax > (float) n) {
+ tox=2.0/ax;
+ bjm=fbessj0(ax);
+ bj=fbessj1(ax);
+ for (j=1;j<n;j++) {
+ bjp=j*tox*bj-bjm;
+ bjm=bj;
+ bj=bjp;
+ }
+ ans=bj;
+ } else {
+ tox=2.0/ax;
+ m=2*((n+(int) sqrt(ACC*n))/2);
+ jsum=0;
+ bjp=ans=sum=0.0;
+ bj=1.0;
+ for (j=m;j>0;j--) {
+ bjm=j*tox*bj-bjp;
+ bjp=bj;
+ bj=bjm;
+ if (fabs(bj) > BIGNO) {
+ bj *= BIGNI;
+ bjp *= BIGNI;
+ ans *= BIGNI;
+ sum *= BIGNI;
+ }
+ if (jsum) sum += bj;
+ jsum=!jsum;
+ if (j == n) ans=bjp;
+ }
+ sum=2.0*sum-bj;
+ ans /= sum;
+ }
+ return x < 0.0 && n%2 == 1 ? -ans : ans;
+}
+
+void sbesselja(float* inp1,int size1, float* inp2,int size2, float* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = fbessj(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/besselk/dbesselka.c b/src/c/specialFunctions/besselk/dbesselka.c
new file mode 100644
index 00000000..df6c0708
--- /dev/null
+++ b/src/c/specialFunctions/besselk/dbesselka.c
@@ -0,0 +1,141 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "besselk.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+static double bessi0( double x )
+{
+ double ax,ans;
+ double y;
+
+
+ if ((ax=fabs(x)) < 3.75) {
+ y=x/3.75,y=y*y;
+ ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492
+ +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));
+ } else {
+ y=3.75/ax;
+ ans=(exp(ax)/sqrt(ax))*(0.39894228+y*(0.1328592e-1
+ +y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2
+ +y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1
+ +y*0.392377e-2))))))));
+ }
+ return ans;
+}
+
+
+
+
+static double bessi1( double x)
+{
+ double ax,ans;
+ double y;
+
+
+ if ((ax=fabs(x)) < 3.75) {
+ y=x/3.75,y=y*y;
+ ans=ax*(0.5+y*(0.87890594+y*(0.51498869+y*(0.15084934
+ +y*(0.2658733e-1+y*(0.301532e-2+y*0.32411e-3))))));
+ } else {
+ y=3.75/ax;
+ ans=0.2282967e-1+y*(-0.2895312e-1+y*(0.1787654e-1
+ -y*0.420059e-2));
+ ans=0.39894228+y*(-0.3988024e-1+y*(-0.362018e-2
+ +y*(0.163801e-2+y*(-0.1031555e-1+y*ans))));
+ ans *= (exp(ax)/sqrt(ax));
+ }
+ return x < 0.0 ? -ans : ans;
+}
+
+
+static double bessk0( double x )
+{
+ double y,ans;
+
+ if (x <= 2.0) {
+ y=x*x/4.0;
+ ans=(-log(x/2.0)*bessi0(x))+(-0.57721566+y*(0.42278420
+ +y*(0.23069756+y*(0.3488590e-1+y*(0.262698e-2
+ +y*(0.10750e-3+y*0.74e-5))))));
+ } else {
+ y=2.0/x;
+ ans=(exp(-x)/sqrt(x))*(1.25331414+y*(-0.7832358e-1
+ +y*(0.2189568e-1+y*(-0.1062446e-1+y*(0.587872e-2
+ +y*(-0.251540e-2+y*0.53208e-3))))));
+ }
+ return ans;
+}
+
+
+
+
+static double bessk1( double x )
+{
+ double y,ans;
+
+ if (x <= 2.0) {
+ y=x*x/4.0;
+ ans=(log(x/2.0)*bessi1(x))+(1.0/x)*(1.0+y*(0.15443144
+ +y*(-0.67278579+y*(-0.18156897+y*(-0.1919402e-1
+ +y*(-0.110404e-2+y*(-0.4686e-4)))))));
+ } else {
+ y=2.0/x;
+ ans=(exp(-x)/sqrt(x))*(1.25331414+y*(0.23498619
+ +y*(-0.3655620e-1+y*(0.1504268e-1+y*(-0.780353e-2
+ +y*(0.325614e-2+y*(-0.68245e-3)))))));
+ }
+ return ans;
+}
+
+double bessk( int n, double x )
+{
+ int j;
+ double bk,bkm,bkp,tox;
+
+
+ if (n < 0 || x == 0.0)
+ {
+ double dblank;
+ return( dblank );
+ }
+ if (n == 0)
+ return( bessk0(x) );
+ if (n == 1)
+ return( bessk1(x) );
+
+ tox=2.0/x;
+ bkm=bessk0(x);
+ bk=bessk1(x);
+ for (j=1;j<n;j++) {
+ bkp=bkm+j*tox*bk;
+ bkm=bk;
+ bk=bkp;
+ }
+ return bk;
+}
+
+void dbesselka(double* inp1,int size1, double* inp2,int size2, double* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = bessk(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/besselk/sbesselka.c b/src/c/specialFunctions/besselk/sbesselka.c
new file mode 100644
index 00000000..bfb35eb1
--- /dev/null
+++ b/src/c/specialFunctions/besselk/sbesselka.c
@@ -0,0 +1,141 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "besselk.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+static float fbessi0( float x )
+{
+ float ax,ans;
+ float y;
+
+
+ if ((ax=fabs(x)) < 3.75) {
+ y=x/3.75,y=y*y;
+ ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492
+ +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));
+ } else {
+ y=3.75/ax;
+ ans=(exp(ax)/sqrt(ax))*(0.39894228+y*(0.1328592e-1
+ +y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2
+ +y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1
+ +y*0.392377e-2))))))));
+ }
+ return ans;
+}
+
+
+
+
+static float fbessi1( float x)
+{
+ float ax,ans;
+ float y;
+
+
+ if ((ax=fabs(x)) < 3.75) {
+ y=x/3.75,y=y*y;
+ ans=ax*(0.5+y*(0.87890594+y*(0.51498869+y*(0.15084934
+ +y*(0.2658733e-1+y*(0.301532e-2+y*0.32411e-3))))));
+ } else {
+ y=3.75/ax;
+ ans=0.2282967e-1+y*(-0.2895312e-1+y*(0.1787654e-1
+ -y*0.420059e-2));
+ ans=0.39894228+y*(-0.3988024e-1+y*(-0.362018e-2
+ +y*(0.163801e-2+y*(-0.1031555e-1+y*ans))));
+ ans *= (exp(ax)/sqrt(ax));
+ }
+ return x < 0.0 ? -ans : ans;
+}
+
+
+static float fbessk0( float x )
+{
+ float y,ans;
+
+ if (x <= 2.0) {
+ y=x*x/4.0;
+ ans=(-log(x/2.0)*fbessi0(x))+(-0.57721566+y*(0.42278420
+ +y*(0.23069756+y*(0.3488590e-1+y*(0.262698e-2
+ +y*(0.10750e-3+y*0.74e-5))))));
+ } else {
+ y=2.0/x;
+ ans=(exp(-x)/sqrt(x))*(1.25331414+y*(-0.7832358e-1
+ +y*(0.2189568e-1+y*(-0.1062446e-1+y*(0.587872e-2
+ +y*(-0.251540e-2+y*0.53208e-3))))));
+ }
+ return ans;
+}
+
+
+
+
+static float fbessk1( float x )
+{
+ float y,ans;
+
+ if (x <= 2.0) {
+ y=x*x/4.0;
+ ans=(log(x/2.0)*fbessi1(x))+(1.0/x)*(1.0+y*(0.15443144
+ +y*(-0.67278579+y*(-0.18156897+y*(-0.1919402e-1
+ +y*(-0.110404e-2+y*(-0.4686e-4)))))));
+ } else {
+ y=2.0/x;
+ ans=(exp(-x)/sqrt(x))*(1.25331414+y*(0.23498619
+ +y*(-0.3655620e-1+y*(0.1504268e-1+y*(-0.780353e-2
+ +y*(0.325614e-2+y*(-0.68245e-3)))))));
+ }
+ return ans;
+}
+
+float fbessk( int n, float x )
+{
+ int j;
+ float bk,bkm,bkp,tox;
+
+
+ if (n < 0 || x == 0.0)
+ {
+ float dblank;
+ return( dblank );
+ }
+ if (n == 0)
+ return( fbessk0(x) );
+ if (n == 1)
+ return( fbessk1(x) );
+
+ tox=2.0/x;
+ bkm=fbessk0(x);
+ bk=fbessk1(x);
+ for (j=1;j<n;j++) {
+ bkp=bkm+j*tox*bk;
+ bkm=bk;
+ bk=bkp;
+ }
+ return bk;
+}
+
+void sbesselka(float* inp1,int size1, float* inp2,int size2, float* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = fbessk(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/bessely/dbesselya.c b/src/c/specialFunctions/bessely/dbesselya.c
new file mode 100644
index 00000000..76678629
--- /dev/null
+++ b/src/c/specialFunctions/bessely/dbesselya.c
@@ -0,0 +1,167 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "bessely.h"
+#include "besselj.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+static double bessj0( double x )
+{
+ double ax,z;
+ double xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=57568490574.0+y*(-13362590354.0+y*(651619640.7
+ +y*(-11214424.18+y*(77392.33017+y*(-184.9052456)))));
+ ans2=57568490411.0+y*(1029532985.0+y*(9494680.718
+ +y*(59272.64853+y*(267.8532712+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-0.785398164;
+ ans1=1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4
+ +y*(-0.2073370639e-5+y*0.2093887211e-6)));
+ ans2 = -0.1562499995e-1+y*(0.1430488765e-3
+ +y*(-0.6911147651e-5+y*(0.7621095161e-6
+ -y*0.934935152e-7)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ }
+ return ans;
+}
+
+
+static double bessj1( double x )
+{
+ double ax,z;
+ double xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=x*(72362614232.0+y*(-7895059235.0+y*(242396853.1
+ +y*(-2972611.439+y*(15704.48260+y*(-30.16036606))))));
+ ans2=144725228442.0+y*(2300535178.0+y*(18583304.74
+ +y*(99447.43394+y*(376.9991397+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-2.356194491;
+ ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
+ +y*(0.2457520174e-5+y*(-0.240337019e-6))));
+ ans2=0.04687499995+y*(-0.2002690873e-3
+ +y*(0.8449199096e-5+y*(-0.88228987e-6
+ +y*0.105787412e-6)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ if (x < 0.0) ans = -ans;
+ }
+ return ans;
+}
+
+
+static double bessy0( double x )
+{
+ double z;
+ double xx,y,ans,ans1,ans2;
+
+ if (x < 8.0) {
+ y=x*x;
+ ans1 = -2957821389.0+y*(7062834065.0+y*(-512359803.6
+ +y*(10879881.29+y*(-86327.92757+y*228.4622733))));
+ ans2=40076544269.0+y*(745249964.8+y*(7189466.438
+ +y*(47447.26470+y*(226.1030244+y*1.0))));
+ ans=(ans1/ans2)+0.636619772*bessj0(x)*log(x);
+ } else {
+ z=8.0/x;
+ y=z*z;
+ xx=x-0.785398164;
+ ans1=1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4
+ +y*(-0.2073370639e-5+y*0.2093887211e-6)));
+ ans2 = -0.1562499995e-1+y*(0.1430488765e-3
+ +y*(-0.6911147651e-5+y*(0.7621095161e-6
+ +y*(-0.934945152e-7))));
+ ans=sqrt(0.636619772/x)*(sin(xx)*ans1+z*cos(xx)*ans2);
+ }
+ return ans;
+}
+
+static double bessy1( double x )
+{
+ double z;
+ double xx,y,ans,ans1,ans2;
+
+ if (x < 8.0) {
+ y=x*x;
+ ans1=x*(-0.4900604943e13+y*(0.1275274390e13
+ +y*(-0.5153438139e11+y*(0.7349264551e9
+ +y*(-0.4237922726e7+y*0.8511937935e4)))));
+ ans2=0.2499580570e14+y*(0.4244419664e12
+ +y*(0.3733650367e10+y*(0.2245904002e8
+ +y*(0.1020426050e6+y*(0.3549632885e3+y)))));
+ ans=(ans1/ans2)+0.636619772*(bessj1(x)*log(x)-1.0/x);
+ } else {
+ z=8.0/x;
+ y=z*z;
+ xx=x-2.356194491;
+ ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
+ +y*(0.2457520174e-5+y*(-0.240337019e-6))));
+ ans2=0.04687499995+y*(-0.2002690873e-3
+ +y*(0.8449199096e-5+y*(-0.88228987e-6
+ +y*0.105787412e-6)));
+ ans=sqrt(0.636619772/x)*(sin(xx)*ans1+z*cos(xx)*ans2);
+ }
+ return ans;
+}
+
+double bessy( int n, double x )
+{
+ int j;
+ double by,bym,byp,tox;
+
+
+ if (n < 0 || x == 0.0)
+ {
+ double dblank;
+ return( dblank );
+ }
+ if (n == 0)
+ return( bessy0(x) );
+ if (n == 1)
+ return( bessy1(x) );
+
+ tox=2.0/x;
+ by=bessy1(x);
+ bym=bessy0(x);
+ for (j=1;j<n;j++) {
+ byp=j*tox*by-bym;
+ bym=by;
+ by=byp;
+ }
+ return by;
+}
+
+void dbesselya(double* inp1,int size1, double* inp2,int size2, double* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = bessy(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/bessely/sbesselya.c b/src/c/specialFunctions/bessely/sbesselya.c
new file mode 100644
index 00000000..1b42736c
--- /dev/null
+++ b/src/c/specialFunctions/bessely/sbesselya.c
@@ -0,0 +1,168 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "math.h"
+#include "bessely.h"
+#include "besselj.h"
+
+#define ACC 40.0
+#define BIGNO 1.0e10
+#define BIGNI 1.0e-10
+
+static double bessj0( double x )
+{
+ double ax,z;
+ double xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=57568490574.0+y*(-13362590354.0+y*(651619640.7
+ +y*(-11214424.18+y*(77392.33017+y*(-184.9052456)))));
+ ans2=57568490411.0+y*(1029532985.0+y*(9494680.718
+ +y*(59272.64853+y*(267.8532712+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-0.785398164;
+ ans1=1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4
+ +y*(-0.2073370639e-5+y*0.2093887211e-6)));
+ ans2 = -0.1562499995e-1+y*(0.1430488765e-3
+ +y*(-0.6911147651e-5+y*(0.7621095161e-6
+ -y*0.934935152e-7)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ }
+ return ans;
+}
+
+
+static double bessj1( double x )
+{
+ double ax,z;
+ double xx,y,ans,ans1,ans2;
+
+ if ((ax=fabs(x)) < 8.0) {
+ y=x*x;
+ ans1=x*(72362614232.0+y*(-7895059235.0+y*(242396853.1
+ +y*(-2972611.439+y*(15704.48260+y*(-30.16036606))))));
+ ans2=144725228442.0+y*(2300535178.0+y*(18583304.74
+ +y*(99447.43394+y*(376.9991397+y*1.0))));
+ ans=ans1/ans2;
+ } else {
+ z=8.0/ax;
+ y=z*z;
+ xx=ax-2.356194491;
+ ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
+ +y*(0.2457520174e-5+y*(-0.240337019e-6))));
+ ans2=0.04687499995+y*(-0.2002690873e-3
+ +y*(0.8449199096e-5+y*(-0.88228987e-6
+ +y*0.105787412e-6)));
+ ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
+ if (x < 0.0) ans = -ans;
+ }
+ return ans;
+}
+
+
+
+static float fbessy0( float x )
+{
+ float z;
+ float xx,y,ans,ans1,ans2;
+
+ if (x < 8.0) {
+ y=x*x;
+ ans1 = -2957821389.0+y*(7062834065.0+y*(-512359803.6
+ +y*(10879881.29+y*(-86327.92757+y*228.4622733))));
+ ans2=40076544269.0+y*(745249964.8+y*(7189466.438
+ +y*(47447.26470+y*(226.1030244+y*1.0))));
+ ans=(ans1/ans2)+0.636619772*bessj0(x)*log(x);
+ } else {
+ z=8.0/x;
+ y=z*z;
+ xx=x-0.785398164;
+ ans1=1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4
+ +y*(-0.2073370639e-5+y*0.2093887211e-6)));
+ ans2 = -0.1562499995e-1+y*(0.1430488765e-3
+ +y*(-0.6911147651e-5+y*(0.7621095161e-6
+ +y*(-0.934945152e-7))));
+ ans=sqrt(0.636619772/x)*(sin(xx)*ans1+z*cos(xx)*ans2);
+ }
+ return ans;
+}
+
+static float fbessy1( float x )
+{
+ float z;
+ float xx,y,ans,ans1,ans2;
+
+ if (x < 8.0) {
+ y=x*x;
+ ans1=x*(-0.4900604943e13+y*(0.1275274390e13
+ +y*(-0.5153438139e11+y*(0.7349264551e9
+ +y*(-0.4237922726e7+y*0.8511937935e4)))));
+ ans2=0.2499580570e14+y*(0.4244419664e12
+ +y*(0.3733650367e10+y*(0.2245904002e8
+ +y*(0.1020426050e6+y*(0.3549632885e3+y)))));
+ ans=(ans1/ans2)+0.636619772*(bessj1(x)*log(x)-1.0/x);
+ } else {
+ z=8.0/x;
+ y=z*z;
+ xx=x-2.356194491;
+ ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
+ +y*(0.2457520174e-5+y*(-0.240337019e-6))));
+ ans2=0.04687499995+y*(-0.2002690873e-3
+ +y*(0.8449199096e-5+y*(-0.88228987e-6
+ +y*0.105787412e-6)));
+ ans=sqrt(0.636619772/x)*(sin(xx)*ans1+z*cos(xx)*ans2);
+ }
+ return ans;
+}
+
+float fbessy( int n, float x )
+{
+ int j;
+ float by,bym,byp,tox;
+
+
+ if (n < 0 || x == 0.0)
+ {
+ float dblank;
+ return( dblank );
+ }
+ if (n == 0)
+ return( fbessy0(x) );
+ if (n == 1)
+ return( fbessy1(x) );
+
+ tox=2.0/x;
+ by=fbessy1(x);
+ bym=fbessy0(x);
+ for (j=1;j<n;j++) {
+ byp=j*tox*by-bym;
+ bym=by;
+ by=byp;
+ }
+ return by;
+}
+
+void sbesselya(float* inp1,int size1, float* inp2,int size2, float* oup)
+{
+ int i;
+ if(size1 != size2)
+ printf("Error! arguments #1 and #2 have incompatible dimensions.");
+ for(i = 0; i<size1;i++)
+ {
+ oup[i] = fbessy(inp1[i],inp2[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/beta/dbetaa.c b/src/c/specialFunctions/beta/dbetaa.c
new file mode 100644
index 00000000..cba98be3
--- /dev/null
+++ b/src/c/specialFunctions/beta/dbetaa.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+#include "beta.h"
+
+void dbetaa(double* inp1,int size1, double* inp2,int size2, double* out)
+{
+ for(int i = 0; i<size1; i++)
+ out[i] = dbetas(inp1[i],inp2[i]);
+}
diff --git a/src/c/specialFunctions/beta/dbetas.c b/src/c/specialFunctions/beta/dbetas.c
new file mode 100644
index 00000000..5ef02578
--- /dev/null
+++ b/src/c/specialFunctions/beta/dbetas.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+#include "beta.h"
+
+double dbetas(double inp1, double inp2)
+{
+ return dgammas(inp1)*dgammas(inp2)/dgammas(inp1+inp2);
+}
diff --git a/src/c/specialFunctions/beta/sbetaa.c b/src/c/specialFunctions/beta/sbetaa.c
new file mode 100644
index 00000000..f3fc380e
--- /dev/null
+++ b/src/c/specialFunctions/beta/sbetaa.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+#include "beta.h"
+
+void sbetaa(float* inp1,int size1, float* inp2,int size2, float* out)
+{
+ for(int i = 0; i<size1; i++)
+ out[i] = sbetas(inp1[i],inp2[i]);
+}
diff --git a/src/c/specialFunctions/beta/sbetas.c b/src/c/specialFunctions/beta/sbetas.c
new file mode 100644
index 00000000..cbe3368b
--- /dev/null
+++ b/src/c/specialFunctions/beta/sbetas.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+#include "beta.h"
+
+float sbetas(float inp1, float inp2)
+{
+ return dgammas(inp1)*dgammas(inp2)/dgammas(inp1+inp2);
+}
diff --git a/src/c/specialFunctions/calerf/dcalerfa.c b/src/c/specialFunctions/calerf/dcalerfa.c
new file mode 100644
index 00000000..16379252
--- /dev/null
+++ b/src/c/specialFunctions/calerf/dcalerfa.c
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+#include "erfc.h"
+#include "erfcx.h"
+#include "calerf.h"
+
+
+void dcalerfa(double* inp1, int size,double inp2, double* out)
+{
+ for (int i = 0; i < size; i++)
+ {
+ out[i] = dcalerfs(inp1[i],inp2);
+ }
+}
+
diff --git a/src/c/specialFunctions/calerf/dcalerfs.c b/src/c/specialFunctions/calerf/dcalerfs.c
new file mode 100644
index 00000000..c3608653
--- /dev/null
+++ b/src/c/specialFunctions/calerf/dcalerfs.c
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+#include "erfc.h"
+#include "erfcx.h"
+
+double dcalerfs (double inp1, double inp2)
+{
+ if (inp2 == 0)
+ return erf(inp1);
+ if (inp2 == 1)
+ return derfcs(inp1);
+ if (inp2 == 2)
+ return derfcxs(inp1);
+}
+
diff --git a/src/c/specialFunctions/calerf/scalerfa.c b/src/c/specialFunctions/calerf/scalerfa.c
new file mode 100644
index 00000000..726ab1db
--- /dev/null
+++ b/src/c/specialFunctions/calerf/scalerfa.c
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+#include "erfc.h"
+#include "erfcx.h"
+#include "calerf.h"
+
+
+void scalerfa(float* inp1, int size,double inp2, float* out)
+{
+ for (int i = 0; i < size; i++)
+ {
+ out[i] = scalerfs(inp1[i],inp2);
+ }
+}
+
diff --git a/src/c/specialFunctions/calerf/scalerfs.c b/src/c/specialFunctions/calerf/scalerfs.c
new file mode 100644
index 00000000..ffc48c37
--- /dev/null
+++ b/src/c/specialFunctions/calerf/scalerfs.c
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+#include "erfc.h"
+#include "erfcx.h"
+
+float scalerfs (float inp1, double inp2)
+{
+ if (inp2 == 0)
+ return erf(inp1);
+ if (inp2 == 1)
+ return derfcs(inp1);
+ if (inp2 == 2)
+ return derfcxs(inp1);
+}
+
diff --git a/src/c/specialFunctions/erf/derfa.c b/src/c/specialFunctions/erf/derfa.c
new file mode 100644
index 00000000..972d7437
--- /dev/null
+++ b/src/c/specialFunctions/erf/derfa.c
@@ -0,0 +1,25 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+
+void derfa(double* inp1, int sizer, int sizec,double* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = erf(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erf/derfs.c b/src/c/specialFunctions/erf/derfs.c
new file mode 100644
index 00000000..22b5d642
--- /dev/null
+++ b/src/c/specialFunctions/erf/derfs.c
@@ -0,0 +1,22 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+
+double derfs(double inp1)
+{
+ return erf(inp1);
+}
+
diff --git a/src/c/specialFunctions/erf/serfa.c b/src/c/specialFunctions/erf/serfa.c
new file mode 100644
index 00000000..0db4a7b2
--- /dev/null
+++ b/src/c/specialFunctions/erf/serfa.c
@@ -0,0 +1,25 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+
+void serfa(float* inp1, int sizer, int sizec,float* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = erf(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erf/serfs.c b/src/c/specialFunctions/erf/serfs.c
new file mode 100644
index 00000000..66638a15
--- /dev/null
+++ b/src/c/specialFunctions/erf/serfs.c
@@ -0,0 +1,22 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erf.h"
+
+float serfs(float inp1)
+{
+ return erf(inp1);
+}
+
diff --git a/src/c/specialFunctions/erfc/derfca.c b/src/c/specialFunctions/erfc/derfca.c
new file mode 100644
index 00000000..85c92efb
--- /dev/null
+++ b/src/c/specialFunctions/erfc/derfca.c
@@ -0,0 +1,25 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfc.h"
+
+void derfca(double* inp1, int sizer, int sizec, double* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = derfcs(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erfc/derfcs.c b/src/c/specialFunctions/erfc/derfcs.c
new file mode 100644
index 00000000..31c98463
--- /dev/null
+++ b/src/c/specialFunctions/erfc/derfcs.c
@@ -0,0 +1,22 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfc.h"
+
+double derfcs(double inp1)
+{
+ return (1-erf(inp1));
+}
+
diff --git a/src/c/specialFunctions/erfc/serfca.c b/src/c/specialFunctions/erfc/serfca.c
new file mode 100644
index 00000000..469c5a16
--- /dev/null
+++ b/src/c/specialFunctions/erfc/serfca.c
@@ -0,0 +1,25 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfc.h"
+
+void serfca(float* inp1, int sizer, int sizec, float* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = serfcs(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erfc/serfcs.c b/src/c/specialFunctions/erfc/serfcs.c
new file mode 100644
index 00000000..3f93a807
--- /dev/null
+++ b/src/c/specialFunctions/erfc/serfcs.c
@@ -0,0 +1,22 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfc.h"
+
+float serfcs(float inp1)
+{
+ return (1-erf(inp1));
+}
+
diff --git a/src/c/specialFunctions/erfcx/derfcxa.c b/src/c/specialFunctions/erfcx/derfcxa.c
new file mode 100644
index 00000000..d2cd7505
--- /dev/null
+++ b/src/c/specialFunctions/erfcx/derfcxa.c
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfcx.h"
+#include "erfc.h"
+
+void derfcxa(double* inp1, int sizer, int sizec, double* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = derfcxs(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erfcx/derfcxs.c b/src/c/specialFunctions/erfcx/derfcxs.c
new file mode 100644
index 00000000..ff12b2fb
--- /dev/null
+++ b/src/c/specialFunctions/erfcx/derfcxs.c
@@ -0,0 +1,23 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfcx.h"
+#include "erfc.h"
+
+double derfcxs(double inp1)
+{
+ return exp(inp1*inp1)*derfcs(inp1);
+}
+
diff --git a/src/c/specialFunctions/erfcx/serfcxa.c b/src/c/specialFunctions/erfcx/serfcxa.c
new file mode 100644
index 00000000..a28c30c7
--- /dev/null
+++ b/src/c/specialFunctions/erfcx/serfcxa.c
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfcx.h"
+#include "erfc.h"
+
+void serfcxa(float* inp1, int sizer, int sizec, float* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = serfcxs(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erfcx/serfcxs.c b/src/c/specialFunctions/erfcx/serfcxs.c
new file mode 100644
index 00000000..be31a5a8
--- /dev/null
+++ b/src/c/specialFunctions/erfcx/serfcxs.c
@@ -0,0 +1,23 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfcx.h"
+#include "erfc.h"
+
+float serfcxs(float inp1)
+{
+ return exp(inp1*inp1)*derfcs(inp1);
+}
+
diff --git a/src/c/specialFunctions/erfinv/derfinva.c b/src/c/specialFunctions/erfinv/derfinva.c
new file mode 100644
index 00000000..45d119c4
--- /dev/null
+++ b/src/c/specialFunctions/erfinv/derfinva.c
@@ -0,0 +1,25 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfinv.h"
+
+void derfinva(double* inp1, int sizer, int sizec,double* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = derfinvs(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erfinv/derfinvs.c b/src/c/specialFunctions/erfinv/derfinvs.c
new file mode 100644
index 00000000..3f7fe761
--- /dev/null
+++ b/src/c/specialFunctions/erfinv/derfinvs.c
@@ -0,0 +1,49 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfinv.h"
+
+# define PI 3.1415927
+
+double derfinvs (double inp1)
+{
+ double a[] = {0.88622692374517353,-1.6601283962374516,0.92661860147244357,-0.14110320437680104}; //Coefficients for the formula to calculate inverse error
+ double b[] = {-2.13505380615258078,1.46060340345661088,-0.33198239813321595,0.01197270616590528}; //Coefficients for the formula to calculate inverse error
+ double c[] = {-1.994216456587148,-1.87267416351196,3.60874665878559364,1.82365845766309853}; //Coefficients for the formula to calculate inverse error
+ double d[] = {3.74146294065960872,1.81848952562894617}; //Coefficients for the formula to calculate inverse error
+
+ if ((inp1 > 1) || (inp1 < -1))
+ {
+ return 0.0/0.0; // returns Nan
+ }
+ if ((inp1 >= -0.7) && (inp1 <= 0.7))
+ {
+ double sq = inp1 * inp1;
+ return (inp1 * (((a[3]*sq+a[2]) * sq+a[1]) * sq+a[0]) / ((((b[3]*sq+b[2]) * sq+b[1]) * sq+b[0]) * sq+1)); //Inverse error formula
+ }
+
+ else if ((inp1 > 0.7) && (inp1 < 1))
+ {
+ double z = sqrt(-log((1-inp1)/2));
+ return ((((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula
+ }
+
+ else if ((inp1 > -1) && (inp1 < 0.7))
+ {
+ double z = sqrt(-log((1+inp1)/2));
+ return (-(((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula
+ }
+}
+
diff --git a/src/c/specialFunctions/erfinv/serfinva.c b/src/c/specialFunctions/erfinv/serfinva.c
new file mode 100644
index 00000000..3a14f3c8
--- /dev/null
+++ b/src/c/specialFunctions/erfinv/serfinva.c
@@ -0,0 +1,25 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfinv.h"
+
+void serfinva(float* inp1, int sizer, int sizec,float* out)
+{
+ for (int i = 0; i < sizer*sizec; i++)
+ {
+ out[i] = serfinvs(inp1[i]);
+ }
+}
+
diff --git a/src/c/specialFunctions/erfinv/serfinvs.c b/src/c/specialFunctions/erfinv/serfinvs.c
new file mode 100644
index 00000000..5436fe39
--- /dev/null
+++ b/src/c/specialFunctions/erfinv/serfinvs.c
@@ -0,0 +1,50 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "erfinv.h"
+
+# define PI 3.1415927
+
+float serfinvs (float inp1)
+{
+ float a[] = {0.88622692374517353,-1.6601283962374516,0.92661860147244357,-0.14110320437680104}; //Coefficients for the formula to calculate inverse error
+ float b[] = {-2.13505380615258078,1.46060340345661088,-0.33198239813321595,0.01197270616590528}; //Coefficients for the formula to calculate inverse error
+ float c[] = {-1.994216456587148,-1.87267416351196,3.60874665878559364,1.82365845766309853}; //Coefficients for the formula to calculate inverse error
+ float d[] = {3.74146294065960872,1.81848952562894617}; //Coefficients for the formula to calculate inverse error
+
+ if ((inp1 > 1) || (inp1 < -1))
+ {
+ double na = 0.0/0.0;
+ return (float)na;
+ }
+ if ((inp1 >= -0.7) && (inp1 <= 0.7))
+ {
+ float sq = inp1 * inp1;
+ return (inp1 * (((a[3]*sq+a[2]) * sq+a[1]) * sq+a[0]) / ((((b[3]*sq+b[2]) * sq+b[1]) * sq+b[0]) * sq+1)); //Inverse error formula
+ }
+
+ else if ((inp1 > 0.7) && (inp1 < 1))
+ {
+ float z = sqrt(-log((1-inp1)/2));
+ return ((((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula
+ }
+
+ else if ((inp1 > -1) && (inp1 < 0.7))
+ {
+ float z = sqrt(-log((1+inp1)/2));
+ return (-(((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula
+ }
+}
+
diff --git a/src/c/specialFunctions/gamma/dgammaa.c b/src/c/specialFunctions/gamma/dgammaa.c
new file mode 100644
index 00000000..e2bfadf9
--- /dev/null
+++ b/src/c/specialFunctions/gamma/dgammaa.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+
+void dgammaa(double* inp,int size,double* out)
+{
+ for(int i = 0; i<size; i++)
+ out[i] = dgammas(inp[i]);
+}
diff --git a/src/c/specialFunctions/gamma/dgammas.c b/src/c/specialFunctions/gamma/dgammas.c
new file mode 100644
index 00000000..2dae08ce
--- /dev/null
+++ b/src/c/specialFunctions/gamma/dgammas.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+
+double dgammas(double inp)
+{
+ return dfactorials(inp-1);
+}
diff --git a/src/c/specialFunctions/gamma/sgammaa.c b/src/c/specialFunctions/gamma/sgammaa.c
new file mode 100644
index 00000000..4636e344
--- /dev/null
+++ b/src/c/specialFunctions/gamma/sgammaa.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+
+void sgammaa(float* inp,int size,float* out)
+{
+ for(int i = 0; i<size; i++)
+ out[i] = sgammas(inp[i]);
+}
diff --git a/src/c/specialFunctions/gamma/sgammas.c b/src/c/specialFunctions/gamma/sgammas.c
new file mode 100644
index 00000000..9f2f705a
--- /dev/null
+++ b/src/c/specialFunctions/gamma/sgammas.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gamma.h"
+
+float sgammas(float inp)
+{
+ return dfactorials(inp-1);
+}
diff --git a/src/c/specialFunctions/gammaln/dgammalna.c b/src/c/specialFunctions/gammaln/dgammalna.c
new file mode 100644
index 00000000..8a2dd54b
--- /dev/null
+++ b/src/c/specialFunctions/gammaln/dgammalna.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gammaln.h"
+
+void dgammalna(double* inp,int size,double* out)
+{
+ for(int i = 0; i<size; i++)
+ out[i] = dgammalns(inp[i]);
+}
diff --git a/src/c/specialFunctions/gammaln/dgammalns.c b/src/c/specialFunctions/gammaln/dgammalns.c
new file mode 100644
index 00000000..1c6c2918
--- /dev/null
+++ b/src/c/specialFunctions/gammaln/dgammalns.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gammaln.h"
+
+double dgammalns(double inp)
+{
+ return log(dgammas(inp));
+}
diff --git a/src/c/specialFunctions/gammaln/sgammalna.c b/src/c/specialFunctions/gammaln/sgammalna.c
new file mode 100644
index 00000000..1760ca92
--- /dev/null
+++ b/src/c/specialFunctions/gammaln/sgammalna.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gammaln.h"
+
+void sgammalna(float* inp,int size,float* out)
+{
+ for(int i = 0; i<size; i++)
+ out[i] = sgammalns(inp[i]);
+}
diff --git a/src/c/specialFunctions/gammaln/sgammalns.c b/src/c/specialFunctions/gammaln/sgammalns.c
new file mode 100644
index 00000000..af4c27fe
--- /dev/null
+++ b/src/c/specialFunctions/gammaln/sgammalns.c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "gammaln.h"
+
+float sgammalns(float inp)
+{
+ return log(sgammas(inp));
+}
diff --git a/src/c/specialFunctions/includes/besseli.h b/src/c/specialFunctions/includes/besseli.h
new file mode 100644
index 00000000..6502b183
--- /dev/null
+++ b/src/c/specialFunctions/includes/besseli.h
@@ -0,0 +1,34 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __BESSELI_H__
+#define __BESSELI_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "gamma.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void sbesselia(float* inp1,int size1, float* inp2,int size2, float* oup);
+void dbesselia(double* inp1,int size1, double* inp2,int size2, double* oup);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__BESSELI_H__*/
diff --git a/src/c/specialFunctions/includes/besselj.h b/src/c/specialFunctions/includes/besselj.h
new file mode 100644
index 00000000..de849a36
--- /dev/null
+++ b/src/c/specialFunctions/includes/besselj.h
@@ -0,0 +1,34 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __BESSELJ_H__
+#define __BESSELJ_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "gamma.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void sbesselja(float* inp1,int size1, float* inp2,int size2, float* oup);
+void dbesselja(double* inp1,int size1, double* inp2,int size2, double* oup);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__BESSELJ_H__*/
diff --git a/src/c/specialFunctions/includes/besselk.h b/src/c/specialFunctions/includes/besselk.h
new file mode 100644
index 00000000..0be3c34e
--- /dev/null
+++ b/src/c/specialFunctions/includes/besselk.h
@@ -0,0 +1,34 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __BESSELK_H__
+#define __BESSELK_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "gamma.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void sbesselka(float* inp1,int size1, float* inp2,int size2, float* oup);
+void dbesselka(double* inp1,int size1, double* inp2,int size2, double* oup);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__BESSELK_H__*/
diff --git a/src/c/specialFunctions/includes/bessely.h b/src/c/specialFunctions/includes/bessely.h
new file mode 100644
index 00000000..fb385efd
--- /dev/null
+++ b/src/c/specialFunctions/includes/bessely.h
@@ -0,0 +1,35 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __BESSELY_H__
+#define __BESSELY_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "gamma.h"
+#include "besselj.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void sbesselya(float* inp1,int size1, float* inp2,int size2, float* oup);
+void dbesselya(double* inp1,int size1, double* inp2,int size2, double* oup);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__BESSELY_H__*/
diff --git a/src/c/specialFunctions/includes/beta.h b/src/c/specialFunctions/includes/beta.h
new file mode 100644
index 00000000..be0caf69
--- /dev/null
+++ b/src/c/specialFunctions/includes/beta.h
@@ -0,0 +1,36 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __BETA_H__
+#define __BETA_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "gamma.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dbetas(double inp1, double inp2);
+float sbetas(float inp1, float inp2);
+void dbetaa(double* inp1,int size1, double* inp2,int size2, double* out);
+void sbetaa(float* inp1,int size1, float* inp2,int size2, float* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__BETA_H__*/
diff --git a/src/c/specialFunctions/includes/calerf.h b/src/c/specialFunctions/includes/calerf.h
new file mode 100644
index 00000000..9bb63ebf
--- /dev/null
+++ b/src/c/specialFunctions/includes/calerf.h
@@ -0,0 +1,41 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __CALERF_H__
+#define __CALERF_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "erf.h"
+#include "erfc.h"
+#include "erfcx.h"
+#include "calerf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dcalerfs (double inp1, double inp2);
+void dcalerfa(double* inp1, int size,double inp2, double* out);
+
+float scalerfs (float inp1, double inp2);
+void scalerfa(float* inp1, int size,double inp2, float* out);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__CALERF_H__*/
diff --git a/src/c/specialFunctions/includes/erf.h b/src/c/specialFunctions/includes/erf.h
new file mode 100644
index 00000000..4b3cde45
--- /dev/null
+++ b/src/c/specialFunctions/includes/erf.h
@@ -0,0 +1,34 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __ERF_H__
+#define __ERF_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double derfs(double inp1);
+float serfs(float inp1);
+void derfa(double* inp1, int sizer, int sizec,double* out);
+void serfa(float* inp1, int sizer, int sizec,float* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__ERF_H__*/
diff --git a/src/c/specialFunctions/includes/erfc.h b/src/c/specialFunctions/includes/erfc.h
new file mode 100644
index 00000000..509e34e5
--- /dev/null
+++ b/src/c/specialFunctions/includes/erfc.h
@@ -0,0 +1,36 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __ERFC_H__
+#define __ERFC_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double derfcs(double inp1);
+void derfca(double* inp1, int sizer, int sizec,double* out);
+float serfcs(float inp1);
+void serfca(float* inp1, int sizer, int sizec, float* out);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__ERFC_H__*/
diff --git a/src/c/specialFunctions/includes/erfcx.h b/src/c/specialFunctions/includes/erfcx.h
new file mode 100644
index 00000000..dd1e4420
--- /dev/null
+++ b/src/c/specialFunctions/includes/erfcx.h
@@ -0,0 +1,37 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __ERFCX_H__
+#define __ERFCX_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "erfc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double derfcxs(double inp1);
+void derfcxa(double* inp1, int sizer, int sizec,double* out);
+float serfcxs(float inp1);
+void serfcxa(float* inp1, int sizer, int sizec, float* out);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__ERFCX_H__*/
diff --git a/src/c/specialFunctions/includes/erfinv.h b/src/c/specialFunctions/includes/erfinv.h
new file mode 100644
index 00000000..5d6210cc
--- /dev/null
+++ b/src/c/specialFunctions/includes/erfinv.h
@@ -0,0 +1,35 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef __ERFINV_H__
+#define __ERFINV_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double derfinvs (double inp1);
+float serfinvs (float inp1);
+void derfinva(double* inp1, int sizer, int sizec,double* out);
+void serfinva(float* inp1, int sizer, int sizec,float* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__ERFINV_H__*/
diff --git a/src/c/specialFunctions/includes/gamma.h b/src/c/specialFunctions/includes/gamma.h
new file mode 100644
index 00000000..bd438b6d
--- /dev/null
+++ b/src/c/specialFunctions/includes/gamma.h
@@ -0,0 +1,35 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __GAMMA_H__
+#define __GAMMA_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dgammas(double inp);
+float sgammas(float inp);
+void dgammaa(double* inp,int size,double* out);
+void sgammaa(float* inp,int size,float* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__GAMMA_H__*/
diff --git a/src/c/specialFunctions/includes/gammaln.h b/src/c/specialFunctions/includes/gammaln.h
new file mode 100644
index 00000000..f3af242b
--- /dev/null
+++ b/src/c/specialFunctions/includes/gammaln.h
@@ -0,0 +1,36 @@
+ /* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __GAMMALN_H__
+#define __GAMMALN_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "gamma.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dgammalns(double inp);
+float sgammalns(float inp);
+void dgammalna(double* inp,int size,double* out);
+void sgammalna(float* inp,int size,float* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__GAMMALN_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_besseli.h b/src/c/specialFunctions/interfaces/int_besseli.h
new file mode 100644
index 00000000..e11c48ca
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_besseli.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_BESSELI_H__
+#define __INT_BESSELI_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define d2d2besselid2(in1, size1, in2, size2, out) dbesselia(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+#define s2s2besselis2(in1, size1, in2, size2, out) sbesselia(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_BESSELI_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_besselj.h b/src/c/specialFunctions/interfaces/int_besselj.h
new file mode 100644
index 00000000..cc0d85ee
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_besselj.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_BESSELJ_H__
+#define __INT_BESSELJ_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define d2d2besseljd2(in1, size1, in2, size2, out) dbesselja(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+#define s2s2besseljs2(in1, size1, in2, size2, out) sbesselja(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_BESSELJ_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_besselk.h b/src/c/specialFunctions/interfaces/int_besselk.h
new file mode 100644
index 00000000..16b9c4b9
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_besselk.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_BESSELK_H__
+#define __INT_BESSELK_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define d2d2besselkd2(in1, size1, in2, size2, out) dbesselka(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+#define s2s2besselks2(in1, size1, in2, size2, out) sbesselka(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_BESSELK_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_bessely.h b/src/c/specialFunctions/interfaces/int_bessely.h
new file mode 100644
index 00000000..749c8767
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_bessely.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_BESSELY_H__
+#define __INT_BESSELY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define d2d2besselyd2(in1, size1, in2, size2, out) dbesselya(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+#define s2s2besselys2(in1, size1, in2, size2, out) sbesselya(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_BESSELY_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_beta.h b/src/c/specialFunctions/interfaces/int_beta.h
new file mode 100644
index 00000000..4f3981ee
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_beta.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_BETA_H__
+#define __INT_BETA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0d0betad0(in1, in2) dbetas(in1, in2)
+#define d2d2betad2(in1, size1, in2, size2, out) dbetaa(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+#define s0s0betas0(in1, in2) sbetas(in1, in2)
+#define s2s2betas2(in1, size1, in2, size2, out) sbetaa(in1,size1[0]*size1[1], in2, size2[0]*size2[1], out)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_BETA_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_calerf.h b/src/c/specialFunctions/interfaces/int_calerf.h
new file mode 100644
index 00000000..ee75bdc8
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_calerf.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_CALERF_H__
+#define __INT_CALERF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0d0calerfd0(in1,in2) dcalerfs(in1, in2)
+#define d2d0calerfd2(in1, size, in2, out) dcalerfa(in1, size[0]*size[1], in2, out)
+
+#define s0d0calerfs0(in1,in2) scalerfs(in1, in2)
+#define s2d0calerfs2(in1, size, in2, out) scalerfa(in1, size[0]*size[1], in2, out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_CALERF_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_erf.h b/src/c/specialFunctions/interfaces/int_erf.h
new file mode 100644
index 00000000..87f11f9a
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_erf.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_ERF_H__
+#define __INT_ERF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0erfd0(in1) derfs(in1)
+#define s0erfs0(in1) serfs(in1)
+#define d2erfd2(in1,size,out) derfa(in1,size[0],size[1],out)
+#define s2erfs2(in1,size,out) serfa(in1,size[0],size[1],out)
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_ERF_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_erfc.h b/src/c/specialFunctions/interfaces/int_erfc.h
new file mode 100644
index 00000000..64ae0fa8
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_erfc.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_ERFC_H__
+#define __INT_ERFC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0erfcd0(in1) derfcs(in1)
+#define s0erfcs0(in1) serfcs(in1)
+#define d2erfcd2(in1,size,out) derfca(in1,size[0],size[1],out)
+#define s2erfcs2(in1,size,out) serfca(in1,size[0],size[1],out)
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_ERFC_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_erfcx.h b/src/c/specialFunctions/interfaces/int_erfcx.h
new file mode 100644
index 00000000..89840d48
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_erfcx.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_ERFCX_H__
+#define __INT_ERFCX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0erfcxd0(in1) derfcxs(in1)
+#define s0erfcxs0(in1) serfcxs(in1)
+#define d2erfcxd2(in1,size,out) derfcxa(in1,size[0],size[1],out)
+#define s2erfcs2(in1,size,out) serfca(in1,size[0],size[1],out)
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_ERFCX_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_erfinv.h b/src/c/specialFunctions/interfaces/int_erfinv.h
new file mode 100644
index 00000000..f19baa12
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_erfinv.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_ERFINV_H__
+#define __INT_ERFINV_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0erfinvd0(in1) derfinvs(in1)
+#define s0erfinvs0(in1) serfinvs(in1)
+#define d2erfinvd2(in1,size,out) derfinva(in1,size[0],size[1],out)
+#define s2erfinvs2(in1,size,out) serfinva(in1,size[0],size[1],out)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_ERFINV_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_gamma.h b/src/c/specialFunctions/interfaces/int_gamma.h
new file mode 100644
index 00000000..b527fddc
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_gamma.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_GAMMA_H__
+#define __INT_GAMMA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0gammad0(in1) dgammas(in1)
+#define s0gammas0(in1) sgammas(in1)
+#define d2gammad2(in1,size,out) dgammaa(in1,size[0]*size[1],out)
+#define s2gammas2(in1,size,out) sgammaa(in1,size[0]*size[1],out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_GAMMA_H__*/
diff --git a/src/c/specialFunctions/interfaces/int_gammaln.h b/src/c/specialFunctions/interfaces/int_gammaln.h
new file mode 100644
index 00000000..5be29f1e
--- /dev/null
+++ b/src/c/specialFunctions/interfaces/int_gammaln.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2017 - 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_GAMMALN_H__
+#define __INT_GAMMALN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0gammalnd0(in1) dgammalns(in1)
+#define s0gammalns0(in1) sgammalns(in1)
+#define d2gammalnd2(in1,size,out) dgammalna(in1,size[0]*size[1],out)
+#define s2gammalns2(in1,size,out) sgammalna(in1,size[0]*size[1],out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_GAMMALN_H__*/