diff options
Diffstat (limited to 'src/c')
1849 files changed, 69003 insertions, 114 deletions
diff --git a/src/c/CACSD/includes/lqe.h b/src/c/CACSD/includes/lqe.h new file mode 100644 index 00000000..1cc902fd --- /dev/null +++ b/src/c/CACSD/includes/lqe.h @@ -0,0 +1,26 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __LQE_H__ +#define __LQE_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +void dlqea(double* sys, int sys_rows, int sys_cols, double* X, double* K); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__LQE_H__*/ diff --git a/src/c/CACSD/includes/lqr.h b/src/c/CACSD/includes/lqr.h new file mode 100644 index 00000000..5b20ee83 --- /dev/null +++ b/src/c/CACSD/includes/lqr.h @@ -0,0 +1,26 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __LQR_H__ +#define __LQR_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +void dlqra(double* sys, int sys_rows, int sys_cols, double* Q, double* R, double* S, double* X, double* K); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__LQR_H__*/ diff --git a/src/c/CACSD/includes/obscont.h b/src/c/CACSD/includes/obscont.h new file mode 100644 index 00000000..f316adb5 --- /dev/null +++ b/src/c/CACSD/includes/obscont.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __OBSCONT_H__ +#define __OBSCONT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +void dobsconta(double* sys, int sys_rows, int sys_cols, double* Kc, double* Kf, \ + double *K, double *r); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__OBSCONT_H__*/ diff --git a/src/c/CACSD/includes/syslin.h b/src/c/CACSD/includes/syslin.h new file mode 100644 index 00000000..21b23294 --- /dev/null +++ b/src/c/CACSD/includes/syslin.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __SYSLIN_H__ +#define __SYSLIN_H__ + +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +void dsyslina(char* dom, double* A, int no_of_states, double* B, int no_of_inputs, \ + double* C, int no_of_outputs, double* D, double* X0, double* out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__SYSLIN_H__*/
\ No newline at end of file diff --git a/src/c/CACSD/interfaces/int_lqe.h b/src/c/CACSD/interfaces/int_lqe.h new file mode 100644 index 00000000..d801bf3e --- /dev/null +++ b/src/c/CACSD/interfaces/int_lqe.h @@ -0,0 +1,25 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_LQE_H__ +#define __INT_LQE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ss2lqed2d2(in1,size1,out1,out2) dlqea(in1,size1[0],size1[1],out1,out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_LQE_H__*/ diff --git a/src/c/CACSD/interfaces/int_lqr.h b/src/c/CACSD/interfaces/int_lqr.h new file mode 100644 index 00000000..8deba90b --- /dev/null +++ b/src/c/CACSD/interfaces/int_lqr.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_LQR_H__ +#define __INT_LQR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ss2lqrd2d2(in1,size1,out1,out2) dlqra(in1,size1[0],size1[1],NULL,\ + NULL,NULL,out1,out2); + +#define ss2d2d2lqrd2d2(in1,size1,in2,size2,in3,size3,out1,out2) dlqra(in1,\ + size1[0],size1[1],in2,in3,NULL,out1,out2); + +#define ss2d2d2d2lqrd2d2(in1,size1,in2,size2,in3,size3,in4,size4,out1,out2) \ + dlqra(in1,size1[0],size1[1],in2,in3,in4,out1,out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_LQR_H__*/ diff --git a/src/c/CACSD/interfaces/int_obscont.h b/src/c/CACSD/interfaces/int_obscont.h new file mode 100644 index 00000000..fd3a823c --- /dev/null +++ b/src/c/CACSD/interfaces/int_obscont.h @@ -0,0 +1,29 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_OBSCONT_H__ +#define __INT_OBSCONT_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define ss2d2d2obscontd2(in1,size1,in2,size2,in3,size3,out) \ + dobsconta(in1,size1[0],size1[1],in2,in3,out,NULL) + +#define ss2d2d2obscontd2d2(in1,size1,in2,size2,in3,size3,out1,out2) \ + dobsconta(in1,size1[0],size1[1],in2,in3,out1,out2) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_OBSCONT_H__*/ diff --git a/src/c/CACSD/interfaces/int_syslin.h b/src/c/CACSD/interfaces/int_syslin.h new file mode 100644 index 00000000..3f74ea6e --- /dev/null +++ b/src/c/CACSD/interfaces/int_syslin.h @@ -0,0 +1,78 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_SYSLIN_H__ +#define __INT_SYSLIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2d2d2d2syslinss2(in1,size1,in2,size2,in3,size3,in4,size4,out) \ + dsyslina(in1,in2,size2[0],in3,size3[1],in4,size4[0],NULL,NULL,out) + +#define g2d2d2d2d2syslinss2(in1,size1,in2,size2,in3,size3,in4,size4,in5, \ + size5,out) dsyslina(in1,in2,size2[0],in3,size3[1],in4,size4[0],in5,NULL,out) + +#define g2d2d2d2d2d2syslinss2(in1,size1,in2,size2,in3,size3,in4,size4, \ + in5,size5,in6,size6,out) dsyslina(in1,in2,size2[0],in3,size3[1],in4, \ + size4[0],in5,in6,out) +// +#define g2d0d0d0syslinss2(in1,size1,in2,in3,in4,out) \ + dsyslina(in1,&in2,1,&in3,1,&in4,1,NULL,NULL,out) + +#define g2d0d2d0syslinss2(in1,size1,in2,in3,size3,in4,out) \ + dsyslina(in1,&in2,1,in3,size3[1],&in4,1,NULL,NULL,out) + +#define g2d0d0d2syslinss2(in1,size1,in2,in3,in4,size4,out) \ + dsyslina(in1,&in2,1,&in3,1,in4,size4[0],NULL,NULL,out) + +#define g2d0d2d2syslinss2(in1,size1,in2,in3,size3,in4,size4,out) \ + dsyslina(in1,&in2,1,in3,size3[1],in4,size4[0],NULL,NULL,out) +// +#define g2d0d0d0d0syslinss2(in1,size1,in2,in3,in4,in5,out) \ + dsyslina(in1,&in2,1,&in3,1,&in4,1,&in5,NULL,out) + +#define g2d0d2d0d2syslinss2(in1,size1,in2,in3,size3,in4,in5,size5, \ + out) dsyslina(in1,&in2,1,in3,size3[1],&in4,1,&in5,NULL,out) + +#define g2d0d0d2d2syslinss2(in1,size1,in2,in3,in4,size4,in5,size5, \ + out) dsyslina(in1,&in2,1,&in3,1,in4,size4[0],in5,NULL,out) + +#define g2d0d2d2d2syslinss2(in1,size1,in2,in3,size3,in4,size4,in5, \ + size5, out) dsyslina(in1,&in2,1,in3,size3[1],in4,size4[0],in5,NULL,out) + +#define g2d2d2d2d0syslinss2(in1,size1,in2,size2,in3,size3,in4,size4, \ + in5,out) dsyslina(in1,in2,size2[0],in3,size3[1],in4,size4[0],&in5,NULL,out) +// +#define g2d0d0d0d0d0syslinss2(in1,size1,in2,in3,in4,in5,in6,out) \ + dsyslina(in1,&in2,1,&in3,1,&in4,1,&in5,&in6,out) + +#define g2d0d2d0d2d0syslinss2(in1,size1,in2,in3,size3,in4,in5,size5, \ + in6,out) dsyslina(in1,&in2,1,in3,size3[1],in4,1,in5,&in6,out) + +#define g2d0d0d2d2d0syslinss2(in1,size1,in2,in3,in4,size4,in5,size5, \ + in6,out) dsyslina(in1,&in2,1,in3,1,in4,size4[0],in5,&in6,out) + +#define g2d0d2d2d2d0syslinss2(in1,size1,in2,in3,size3,in4,size4,in5, \ + size5,in6,out) dsyslina(in1,&in2,1,in3,size3[1],in4,size4[0],in5,&in6,out) + +#define g2d2d2d2d0d2syslinss2(in1,size1,in2,size2,in3,size3,in4,size4, \ + in5,in6,size6,out) dsyslina(in1,in2,size2[0],in3,size3[1],in4,size4[0], \ + &in5,in6,out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /*__INT_SYSLIN_H__*/
\ No newline at end of file diff --git a/src/c/CACSD/lqe/dlqea.c b/src/c/CACSD/lqe/dlqea.c new file mode 100644 index 00000000..e0be5b34 --- /dev/null +++ b/src/c/CACSD/lqe/dlqea.c @@ -0,0 +1,60 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for calculating lqe gain. Refer 'lqe.sci' in scilab source.*/ + +#include <stdlib.h> +#include "lqr.h" +#include "matrixTranspose.h" + +void dlqea(double* sys, int sys_rows, int sys_cols, double* X, double* K) +{ + + double *sys_lqr, *K_lqr; + int row, col; + int sys_lqr_rows = sys_cols-2; + int sys_lqr_cols = sys_rows + 2; + int no_of_ip, no_of_st; + + no_of_ip = (int)sys[sys_rows*(sys_cols-1)+1]; + no_of_st = (int)sys[sys_rows*(sys_cols-1)]; + + /*Transpose given system and calculate LQR with new system. Transpose result + got from LQR*/ + + sys_lqr = (double*) malloc(sys_lqr_rows*sys_lqr_cols*sizeof(double)); + + for(col = 0; col<sys_lqr_cols; col++) + { + for(row = 0; row<sys_lqr_rows; row++) + { + sys_lqr[col*sys_lqr_rows+row] = sys[row*sys_rows+col]; + + } + } + + /*Copy initial states and type of system*/ + for(row = 0; row<sys_lqr_rows; row++) + { + sys_lqr[sys_lqr_rows*(sys_lqr_cols-2) + row] = sys[sys_rows*(sys_cols-2)+row]; + } + + /*Copy no of states and no of inputs*/ + sys_lqr[sys_lqr_rows*(sys_lqr_cols-1)] = no_of_st; + sys_lqr[sys_lqr_rows*(sys_lqr_cols-1)+1] = sys_rows - no_of_st; + + /*Calculate LQR gain*/ + K_lqr = (double*) malloc(no_of_ip*no_of_st*sizeof(double)); + dlqra(sys_lqr,sys_lqr_rows,sys_lqr_cols,NULL,NULL,NULL,X,K_lqr); + + dtransposea(K_lqr,sys_rows - no_of_st,no_of_st,K); +}
\ No newline at end of file diff --git a/src/c/CACSD/lqr/as_per_sci_code.c b/src/c/CACSD/lqr/as_per_sci_code.c new file mode 100644 index 00000000..01f002c3 --- /dev/null +++ b/src/c/CACSD/lqr/as_per_sci_code.c @@ -0,0 +1,144 @@ + + sizeBA = 2*no_of_states + no_of_inputs; + BigE = (double*) malloc (sizeBA*sizeBA*sizeof(double)); + BigA = (double*) malloc (sizeBA*sizeBA*sizeof(double)); + + /*Setup BigE*/ + deyea(BigE,sizeBA,sizeBA); + + for(row = no_of_states*2; row<sizeBA; row++) + { + BigE[row*sizeBA+row] = 0; + } + + /*Setup BigA*/ + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + BigA[col*sizeBA+row] = A[col*no_of_states + row]; + } + } + + for(col=no_of_states; col < no_of_states*2; col++) + { + for(row = 0; row < no_of_states; row++) + { + BigA[col*sizeBA+row] = 0; + } + } + + for(col=2*no_of_states; col < sizeBA; col++) + { + for(row = 0; row < no_of_states; row++) + { + BigA[col*sizeBA+row] = B[col*no_of_states + row]; + } + } + + for(col=0; col < no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + BigA[col*sizeBA+row] = -1.0*Q[col*no_of_states + row]; + } + } + + for(col=no_of_states; col < 2*no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + BigA[col*sizeBA+row] = -1.0*A[row*no_of_states + col]; + } + } + + for(col=2*no_of_states; col < sizeBA; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + BigA[col*sizeBA+row] = -1.0*S[row*no_of_inputs + col]; + } + } + + for(col=0; col < no_of_states; col++) + { + for(row = 2*no_of_states; row < sizeBA; row++) + { + BigA[col*sizeBA+row] = S[col*no_of_inputs + row]; + } + } + + for(col=no_of_states; col < 2*no_of_states; col++) + { + for(row = 2*no_of_states; row < sizeBA; row++) + { + BigA[col*sizeBA+row] = B[row*no_of_inputs + col]; + } + } + + + for(col=2*no_of_states; col < sizeBA; col++) + { + for(row = 2*no_of_states; row < sizeBA; row++) + { + BigA[col*sizeBA+row] = R[col*no_of_inputs + row]; + } + } + + /*Free up unwanted variables*/ + free(A); + free(C); + free(C_t); + free(D); + free(D_t); + free(Q); + + /*Inverse of R*/ + Ri = (double*) malloc(no_of_inputs*no_of_inputs*sizeof(double)); + dinverma(R,Ri,no_of_inputs); + + /*Setup Left*/ + Left = (double*) malloc(sizeBA*sizeBA*sizeof(double)); + deyea(Left,sizeBA,sizeBA); + + BRi = (double*) malloc(no_of_states*no_of_inputs*sizeof(double)); + S_t = (double*) malloc(no_of_states*no_of_inputs*sizeof(double)); + StRi = (double*) malloc(no_of_states*no_of_inputs*sizeof(double)); + + dtransposea(S,no_of_inputs,no_of_states,S_t); + dmula(B,no_of_states,no_of_inputs,Ri,no_of_inputs,no_of_inputs,BRi); + dmula(S_t,no_of_states,no_of_inputs,Ri,no_of_inputs,no_of_inputs,StRi); + + for(col=2*no_of_states; col < sizeBA; col++) + { + for(row = 0; row < no_of_states; row++) + { + Left[col*sizeBA+row] = -1.0*BRi[col*no_of_states + row]; + } + } + + for(col=2*no_of_states; col < sizeBA; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + Left[col*sizeBA+row] = StRi[col*no_of_states + row]; + } + } + + for(col=2*no_of_states; col < sizeBA; col++) + { + for(row = 2*no_of_states; row < sizeBA; row++) + { + Left[col*sizeBA+row] = Ri[col*no_of_states + row]; + } + } + + /*Freeup umwanted variables*/ + free(R); + free(BRi); + free(S_t); + free(StRi); + free(B); + + LA = (double*) malloc(sizeBA*sizeBA*sizeof(double)); + dmula(Left,sizeBA,sizeBA,BigA,sizeBA,sizeBA,LA);
\ No newline at end of file diff --git a/src/c/CACSD/lqr/dlqra.c b/src/c/CACSD/lqr/dlqra.c new file mode 100644 index 00000000..1440c3a8 --- /dev/null +++ b/src/c/CACSD/lqr/dlqra.c @@ -0,0 +1,362 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for calculating lqr gain. Refer 'lqr.sci' in scilab source.*/ + +#include <stdlib.h> +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include "eye.h" +#include "matrixInversion.h" +#include "subtraction.h" +#include "addition.h" +#include "schur.h" +#include "matrixDivision.h" + +void dlqra(double* sys, int sys_rows, int sys_cols, double* Q, double* R, \ + double* S, double* K, double* X) +{ + int no_of_states, no_of_inputs, no_of_outputs, dom = 1; + int row,col; + no_of_states = (int)sys[sys_rows*(sys_cols-1)]; + no_of_inputs = (int)sys[sys_rows*(sys_cols-1) + 1]; + no_of_outputs = sys_rows - no_of_states; + + double *A, *B, *C, *D; + double *B_t, *C_t, *D_t; + //double *Q, *R, *S; + double *Ri, *LA, *LE; + double *BRi, *StRi, *S_t; + double *buf1, *buf2, *buf3, *buf4, *buf5, *buf6; + + int ks; + double *wsmall, *X12, *phi12; + + A = (double*) malloc (no_of_states*no_of_states*sizeof(double)); + B = (double*) malloc (no_of_states*no_of_inputs*sizeof(double)); + C = (double*) malloc (no_of_states*no_of_outputs*sizeof(double)); + D = (double*) malloc (no_of_inputs*no_of_outputs*sizeof(double)); + + B_t = (double*) malloc (no_of_states*no_of_inputs*sizeof(double)); + C_t = (double*) malloc (no_of_states*no_of_outputs*sizeof(double)); + D_t = (double*) malloc (no_of_inputs*no_of_outputs*sizeof(double)); + + /*Get A from system matrix*/ + for(col = 0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + A[col*no_of_states + row] = sys[col*sys_rows + row]; + } + } + + /*Get matrix B from system matrix*/ + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_states; row++) + { + B[col * no_of_states + row] = \ + sys[col * sys_rows + no_of_states*sys_rows + row]; + } + } + + /*Get matrix C from system matrix*/ + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + C[col * no_of_outputs + row] = \ + sys[no_of_states + (col*sys_rows) + row]; + } + } + + /*Get matrix D from system matrix*/ + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + D[col * no_of_outputs + row] = \ + sys[(no_of_states+col)*sys_rows + no_of_states + row]; + } + } + + dom = (int)sys[(sys_rows*(sys_cols-2)) + no_of_states]; + + dtransposea(B,no_of_states,no_of_inputs,B_t); + dtransposea(C,no_of_outputs,no_of_states,C_t); + dtransposea(D,no_of_outputs,no_of_inputs,D_t); + + if(Q == NULL) + {/*If Q is not provided*/ + Q = (double*) malloc (no_of_states*no_of_states*sizeof(double)); + dmulma(C_t,no_of_states,no_of_outputs,C,no_of_outputs,no_of_states,Q); + } + + if(R == NULL) + {/*If R is not provided*/ + R = (double*) malloc (no_of_inputs*no_of_inputs*sizeof(double)); + dmulma(D_t,no_of_inputs,no_of_outputs,D,no_of_outputs,no_of_inputs,R); + } + + if(S == NULL) + {/*If Q is not provided*/ + S = (double*) malloc (no_of_inputs*no_of_states*sizeof(double)); + dmulma(D_t,no_of_inputs,no_of_outputs,C,no_of_outputs,no_of_states,S); + } + + /*Free up unwanted variables*/ + free(C); + free(C_t); + free(D); + free(D_t); + + + /*Inverse of R*/ + Ri = (double*) malloc(no_of_inputs*no_of_inputs*sizeof(double)); + dinverma(R,Ri,no_of_inputs); + + BRi = (double*) malloc(no_of_states*no_of_inputs*sizeof(double)); + S_t = (double*) malloc(no_of_states*no_of_inputs*sizeof(double)); + StRi = (double*) malloc(no_of_states*no_of_inputs*sizeof(double)); + + dtransposea(S,no_of_inputs,no_of_states,S_t); + dmulma(B,no_of_states,no_of_inputs,Ri,no_of_inputs,no_of_inputs,BRi); + dmulma(S_t,no_of_states,no_of_inputs,Ri,no_of_inputs,no_of_inputs,StRi); + + buf1 = (double*) malloc(no_of_states*no_of_states*sizeof(double)); + buf2 = (double*) malloc(no_of_states*no_of_states*sizeof(double)); + + if(dom == 1) + { + /*Setup LA*/ + LA = (double*) malloc(4*no_of_states*no_of_states*sizeof(double)); + /*Block 11 --> A - B*Ri*S*/ + dmulma(BRi,no_of_states,no_of_inputs,S,no_of_inputs,no_of_states,buf1); + ddiffa(A,no_of_states*no_of_states,buf1,no_of_states*no_of_states,buf2); + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + LA[col*2*no_of_states+row] = buf2[col*no_of_states + row]; + } + } + + /*Block 22= Block 11' --> -A' + S'*Ri*B'*/ + dtransposea(buf2,no_of_states,no_of_states,buf1); + for(col=no_of_states; col < 2*no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + LA[col*2*no_of_states+row] = \ + -1.0*buf1[(col-no_of_states)*no_of_states + (row-no_of_states)]; + } + } + + /*Block 12 --> -B*Ri*B'*/ + dmulma(BRi,no_of_states,no_of_inputs,B_t,no_of_inputs,no_of_states,buf1); + for(col=no_of_states; col < 2*no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + LA[col*2*no_of_states+row] = \ + -1.0*buf1[(col-no_of_states)*no_of_states + row]; + } + } + + /*Block 21 --> -Q + S'*Ri*S*/ + dmulma(StRi,no_of_states,no_of_inputs,S,no_of_inputs,no_of_states,buf1); + ddiffa(buf1,no_of_states*no_of_states,Q,no_of_states*no_of_states,buf2); + for(col=0; col < no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + LA[col*2*no_of_states+row] = \ + buf2[col*no_of_states + (row-no_of_states)]; + } + } + + + /*Freeup umwanted variables*/ + free(A); + //free(Q); + //free(R); + free(BRi); + free(S_t); + free(StRi); + free(B); + + /*Find schur decomposition of LA*/ + wsmall = (double*) malloc(4*no_of_states*no_of_states*sizeof(double)); + ks = (int)dschura(LA,2*no_of_states,1,2,wsmall,NULL); + + X12 = (double*) malloc(no_of_states*no_of_states*sizeof(double)); + phi12 = (double*) malloc(no_of_states*no_of_states*sizeof(double)); + + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + X12[col*no_of_states + row] = wsmall[col*2*no_of_states+row]; + } + } + + for(col=0; col < no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + phi12[col*no_of_states + (row-no_of_states)] = \ + wsmall[col*2*no_of_states+row]; + } + } + + drdivma(phi12,no_of_states,no_of_states,X12,no_of_states,no_of_states,X); + + buf3 = (double*) malloc(no_of_inputs*no_of_states*sizeof(double)); + buf4 = (double*) malloc(no_of_inputs*no_of_states*sizeof(double)); + + dmulma(B_t,no_of_inputs,no_of_states,X,no_of_states,no_of_states,buf3); + dadda(buf3,no_of_inputs*no_of_states,S,no_of_inputs*no_of_states,buf4); + dmulma(Ri,no_of_inputs,no_of_inputs,buf4,no_of_inputs,no_of_states,buf3); + + for(row = 0;row<no_of_inputs*no_of_states;row++) + { + K[row] = -buf3[row]; + } + + } + else if(dom == 2) + { + /*Setup LA and LE*/ + LA = (double*) malloc(4*no_of_states*no_of_states*sizeof(double)); + deyea(LA,2*no_of_states,2*no_of_states); + LE = (double*) malloc(4*no_of_states*no_of_states*sizeof(double)); + deyea(LE,2*no_of_states,2*no_of_states); + + /*Block 11 --> A - B*Ri*S*/ + dmulma(BRi,no_of_states,no_of_inputs,S,no_of_inputs,no_of_states,buf1); + ddiffa(A,no_of_states*no_of_states,buf1,no_of_states*no_of_states,buf2); + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + LA[col*2*no_of_states+row] = buf2[col*no_of_states + row]; + } + } + + /*Block 22= Block 11' --> A' - S'*Ri*B'*/ + dtransposea(buf2,no_of_states,no_of_states,buf1); + for(col=no_of_states; col < 2*no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + LE[col*2*no_of_states+row] = \ + buf1[(col-no_of_states)*no_of_states + (row-no_of_states)]; + } + } + + /*Block 21 --> -Q + S'*Ri*S*/ + dmulma(StRi,no_of_states,no_of_inputs,S,no_of_inputs,no_of_states,buf1); + ddiffa(buf1,no_of_states*no_of_states,Q,no_of_states*no_of_states,buf2); + for(col=0; col < no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + LA[col*2*no_of_states+row] = \ + buf2[col*no_of_states + (row-no_of_states)]; + } + } + + + /*Block 12 --> B*Ri*B'*/ + dmulma(BRi,no_of_states,no_of_inputs,B_t,no_of_inputs,no_of_states,buf1); + for(col=no_of_states; col < 2*no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + LE[col*2*no_of_states+row] = \ + buf1[(col-no_of_states)*no_of_states + row]; + } + } + + + //free(Q); + free(BRi); + free(S_t); + free(StRi); + + /*Find schur decomposition of LA*/ + wsmall = (double*) malloc(4*no_of_states*no_of_states*sizeof(double)); + ks = (int)dgschura(LA,2*no_of_states,LE,2,2,wsmall,NULL,NULL,NULL); + + X12 = (double*) malloc(no_of_states*no_of_states*sizeof(double)); + phi12 = (double*) malloc(no_of_states*no_of_states*sizeof(double)); + + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + X12[col*no_of_states + row] = wsmall[col*2*no_of_states+row]; + } + } + + for(col=0; col < no_of_states; col++) + { + for(row = no_of_states; row < 2*no_of_states; row++) + { + phi12[col*no_of_states + (row-no_of_states)] = \ + wsmall[col*2*no_of_states+row]; + } + } + + drdivma(phi12,no_of_states,no_of_states,X12,no_of_states,no_of_states,X); + + buf5 = (double*) malloc(no_of_inputs*no_of_inputs*sizeof(double)); + buf6 = (double*) malloc(no_of_inputs*no_of_inputs*sizeof(double)); + buf3 = (double*) malloc(no_of_inputs*no_of_states*sizeof(double)); + buf4 = (double*) malloc(no_of_inputs*no_of_states*sizeof(double)); + + /*inv(B'XB+R)*/ + dmulma(B_t,no_of_inputs,no_of_states,X,no_of_states,no_of_states,buf3); + dmulma(buf3,no_of_inputs,no_of_states,B,no_of_states,no_of_inputs,buf6); + dadda(buf6,no_of_inputs*no_of_inputs,R,no_of_inputs*no_of_inputs,buf5); + dinverma(buf5,buf6,no_of_inputs); + /*B'XA+S*/ + dmulma(B_t,no_of_inputs,no_of_states,X,no_of_states,no_of_states,buf3); + dmulma(buf3,no_of_inputs,no_of_states,A,no_of_states,no_of_states,buf4); + dadda(buf4,no_of_inputs*no_of_states,S,no_of_inputs*no_of_states,buf3); + + dmulma(buf6,no_of_inputs,no_of_inputs,buf3,no_of_inputs,no_of_states,buf4); + + for(row = 0;row<no_of_inputs*no_of_states;row++) + { + K[row] = -buf4[row]; + } + + free(A); + free(B); + //free(R); + free(buf5); + free(buf6); + + } + + free(B_t); + //free(S); + free(wsmall); + free(X12); + free(phi12); + free(buf1); + free(buf2); + free(buf3); + free(buf4); + +}
\ No newline at end of file diff --git a/src/c/CACSD/obscont/dobsconta.c b/src/c/CACSD/obscont/dobsconta.c new file mode 100644 index 00000000..c67b70e2 --- /dev/null +++ b/src/c/CACSD/obscont/dobsconta.c @@ -0,0 +1,284 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for calculating observer controller. + Refer 'obscont.sci' in scilab source.*/ + +#include <stdlib.h> +#include "matrixMultiplication.h" +#include "addition.h" + +void dobsconta(double* sys, int sys_rows, int sys_cols, double* Kc, double* Kf, \ + double *K, double *r) +{ + int no_of_states, no_of_inputs, no_of_outputs, dom = 1; + int row,col; + no_of_states = (int)sys[sys_rows*(sys_cols-1)]; + no_of_inputs = (int)sys[sys_rows*(sys_cols-1) + 1]; + no_of_outputs = sys_rows - no_of_states; + + int no_of_cols; + int no_of_rows; + + double *A, *B, *C, *D; + double *BKc, *KfC, *KfD,*DKc; + double *buf, *buf1, *buf2; + + A = (double*) malloc (no_of_states*no_of_states*sizeof(double)); + B = (double*) malloc (no_of_states*no_of_inputs*sizeof(double)); + C = (double*) malloc (no_of_states*no_of_outputs*sizeof(double)); + D = (double*) malloc (no_of_inputs*no_of_outputs*sizeof(double)); + + BKc = (double*) malloc (no_of_states*no_of_states*sizeof(double)); + KfC = (double*) malloc (no_of_states*no_of_states*sizeof(double)); + KfD = (double*) malloc (no_of_states*no_of_inputs*sizeof(double)); + DKc = (double*) malloc (no_of_outputs*no_of_states*sizeof(double)); + buf = (double*) malloc (no_of_states*no_of_states*sizeof(double)); + buf1 = (double*) malloc (no_of_states*no_of_inputs*sizeof(double)); + buf2 = (double*) malloc (no_of_outputs*no_of_states*sizeof(double)); + + /*Get A from system matrix*/ + for(col = 0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + A[col*no_of_states + row] = sys[col*sys_rows + row]; + } + } + + /*Get matrix B from system matrix*/ + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_states; row++) + { + B[col * no_of_states + row] = \ + sys[col * sys_rows + no_of_states*sys_rows + row]; + } + } + + /*Get matrix C from system matrix*/ + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + C[col * no_of_outputs + row] = \ + sys[no_of_states + (col*sys_rows) + row]; + } + } + + /*Get matrix D from system matrix*/ + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + D[col * no_of_outputs + row] = \ + sys[(no_of_states+col)*sys_rows + no_of_states + row]; + } + } + + dom = (int)sys[(sys_rows*(sys_cols-2)) + no_of_states]; + + dmulma(B,no_of_states,no_of_inputs,Kc,no_of_inputs,no_of_states,BKc); + dmulma(Kf,no_of_states,no_of_outputs,C,no_of_outputs,no_of_states,KfC); + dmulma(Kf,no_of_states,no_of_outputs,D,no_of_outputs,no_of_inputs,KfD); + + /*Variables are reused to save memory*/ + /*A+BKc*/ + dadda(A,no_of_states*no_of_states,BKc,no_of_states*no_of_states,buf); + /*A+BKc+KfC*/ + dadda(KfC,no_of_states*no_of_states,buf,no_of_states*no_of_states,A); + /*KfDKc*/ + dmulma(KfD,no_of_states,no_of_inputs,Kc,no_of_inputs,no_of_states,BKc); + /*A+BKc+KfC+KfDKc*/ + dadda(A,no_of_states*no_of_states,BKc,no_of_states*no_of_states,buf); + + /*Dimensions of K*/ + no_of_cols = no_of_states + no_of_inputs + 2; + no_of_rows = no_of_states + no_of_outputs; + + if(r == NULL) + { + /*Dimensions of K*/ + no_of_cols = no_of_states + no_of_outputs + 2; + no_of_rows = no_of_states + no_of_inputs; + + for(col = 0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + K[col*no_of_rows + row] = buf[col*no_of_states + row]; + } + + } + + /*Copy matrix -Kf in out matrix*/ + for(col=0; col < no_of_outputs; col++) + { + for(row = 0; row < no_of_states; row++) + { + K[col * no_of_rows + no_of_states*no_of_rows + row] \ + = -1.0*Kf[col * no_of_states + row]; + } + } + + /*Copy matrix Kc in out matrix*/ + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_inputs; row++) + { + K[no_of_states + (col*no_of_rows) + row] = Kc[col * no_of_inputs + row]; + } + } + + K[(no_of_rows*(no_of_cols-2)) + no_of_states] = dom; + /*Insert no of states and inputs in last column*/ + K[(no_of_rows*(no_of_cols-1))] = no_of_states; + K[(no_of_rows*(no_of_cols-1))+1] = no_of_outputs; + /*For K, no_of_outputs is no of inputs*/ + + } + else + { + /*Dimensions of K*/ + no_of_cols = no_of_states + no_of_inputs + no_of_outputs + 2; + no_of_rows = no_of_states + no_of_outputs + no_of_inputs; + + r[0] = no_of_outputs; + r[1] = no_of_inputs; + + for(col = 0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + K[col*no_of_rows + row] = buf[col*no_of_states + row]; + } + + } + + /*Copy matrix -Kf in out matrix*/ + for(col=0; col < no_of_outputs; col++) + { + for(row = 0; row < no_of_states; row++) + { + K[col * no_of_rows + no_of_states*no_of_rows + row] \ + = -1.0*Kf[col * no_of_states + row]; + } + } + + /*B+Kf*D*/ + dadda(B,no_of_states*no_of_inputs,KfD,no_of_states*no_of_inputs,buf1); + + /*Copy matrix (B+KfD) in out matrix*/ + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_states; row++) + { + K[col * no_of_rows + (no_of_states+no_of_outputs)*no_of_rows \ + + row] = buf1[col * no_of_states + row]; + } + } + + /*DKc*/ + dmulma(D,no_of_outputs,no_of_inputs,Kc,no_of_inputs,no_of_states,DKc); + /*C+DKc*/ + dadda(C,no_of_outputs*no_of_states,DKc,no_of_outputs*no_of_states,buf2); + + /*Copy matrix Kc in out matrix*/ + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_inputs; row++) + { + K[no_of_states + (col*no_of_rows) + row] \ + = Kc[col * no_of_inputs + row]; + } + } + + /*Copy -(C+DKc) in out matrix*/ + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + K[(no_of_states+no_of_inputs) + (col*no_of_rows) + row] \ + = -1.0*buf2[col * no_of_outputs + row]; + } + } + + /*Block 22 for K*/ + for(col=0; col < no_of_outputs; col++) + { + for(row = 0; row < no_of_inputs; row++) + { + K[no_of_states + (col*no_of_rows) + no_of_states*no_of_rows \ + + row] = 0; + } + } + + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_inputs; row++) + { + if(row == col) + K[no_of_states + (col*no_of_rows) + \ + (no_of_states+no_of_outputs)*no_of_rows + row] = 1; + else + K[no_of_states + (col*no_of_rows) + \ + (no_of_states+no_of_outputs)*no_of_rows + row] = 0; + } + } + + for(col=0; col < no_of_outputs; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + if(row == col) + K[no_of_states + no_of_inputs + (col*no_of_rows) + \ + no_of_states*no_of_rows + row] = 1; + else + K[no_of_states + no_of_inputs + (col*no_of_rows) + \ + no_of_states*no_of_rows + row] = 0; + } + } + + + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + K[no_of_states + no_of_inputs + (col*no_of_rows) + \ + (no_of_states+no_of_outputs)*no_of_rows + row] \ + = -1.0*D[col*no_of_inputs + row]; + } + } + + + K[(no_of_rows*(no_of_cols-2))+ no_of_states] = dom; + /*Insert no of states and inputs in last column*/ + K[(no_of_rows*(no_of_cols-1))] = no_of_states; + K[(no_of_rows*(no_of_cols-1))+1] = no_of_outputs + no_of_inputs; + /*For K, (no_of_outputs+no_of_inputs) is no of inputs*/ + + + } + + + free(A); + free(B); + free(C); + free(D); + free(BKc); + free(KfC); + free(KfD); + free(DKc); + free(buf); + free(buf1); + free(buf2); +} diff --git a/src/c/CACSD/syslin/dsyslina.c b/src/c/CACSD/syslin/dsyslina.c new file mode 100644 index 00000000..3c20c65c --- /dev/null +++ b/src/c/CACSD/syslin/dsyslina.c @@ -0,0 +1,107 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for declaring state space system*/ +/*output structure is as follows : + | A B X0 | + | C D dom| + where dom is 1 for 'c' and 2 for 'd' + Another column is appended with no_of_states and no_inputs as its elements */ + + + +#include <stdlib.h> + +void dsyslina(char* dom, double* A, int no_of_states, double* B, int no_of_inputs, \ + double* C, int no_of_outputs, double* D, double* X0, double* out) +{ + int row = 0,col = 0; + int no_of_cols = no_of_states + no_of_inputs + 2; + int no_of_rows = no_of_states + no_of_outputs; + /*Copy matrix A into out matrix*/ + for(col = 0; col < no_of_states; col++) + { + for(row = 0; row < no_of_states; row++) + { + out[col*no_of_rows + row] = A[col*no_of_states + row]; + } + + } + + /*Copy matrix B in out matrix*/ + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_states; row++) + { + out[col * no_of_rows + no_of_states*no_of_rows + row] \ + = B[col * no_of_states + row]; + } + } + + /*Copy matrix C in out matrix*/ + for(col=0; col < no_of_states; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + out[no_of_states + (col*no_of_rows) + row] = C[col * no_of_outputs + row]; + } + } + + /*Copy matrix D in out matrix*/ + if( D != NULL) + { + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + out[(no_of_states+col)*no_of_rows + no_of_states + row] = \ + D[col * no_of_outputs + row]; + } + } + } + else + { + for(col=0; col < no_of_inputs; col++) + { + for(row = 0; row < no_of_outputs; row++) + { + out[(no_of_states+col)*no_of_rows + no_of_states + row] = 0; + } + } + } + + /*Copy matrix X0 in out matrix*/ + if( X0 != NULL) + { + for(row = 0; row < no_of_states; row++) + { + out[(no_of_rows*(no_of_cols-1))+row] = X0[row]; + } + } + else + { + for(row = 0; row < no_of_states; row++) + { + out[(no_of_rows*(no_of_cols-1))+row] = 0; + } + } + + if(*dom == 'c') + out[(no_of_rows*(no_of_cols-2)) + no_of_states] = 1; + else if(*dom == 'd') + out[(no_of_rows*(no_of_cols-2)) + no_of_states] = 2; + + /*Insert no of states and inputs in last column*/ + out[(no_of_rows*(no_of_cols-1))] = no_of_states; + out[(no_of_rows*(no_of_cols-1))+1] = no_of_inputs; + +}
\ No newline at end of file diff --git a/src/c/Files/includes/files.h b/src/c/Files/includes/files.h new file mode 100644 index 00000000..4491e7e6 --- /dev/null +++ b/src/c/Files/includes/files.h @@ -0,0 +1,47 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __FILES_H__ +#define __FILES_H__ + +#include <stdio.h> +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +FILE *mopen (char *path, char *mode); + +int mclose(FILE *fptr); + +/*For writing single/scalar values*/ +int dmputs (FILE *fptr, double data); +int smputs (FILE *fptr, float data); +int u8mputs (FILE *fptr, uint8 data); +int i8mputs (FILE *fptr, int8 data); +int u16mputs (FILE *fptr, uint16 data); +int i16mputs (FILE *fptr, int16 data); + +/*For writing array/matrix values*/ +int dmputa (FILE *fptr, double *data, int row, int col); +int smputa (FILE *fptr, float *data, int row, int col); +int u8mputa (FILE *fptr, uint8 *data, int row, int col); +int i8mputa (FILE *fptr, int8 *data, int row, int col); +int u16mputa (FILE *fptr, uint16 *data, int row, int col); +int i16mputa (FILE *fptr, int16 *data, int row, int col); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__FILES_H__*/ diff --git a/src/c/Files/interfaces/int_files.h b/src/c/Files/interfaces/int_files.h new file mode 100644 index 00000000..862754fc --- /dev/null +++ b/src/c/Files/interfaces/int_files.h @@ -0,0 +1,58 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_FILES_H__ +#define __INT_FILES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2mopenf0(path, pathsize, mode, modesize) mopen(path, mode) + +#define f0mclosei0(fptr) mclose(fptr) + +#define d0g2f0mputi0(data, format, formatsize, fptr) dmputs(fptr, data) + +#define s0g2f0mputi0(data, format, formatsize, fptr) smputs(fptr, data) + +#define u80g2f0mputi0(data, format, formatsize, fptr) u8mputs(fptr, data) + +#define i80g2f0mputi0(data, format, formatsize, fptr) i8mputs(fptr, data) + +#define u160g2f0mputi0(data, format, formatsize, fptr) u16mputs(fptr, data) + +#define i160g2f0mputi0(data, format, formatsize, fptr) i16mputs(fptr, data) + +#define d2g2f0mputi0(data, size1, format, formatsize, fptr) \ + dmputa(fptr, data, size1[0], size1[1]) + +#define s2g2f0mputi0(data, size1, format, formatsize, fptr) \ + smputa(fptr, data, size1[0], size1[1]) + +#define u82g2f0mputi0(data, size1, format, formatsize, fptr) \ + u8mputa(fptr, data, size1[0], size1[1]) + +#define i82g2f0mputi0(data, size1, format, formatsize, fptr) \ + i8mputa(fptr, data, size1[0], size1[1]) + +#define u162g2f0mputi0(data, size1, format, formatsize, fptr) \ + u16mputa(fptr, data, size1[0], size1[1]) + +#define i162g2f0mputi0(data, size1, format, formatsize, fptr) \ + i16mputa(fptr, data, size1[0], size1[1]) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_FILES_H__*/ diff --git a/src/c/Files/mclose/mclose.c b/src/c/Files/mclose/mclose.c new file mode 100644 index 00000000..5e689358 --- /dev/null +++ b/src/c/Files/mclose/mclose.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to close file pointed by input file handle*/ + +#include "files.h" + +int mclose(FILE *fptr) +{ + int res; + res = fclose(fptr); + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mopen/mopen.c b/src/c/Files/mopen/mopen.c new file mode 100644 index 00000000..1cb1c880 --- /dev/null +++ b/src/c/Files/mopen/mopen.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to open a file and obtain handle for the same */ + +#include "files.h" + +FILE *mopen (char *path, char *mode) +{ + FILE *fptr; + + fptr = fopen(path, mode); + + return fptr; +}
\ No newline at end of file diff --git a/src/c/Files/mput/dmputa.c b/src/c/Files/mput/dmputa.c new file mode 100644 index 00000000..9cb6482b --- /dev/null +++ b/src/c/Files/mput/dmputa.c @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'double' array/matrix in given file */ + +#include "files.h" + +int dmputa (FILE *fptr, double *data, int row, int col) +{ + int res = 0, row_ctr, col_ctr; + + if(fptr != NULL) + { + for(row_ctr = 0; row_ctr < row; row_ctr++) + { + for(col_ctr = 0; col_ctr < col; col_ctr++) + { + res += fprintf(fptr, "%f ", data[row*col_ctr+row_ctr]); + } + fprintf(fptr, "\n"); + } + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/dmputs.c b/src/c/Files/mput/dmputs.c new file mode 100644 index 00000000..42780059 --- /dev/null +++ b/src/c/Files/mput/dmputs.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'double' scalar in given file */ + +#include <stdio.h> + +int dmputs (FILE *fptr, double data) +{ + int res; + + + if(fptr != NULL) + { + res = fprintf(fptr, "%f", data); + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/i16mputa.c b/src/c/Files/mput/i16mputa.c new file mode 100644 index 00000000..daa07bf8 --- /dev/null +++ b/src/c/Files/mput/i16mputa.c @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'int16' array/matrix in given file */ + +#include "files.h" + +int i16mputa (FILE *fptr, int16 *data, int row, int col) +{ + int res = 0, row_ctr, col_ctr; + + if(fptr != NULL) + { + for(row_ctr = 0; row_ctr < row; row_ctr++) + { + for(col_ctr = 0; col_ctr < col; col_ctr++) + { + res += fprintf(fptr, "%d ", data[row*col_ctr+row_ctr]); + } + fprintf(fptr, "\n"); + } + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/i16mputs.c b/src/c/Files/mput/i16mputs.c new file mode 100644 index 00000000..43194f1f --- /dev/null +++ b/src/c/Files/mput/i16mputs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'int16' scalar in given file */ + +#include "files.h" + +int i16mputs (FILE *fptr, int16 data) +{ + int res; + + if(fptr != NULL) + { + res = fprintf(fptr, "%d\n", data); + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/i8mputa.c b/src/c/Files/mput/i8mputa.c new file mode 100644 index 00000000..50da3989 --- /dev/null +++ b/src/c/Files/mput/i8mputa.c @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'int8' array/matrix in given file */ + +#include "files.h" + +int i8mputa (FILE *fptr, int8 *data, int row, int col) +{ + int res = 0, row_ctr, col_ctr; + + if(fptr != NULL) + { + for(row_ctr = 0; row_ctr < row; row_ctr++) + { + for(col_ctr = 0; col_ctr < col; col_ctr++) + { + res += fprintf(fptr, "%d ", data[row*col_ctr+row_ctr]); + } + fprintf(fptr, "\n"); + } + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/i8mputs.c b/src/c/Files/mput/i8mputs.c new file mode 100644 index 00000000..1884bf2f --- /dev/null +++ b/src/c/Files/mput/i8mputs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'int8' scalar in given file */ + +#include "files.h" + +int i8mputs (FILE *fptr, int8 data) +{ + int res; + + if(fptr != NULL) + { + res = fprintf(fptr, "%d\n", data); + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/smputa.c b/src/c/Files/mput/smputa.c new file mode 100644 index 00000000..03098a78 --- /dev/null +++ b/src/c/Files/mput/smputa.c @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'float' array/matrix in given file */ + +#include "files.h" + +int smputa (FILE *fptr, float *data, int row, int col) +{ + int res = 0, row_ctr, col_ctr; + + if(fptr != NULL) + { + for(row_ctr = 0; row_ctr < row; row_ctr++) + { + for(col_ctr = 0; col_ctr < col; col_ctr++) + { + res += fprintf(fptr, "%f ", data[row*col_ctr+row_ctr]); + } + fprintf(fptr, "\n"); + } + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/smputs.c b/src/c/Files/mput/smputs.c new file mode 100644 index 00000000..10eeb7b5 --- /dev/null +++ b/src/c/Files/mput/smputs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'float' scalar in given file */ + +#include "files.h" + +int smputs (FILE *fptr, float data) +{ + int res; + + if(fptr != NULL) + { + res = fprintf(fptr, "%f\n", data); + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/u16mputa.c b/src/c/Files/mput/u16mputa.c new file mode 100644 index 00000000..e2d2d8fe --- /dev/null +++ b/src/c/Files/mput/u16mputa.c @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'uint16' array/matrix in given file */ + +#include "files.h" + +int u16mputa (FILE *fptr, uint16 *data, int row, int col) +{ + int res = 0, row_ctr, col_ctr; + + if(fptr != NULL) + { + for(row_ctr = 0; row_ctr < row; row_ctr++) + { + for(col_ctr = 0; col_ctr < col; col_ctr++) + { + res += fprintf(fptr, "%d ", data[row*col_ctr+row_ctr]); + } + fprintf(fptr, "\n"); + } + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/u16mputs.c b/src/c/Files/mput/u16mputs.c new file mode 100644 index 00000000..46b95221 --- /dev/null +++ b/src/c/Files/mput/u16mputs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'uint16' scalar in given file */ + +#include "files.h" + +int u16mputs (FILE *fptr, uint16 data) +{ + int res; + + if(fptr != NULL) + { + res = fprintf(fptr, "%d\n", data); + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/u8mputa.c b/src/c/Files/mput/u8mputa.c new file mode 100644 index 00000000..d2baee16 --- /dev/null +++ b/src/c/Files/mput/u8mputa.c @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'uint8' array/matrix in given file */ + +#include "files.h" + +int u8mputa (FILE *fptr, uint8 *data, int row, int col) +{ + int res = 0, row_ctr, col_ctr; + + if(fptr != NULL) + { + for(row_ctr = 0; row_ctr < row; row_ctr++) + { + for(col_ctr = 0; col_ctr < col; col_ctr++) + { + res += fprintf(fptr, "%d ", data[row*col_ctr+row_ctr]); + } + fprintf(fptr, "\n"); + } + } + return res; +}
\ No newline at end of file diff --git a/src/c/Files/mput/u8mputs.c b/src/c/Files/mput/u8mputs.c new file mode 100644 index 00000000..a53179e9 --- /dev/null +++ b/src/c/Files/mput/u8mputs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function ot write 'uint8' scalar in given file */ + +#include "files.h" + +int u8mputs (FILE *fptr, uint8 data) +{ + int res; + + if(fptr != NULL) + { + res = fprintf(fptr, "%d\n", data); + } + return res; +}
\ No newline at end of file diff --git a/src/c/auxiliaryFunctions/abs/i16absa.c b/src/c/auxiliaryFunctions/abs/i16absa.c new file mode 100644 index 00000000..2abedc47 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i16absa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +void i16absa(int16 *in, int size, int16* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i16abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/i16abss.c b/src/c/auxiliaryFunctions/abs/i16abss.c new file mode 100644 index 00000000..ab478333 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i16abss.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +int16 i16abss(int16 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/i8absa.c b/src/c/auxiliaryFunctions/abs/i8absa.c new file mode 100644 index 00000000..1a646e4a --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i8absa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +void i8absa(int8 *in, int size, int8* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i8abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/i8abss.c b/src/c/auxiliaryFunctions/abs/i8abss.c new file mode 100644 index 00000000..2c3e0a04 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i8abss.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +int8 i8abss(int8 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/u16absa.c b/src/c/auxiliaryFunctions/abs/u16absa.c new file mode 100644 index 00000000..60c1ed96 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u16absa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +void u16absa(uint16 *in, int size, uint16* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u16abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/u16abss.c b/src/c/auxiliaryFunctions/abs/u16abss.c new file mode 100644 index 00000000..2e15d25f --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u16abss.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +uint16 u16abss(uint16 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/u8absa.c b/src/c/auxiliaryFunctions/abs/u8absa.c new file mode 100644 index 00000000..2edd8541 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u8absa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +void u8absa(uint8 *in, int size, uint8* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u8abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/u8abss.c b/src/c/auxiliaryFunctions/abs/u8abss.c new file mode 100644 index 00000000..220e9b8c --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u8abss.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "abs.h" + +uint8 u8abss(uint8 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/zabss.c b/src/c/auxiliaryFunctions/abs/zabss.c index 4e7b4dd3..7ada57d1 100644 --- a/src/c/auxiliaryFunctions/abs/zabss.c +++ b/src/c/auxiliaryFunctions/abs/zabss.c @@ -16,6 +16,7 @@ #include "sqrt.h" #include "max.h" #include "min.h" +#include "doubleComplex.h" double zabss(doubleComplex in) { double real = dabss(zreals(in)); diff --git a/src/c/auxiliaryFunctions/find/i16finda.c b/src/c/auxiliaryFunctions/find/i16finda.c new file mode 100644 index 00000000..4dff1020 --- /dev/null +++ b/src/c/auxiliaryFunctions/find/i16finda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "find.h" + +void i16finda(int16* x, int size, int16 *out, int max) +{ + int i = 0; + int j = 0; + + /* if out is empty */ + out[0]=-1; + + + for (i = 0; i < size ; ++i) + { + /*to avoid useless search if we only want to find the max first founded value */ + if (j == max) + { + return ; + } + + if (x[i] != 0) + { + out[j] = (int16)(i+1); + ++j; + } + } +} + diff --git a/src/c/auxiliaryFunctions/find/i8finda.c b/src/c/auxiliaryFunctions/find/i8finda.c new file mode 100644 index 00000000..7e633dc1 --- /dev/null +++ b/src/c/auxiliaryFunctions/find/i8finda.c @@ -0,0 +1,40 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "find.h" + +void i8finda(int8* x, int size, int8 *out, int max) +{ + int i = 0; + int j = 0; + + /* if out is empty */ + out[0]=-1; + + + for (i = 0; i < size ; ++i) + { + /*to avoid useless search if we only want to find the max first founded value */ + if (j == max) + { + return ; + } + + if (x[i] != 0) + { + out[j] = (int8)(i+1); + ++j; + } + } +} + diff --git a/src/c/auxiliaryFunctions/find/u16finda.c b/src/c/auxiliaryFunctions/find/u16finda.c new file mode 100644 index 00000000..2ff57869 --- /dev/null +++ b/src/c/auxiliaryFunctions/find/u16finda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "find.h" + +void u16finda(uint16* x, int size, uint16 *out, int max) +{ + int i = 0; + int j = 0; + + /* if out is empty */ + out[0]=-1; + + + for (i = 0; i < size ; ++i) + { + /*to avoid useless search if we only want to find the max first founded value */ + if (j == max) + { + return ; + } + + if (x[i] != 0) + { + out[j] = (uint16)(i+1); + ++j; + } + } +} + diff --git a/src/c/auxiliaryFunctions/find/u8finda.c b/src/c/auxiliaryFunctions/find/u8finda.c new file mode 100644 index 00000000..e2de81fa --- /dev/null +++ b/src/c/auxiliaryFunctions/find/u8finda.c @@ -0,0 +1,40 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "find.h" + +void u8finda(uint8* x, int size, uint8 *out, int max) +{ + int i = 0; + int j = 0; + + /* if out is empty */ + out[0]=-1; + + + for (i = 0; i < size ; ++i) + { + /*to avoid useless search if we only want to find the max first founded value */ + if (j == max) + { + return ; + } + + if (x[i] != 0) + { + out[j] = (uint8)(i+1); + ++j; + } + } +} + diff --git a/src/c/auxiliaryFunctions/includes/abs.h b/src/c/auxiliaryFunctions/includes/abs.h index 00565e39..cd022905 100644 --- a/src/c/auxiliaryFunctions/includes/abs.h +++ b/src/c/auxiliaryFunctions/includes/abs.h @@ -17,6 +17,7 @@ #include "floatComplex.h" #include "doubleComplex.h" #include "sqrt.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -55,6 +56,38 @@ EXTERN_AUXFUNCT float cabss(floatComplex in); EXTERN_AUXFUNCT double zabss(doubleComplex in); /** + ** \brief Uint8 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the uint8 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT uint8 u8abss(uint8 in); + +/** + ** \brief Int8 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the int8 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT int8 i8abss(int8 in); + +/** + ** \brief Uint16 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the uint16 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT uint16 u16abss(uint16 in); + +/** + ** \brief Int16 Absolute Value function + ** Determine the absolute value of in. + ** \param in : the int16 we must determine abs. + ** \return -in or in depending on the sign of in. + **/ +EXTERN_AUXFUNCT int16 i16abss(int16 in); + +/** ** \brief Float Array Absolute Value function ** Determine the absolute value of in elements. ** \param in : the float array we must determine abs. @@ -86,6 +119,40 @@ EXTERN_AUXFUNCT void cabsa(floatComplex *in, int size, float* out); **/ EXTERN_AUXFUNCT void zabsa(doubleComplex *in, int size, double* out); + +/** + ** \brief Uint8 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the uint8 array we must determine abs. + ** \param out : the uint8 array result. + **/ +EXTERN_AUXFUNCT void u8absa(uint8 *in, int size, uint8* out); + +/** + ** \brief Int8 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the int8 array we must determine abs. + ** \param out : the int8 array result. + **/ +EXTERN_AUXFUNCT void i8absa(int8 *in, int size, int8* out); + +/** + ** \brief Uint16 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the uint16 array we must determine abs. + ** \param out : the uint16 array result. + **/ +EXTERN_AUXFUNCT void u16absa(uint16 *in, int size, uint16* out); + +/** + ** \brief Int16 Array Absolute Value function + ** Determine the absolute value of in elements. + ** \param in : the int16 array we must determine abs. + ** \param out : the int16 array result. + **/ +EXTERN_AUXFUNCT void i16absa(int16 *in, int size, int16* out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/auxiliaryFunctions/includes/find.h b/src/c/auxiliaryFunctions/includes/find.h index 3104e957..8072f745 100644 --- a/src/c/auxiliaryFunctions/includes/find.h +++ b/src/c/auxiliaryFunctions/includes/find.h @@ -16,6 +16,7 @@ #include "dynlib_auxiliaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -44,6 +45,32 @@ EXTERN_AUXFUNCT void cfinda(floatComplex* z, int size, float *out, int max); */ EXTERN_AUXFUNCT void zfinda(doubleComplex* z, int size, double *out, int max); +/* +** \brief uint8 Find function +** max is an integer giving the maximum number of indices to return. (use -1 to search them all) +*/ +EXTERN_AUXFUNCT void u8finda(uint8 *x, int size, uint8 *out, int max); + +/* +** \brief uint16 Find function +** max is an integer giving the maximum number of indices to return. (use -1 to search them all) +*/ +EXTERN_AUXFUNCT void u16finda(uint16 *x, int size, uint16 *out, int max); + +/* +** \brief int8 Find function +** max is an integer giving the maximum number of indices to return. (use -1 to search them all) +*/ +EXTERN_AUXFUNCT void i8finda(int8 *x, int size, int8 *out, int max); + +/* +** \brief int16 Find function +** max is an integer giving the maximum number of indices to return. (use -1 to search them all) +*/ +EXTERN_AUXFUNCT void i16finda(int16 *x, int size, int16 *out, int max); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/auxiliaryFunctions/includes/rand.h b/src/c/auxiliaryFunctions/includes/rand.h index 4716cbba..d032a124 100644 --- a/src/c/auxiliaryFunctions/includes/rand.h +++ b/src/c/auxiliaryFunctions/includes/rand.h @@ -17,6 +17,7 @@ #include "dynlib_auxiliaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -46,6 +47,35 @@ EXTERN_AUXFUNCT floatComplex crands(void); **/ EXTERN_AUXFUNCT doubleComplex zrands(void); + +/** + ** \brief uint8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u8rands(void); + + +/** + ** \brief uint16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u16rands(void); + + +/** + ** \brief int8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i8rands(void); + + +/** + ** \brief int16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i16rands(void); + + /** ** \brief Float Array Rand function ** \return A random float array. @@ -70,6 +100,32 @@ EXTERN_AUXFUNCT void cranda(floatComplex *out, int size); **/ EXTERN_AUXFUNCT void zranda(doubleComplex *out, int size); +/** + ** \brief uint8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u8randa(double *out, int size); + +/** + ** \brief uint16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u16randa(double *out, int size); + + +/** + ** \brief int8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i8randa(double *out, int size); + +/** + ** \brief int16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i16randa(double *out, int size); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/auxiliaryFunctions/includes/sign.h b/src/c/auxiliaryFunctions/includes/sign.h index 0f69b4b7..67f0da8b 100644 --- a/src/c/auxiliaryFunctions/includes/sign.h +++ b/src/c/auxiliaryFunctions/includes/sign.h @@ -18,6 +18,7 @@ #include "dynlib_auxiliaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -56,6 +57,38 @@ EXTERN_AUXFUNCT floatComplex csigns(floatComplex in); EXTERN_AUXFUNCT doubleComplex zsigns(doubleComplex in); /** + ** \brief Uint8 Sign function + ** Determine the sign of in (assume that 0 is positive). + ** \param in : the uint8 we must determine sign. + ** \return -1 or +1 depending on the sign of in. + **/ +EXTERN_AUXFUNCT int8 u8signs(uint8 in); + +/** + ** \brief Int8 Sign function + ** Determine the sign of in (assume that 0 is positive). + ** \param in : the int8 we must determine sign. + ** \return -1 or +1 depending on the sign of in. + **/ +EXTERN_AUXFUNCT int8 i8signs(int8 in); + +/** + ** \brief Uint16 Sign function + ** Determine the sign of in (assume that 0 is positive). + ** \param in : the uint16 we must determine sign. + ** \return -1 or +1 depending on the sign of in. + **/ +EXTERN_AUXFUNCT int16 u16signs(uint16 in); + +/** + ** \brief Int16 Sign function + ** Determine the sign of in (assume that 0 is positive). + ** \param in : the uint16 we must determine sign. + ** \return -1 or +1 depending on the sign of in. + **/ +EXTERN_AUXFUNCT int16 i16signs(int16 in); + +/** ** \brief Float Signe Array function ** Determine the sign of an array in (assume that 0 is positive). ** \param in : the float array we must determine sign. @@ -91,6 +124,43 @@ EXTERN_AUXFUNCT void csigna(floatComplex *in, int size, floatComplex *out); **/ EXTERN_AUXFUNCT void zsigna(doubleComplex *in, int size, doubleComplex *out); +/** + ** \brief Uint8 Sign Array function + ** Determine the sign of an array in (assume that 0 is positive). + ** \param in : the uint8 array we must determine sign. + ** \param size : the number of elements. + ** \return -1 or +1 depending on the sign of in elements. + **/ +EXTERN_AUXFUNCT void u8signa(uint8 *in, int size, int8 *out); + +/** + ** \brief Int8 Sign Array function + ** Determine the sign of an array in (assume that 0 is positive). + ** \param in : the int8 array we must determine sign. + ** \param size : the number of elements. + ** \return -1 or +1 depending on the sign of in elements. + **/ +EXTERN_AUXFUNCT void i8signa(int8 *in, int size, int8 *out); + +/** + ** \brief Uint16 Sign Array function + ** Determine the sign of an array in (assume that 0 is positive). + ** \param in : the uint16 array we must determine sign. + ** \param size : the number of elements. + ** \return -1 or +1 depending on the sign of in elements. + **/ +EXTERN_AUXFUNCT void u16signa(uint16 *in, int size, int16 *out); + +/** + ** \brief Int16 Sign Array function + ** Determine the sign of an array in (assume that 0 is positive). + ** \param in : the int16 array we must determine sign. + ** \param size : the number of elements. + ** \return -1 or +1 depending on the sign of in elements. + **/ +EXTERN_AUXFUNCT void i16signa(int16 *in, int size, int16 *out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/auxiliaryFunctions/interfaces/int_abs.h b/src/c/auxiliaryFunctions/interfaces/int_abs.h index 4c353fee..70a428c2 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_abs.h +++ b/src/c/auxiliaryFunctions/interfaces/int_abs.h @@ -23,6 +23,14 @@ #define z0absd0(in) zabss(in) +#define u80absu80(in) u8abss(in) + +#define i80absi80(in) i8abss(in) + +#define u160absu160(in) u16abss(in) + +#define i160absi160(in) i16abss(in) + #define s2abss2(in,size,out) sabsa(in, size[0]*size[1], out) #define d2absd2(in,size,out) dabsa(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2absd2(in,size,out) zabsa(in, size[0]*size[1], out) +#define u82absu82(in,size,out) u8absa(in, size[0]*size[1], out) + +#define i82absi82(in,size,out) i8absa(in, size[0]*size[1], out) + +#define u162absu162(in,size,out) u16absa(in, size[0]*size[1], out) + +#define i162absi162(in,size,out) i16absa(in, size[0]*size[1], out) + #endif /* !__INT_ABS_H__ */ diff --git a/src/c/auxiliaryFunctions/interfaces/int_conj.h b/src/c/auxiliaryFunctions/interfaces/int_conj.h index f54de243..7884c99f 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_conj.h +++ b/src/c/auxiliaryFunctions/interfaces/int_conj.h @@ -15,7 +15,7 @@ #ifndef __INT_CONJ_H__ #define __INT_CONJ_H__ -#define copy(in,size,out) {int i;for (i=0; i<size[0]*size[1];i++) out[i]=in[i];} +#define copy_c(in,size,out) {int i;for (i=0; i<size[0]*size[1];i++) out[i]=in[i];} #define s0conjs0(in) in @@ -25,12 +25,28 @@ #define z0conjz0(in) zconjs(in) -#define s2conjs2(in,size,out) copy(in,size,out) +#define u80conju80(in) in -#define d2conjd2(in,size,out) copy(in,size,out) +#define i80conji80(in) in + +#define u160conju160(in) in + +#define i160conji160(in) in + +#define s2conjs2(in,size,out) copy_c(in,size,out) + +#define d2conjd2(in,size,out) copy_c(in,size,out) #define c2conjc2(in,size,out) cconja(in, size[0]*size[1], out) #define z2conjz2(in,size,out) zconja(in, size[0]*size[1], out) +#define u82conju82(in,size,out) copy_c(in,size,out) + +#define i82conji82(in,size,out) copy_c(in,size,out) + +#define u162conju162(in,size,out) copy_c(in,size,out) + +#define i162conji162(in,size,out) copy_c(in,size,out) + #endif /* !__INT_CONJ_H__ */ diff --git a/src/c/auxiliaryFunctions/interfaces/int_find.h b/src/c/auxiliaryFunctions/interfaces/int_find.h index 891aad7e..ec1e1575 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_find.h +++ b/src/c/auxiliaryFunctions/interfaces/int_find.h @@ -25,6 +25,14 @@ #define z0findd0(in) ((zreals(in) == 0) && (zimags(in) == 0)) ? -1 : 1 +#define u80findu80(in) (in == 0) ? -1 : 1 + +#define u160findu160(in) (in == 0) ? -1 : 1 + +#define i80findi80(in) (in == 0) ? -1 : 1 + +#define i160findi160(in) (in == 0) ? -1 : 1 + #define s2finds2(in,size,out) sfinda(in, size[0]*size[1], out, -1) #define d2findd2(in,size,out) dfinda(in, size[0]*size[1], out, -1) @@ -33,6 +41,14 @@ #define z2findd2(in,size,out) zfinda(in, size[0]*size[1], out, -1) +#define u82findu82(in,size,out) u8finda(in,size[0]*size[1],out, -1) + +#define u162findu162(in,size,out) u16finda(in,size[0]*size[1],out, -1) + +#define i82findi82(in,size,out) i8finda(in,size[0]*size[1],out, -1) + +#define i162findi162(in,size,out) i16finda(in,size[0]*size[1],out, -1) + /* 1 input, 2 outputs */ #define s0finds0s0(in,out2) *out2 = s0finds0(in);s0finds0(in) @@ -43,10 +59,18 @@ #define z0findd0d0(in,out2) if ((zreals(in)==0) && (zimags(in)==0)) {out2=0;} else {out2=1;} +#define u80findu80u80(in,out2) *out2 = u80findu80(in);u80findu80(in) + +#define u160findu160u160(in,out2) *out2 = u160findu160(in);u160findu160(in) + +#define i80findi80i80(in,out2) *out2 = i80findi80(in);i80findi80(in) + +#define i160findi160i160(in,out2) *out2 = i160findi160(in);i160findi160(in) + #define s2finds2s2(in,size,out1,sizeOut1,out2,sizeOut2) sfind2da(in,size[0],size[1],out1,sizeOut1,out2,sizeOut2,-1) -#define d2findd2d2(in,size,out1,out2) dfind2da(in,size[0],size[1],out1,out2,-1) +#define d2findd2d2(in,size,out1,out2) dfind2da(in,size[0],size[1],out1,out2,-1) #define c2finds2s2(in,size,out1,sizeOut1,out2,sizeOut2) cfind2da(in,size[0],size[1],out1,sizeOut1,out2,sizeOut2,-1) @@ -62,6 +86,14 @@ #define z0d0findd0(in1,in2) z0findd0(in1) +#define u80u80findu80(in1,in2) u80findu80(in1) + +#define u160u160findu160(in1,in2) u160findu160(in1) + +#define i80i80findi80(in1,in2) i80findi80(in1) + +#define i160i160findi160(in1,in2) i160findi160(in1) + #define s2s0finds2(in1,size,in2,out) {\ int temp_out_indice[2] = {0} ;\ sfinda(in1,size[0]*size[1],out,in2);\ @@ -82,6 +114,25 @@ zfinda(in1,size[0]*size[1],out,in2);\ } +#define u82u80findu82(in1,size,in2,out) {\ + int temp_out_indice[2] = {0};\ + u8finda(in1,size[0]*size[1],out,in2);\ +} + +#define u162u160findu162(in1,size,in2,out) {\ + int temp_out_indice[2] = {0};\ + u16finda(in1,size[0]*size[1],out,in2);\ +} + +#define i82i80findi82(in1,size,in2,out) {\ + int temp_out_indice[2] = {0};\ + i8finda(in1,size[0]*size[1],out,in2);\ +} + +#define i162i160findi162(in1,size,in2,out) {\ + int temp_out_indice[2] = {0};\ + i16finda(in1,size[0]*size[1],out,in2);\ +} /* 2 inputs, 2 outputs */ #define s0s0finds0s0(in1,in2,out1,out2) s0finds0s0(in1,out1,out2) @@ -92,6 +143,14 @@ #define z0d0findd0d0(in1,in2,out1,out2) z0findd0d0(in1,out1,out2) +#define u80u80findu80u80(in1,in2,out1,out2) u80findu80u80(in1,out1,out2) + +#define u160u160findu160u160(in1,in2,out1,out2) u160findu160u160(in1,out1,out2) + +#define i80i80findi80i80(in1,in2,out1,out2) i80findi80i80(in1,out1,out2) + +#define i160i60findi60i60(in1,in2,out1,out2) i60findi60i60(in1,out1,out2) + /*FIXME : prototypes are wrong*/ #define s2s0finds2s2(in1,size,in2,out1,out2) {\ diff --git a/src/c/auxiliaryFunctions/interfaces/int_rand.h b/src/c/auxiliaryFunctions/interfaces/int_rand.h index 597309a4..85d08eae 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_rand.h +++ b/src/c/auxiliaryFunctions/interfaces/int_rand.h @@ -20,6 +20,14 @@ #define randd0() drands() +#define randu80() u8rands() + +#define randu160() u16rands() + +#define randi80() i8rands() + +#define randi160() i16rands() + #define s0rands0(in) srands() @@ -30,16 +38,39 @@ #define z0randz0(in) zrands() +#define u80randd0(in) u8rands() + +#define u160randd0(in) u16rands() + +#define i80randd0(in) i8rands() + +#define i160randd0(in) i16rands() + #define s0s0rands0(in1,in2) srands() #define d0d0randd0(in,in2) drands() +#define u80u80randd0(in1,in2) u8rands() + +#define u160u160randd0(in1,in2) u16rands() + +#define i80i80randd0(in1,in2) i8rands() + +#define i160i160randd0(in1,in2) i16rands() + #define s0s0rands2(in1,in2,out) sranda(out,(int)in1*(int)in2) #define d0d0randd2(in1,in2,out) dranda(out,(int)in1*(int)in2) +#define u80u80randd2(in1,in2,out) u8randa(out,(int)in1*(int)in2) + +#define u160u160randd2(in1,in2,out) u16randa(out,(int)in1*(int)in2) + +#define i80i80randd2(in1,in2,out) i8randa(out,(int)in1*(int)in2) + +#define i160i160randd2(in1,in2,out) i16randa(out,(int)in1*(int)in2) #define s2rands2(in,size,out) sranda(out, size[0]*size[1]) @@ -49,5 +80,15 @@ #define z2randz2(in,size,out) zranda(out, size[0]*size[1]) +#define u82randd2(in,size,out) u8randa(out, size[0]*size[1]) + +#define u162randd2(in,size,out) u16randa(out, size[0]*size[1]) + +#define i82randd2(in,size,out) i8randa(out, size[0]*size[1]) + +#define i62randd2(in,size,out) i16randa(out, size[0]*size[1]) + + + #endif /* !__INT_RAND_H__ */ diff --git a/src/c/auxiliaryFunctions/interfaces/int_sign.h b/src/c/auxiliaryFunctions/interfaces/int_sign.h index 4463901a..1003fe73 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_sign.h +++ b/src/c/auxiliaryFunctions/interfaces/int_sign.h @@ -23,6 +23,14 @@ #define z0signz0(in) zsigns(in) +#define u80signi80(in) u8signs(in) + +#define i80signi80(in) i8signs(in) + +#define u160signi160(in) u16signs(in) + +#define i160signi160(in) i16signs(in) + #define s2signs2(in,size,out) ssigna(in, size[0]*size[1], out) #define d2signd2(in,size,out) dsigna(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2signz2(in,size,out) zsigna(in, size[0]*size[1], out) +#define u82signi82(in,size,out) u8signa(in, size[0]*size[1], out) + +#define i82signi82(in,size,out) i8signa(in, size[0]*size[1], out) + +#define u162signi162(in,size,out) u16signa(in, size[0]*size[1], out) + +#define i162signi162(in,size,out) i16signa(in, size[0]*size[1], out) + #endif /* !__INT_SIGN_H__ */ diff --git a/src/c/auxiliaryFunctions/isnan/cisnans.c b/src/c/auxiliaryFunctions/isnan/cisnans.c index 7fc0759f..623cea0b 100644 --- a/src/c/auxiliaryFunctions/isnan/cisnans.c +++ b/src/c/auxiliaryFunctions/isnan/cisnans.c @@ -10,14 +10,11 @@ * */ +#ifdef _WIN32 +#include <math.h> +#endif - -#ifdef _MSC_VER -#include <float.h> -#define isnan(x) _isnan((double)x)
-#endif
-
-#include "isnan.h"
+#include "isnan.h" float cisnans(floatComplex in) { diff --git a/src/c/auxiliaryFunctions/isnan/disnans.c b/src/c/auxiliaryFunctions/isnan/disnans.c index 0d0a5699..99b5b664 100644 --- a/src/c/auxiliaryFunctions/isnan/disnans.c +++ b/src/c/auxiliaryFunctions/isnan/disnans.c @@ -10,10 +10,10 @@ * */ -#ifdef _MSC_VER -#include <float.h> -#define isnan(x) _isnan((double)x)
-#endif + +#ifdef _WIN32 +#include <math.h> +#endif #include "isnan.h" diff --git a/src/c/auxiliaryFunctions/isnan/sisnans.c b/src/c/auxiliaryFunctions/isnan/sisnans.c index 201fd31a..905890b8 100644 --- a/src/c/auxiliaryFunctions/isnan/sisnans.c +++ b/src/c/auxiliaryFunctions/isnan/sisnans.c @@ -10,10 +10,10 @@ *
*/
-#ifdef _MSC_VER
-#include <float.h>
-#define isnan(x) _isnan((double)x)
-#endif
+
+#ifdef _WIN32
+#include <math.h>
+#endif
#include "isnan.h"
diff --git a/src/c/auxiliaryFunctions/isnan/zisnans.c b/src/c/auxiliaryFunctions/isnan/zisnans.c index b7ebc1bb..95cfd972 100644 --- a/src/c/auxiliaryFunctions/isnan/zisnans.c +++ b/src/c/auxiliaryFunctions/isnan/zisnans.c @@ -10,10 +10,9 @@ * */ -#ifdef _MSC_VER -#include <float.h> -#define isnan(x) _isnan((double)x)
-#endif +#ifdef _WIN32 +#include <math.h> +#endif #include "isnan.h" diff --git a/src/c/auxiliaryFunctions/rand/dranda.c b/src/c/auxiliaryFunctions/rand/dranda.c index f4678279..3defc264 100644 --- a/src/c/auxiliaryFunctions/rand/dranda.c +++ b/src/c/auxiliaryFunctions/rand/dranda.c @@ -16,5 +16,5 @@ void dranda(double *out, int size) { int i = 0; for (i = 0 ; i < size ; ++i) { out[i] = drands(); - } + } } diff --git a/src/c/auxiliaryFunctions/rand/drands.c b/src/c/auxiliaryFunctions/rand/drands.c index 9b7c4cf4..658cd0b0 100644 --- a/src/c/auxiliaryFunctions/rand/drands.c +++ b/src/c/auxiliaryFunctions/rand/drands.c @@ -34,37 +34,60 @@ double drands(void) { if (m2==0){ /* if first entry, compute machine integer word length */ - while (m>m2){ + while (m>m2){ m2=m; m=itwo*m2; + } + halfm = m2; - - /* compute multiplier and increment for linear congruential method */ + + /* compute multiplier and increment for linear congruential method */ ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; - ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) + 1; - mic = (m2 - ic) + m2; - - /* s is the scale factor for converting to floating point */ + + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) + 1; + + mic = (m2 - ic) + m2; + + /* s is the scale factor for converting to floating point */ s = 0.5/halfm; + + } /* compute next random number */ iy = iy*ia; + + /* the following statement is for computers which do not allow integer overflow on addition */ - if (iy > mic) iy = (iy - m2) - m2; + if (iy > mic) + { + iy = (iy - m2) - m2; + + } iy = iy + ic; /* the following statement is for computers where the word length for addition is greater than for multiplication */ - if (iy/2 > m2) iy = (iy - m2) - m2; + if (iy/2 > m2) + { + iy = (iy - m2) - m2; + + } /* the following statement is for computers where integer overflow affects the sign bit */ - if (iy < 0) iy = (iy + m2) + m2; + if (iy < 0) + { + iy = (iy + m2) + m2; + + + } + + return (double)iy*s; } diff --git a/src/c/auxiliaryFunctions/rand/i16randa.c b/src/c/auxiliaryFunctions/rand/i16randa.c new file mode 100644 index 00000000..b6aa741d --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i16randa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" + +void i16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i16rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/i16rands.c b/src/c/auxiliaryFunctions/rand/i16rands.c new file mode 100644 index 00000000..67173d23 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i16rands.c @@ -0,0 +1,57 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" +#include <stdio.h> + +double i16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + + + +} diff --git a/src/c/auxiliaryFunctions/rand/i8randa.c b/src/c/auxiliaryFunctions/rand/i8randa.c new file mode 100644 index 00000000..68d3ff3b --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i8randa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" + +void i8randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i8rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/i8rands.c b/src/c/auxiliaryFunctions/rand/i8rands.c new file mode 100644 index 00000000..e9b30a33 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i8rands.c @@ -0,0 +1,53 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" +#include <stdio.h> + +double i8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + +} diff --git a/src/c/auxiliaryFunctions/rand/u16randa.c b/src/c/auxiliaryFunctions/rand/u16randa.c new file mode 100644 index 00000000..cfcfb50f --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u16randa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" + +void u16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = u16rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/u16rands.c b/src/c/auxiliaryFunctions/rand/u16rands.c new file mode 100644 index 00000000..2023be4a --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u16rands.c @@ -0,0 +1,57 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" +#include <stdio.h> + +double u16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + +} + + diff --git a/src/c/auxiliaryFunctions/rand/u8randa.c b/src/c/auxiliaryFunctions/rand/u8randa.c new file mode 100644 index 00000000..a7fc5836 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u8randa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" +#include<stdio.h> +void u8randa(double *out,int size) +{ + + int i = 0; + + for(i = 0 ; i < size ; ++i) + { + out[i] = u8rands(); + + } + +} diff --git a/src/c/auxiliaryFunctions/rand/u8rands.c b/src/c/auxiliaryFunctions/rand/u8rands.c new file mode 100644 index 00000000..d03741a4 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u8rands.c @@ -0,0 +1,79 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "rand.h" +#include <stdio.h> + +double u8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + + while(m>m2) + { + + m2=m; + + m=itwo*m2; + + } + + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + + mic = (m2 - ic) + m2; + + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + + +} + +/* compute next random number */ + iy = iy*ia; + +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) +{ + iy = (iy - m2) - m2; + +} + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) +{ + iy = (iy - m2) - m2; + +} + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) + { + iy = (iy + m2) + m2; + + } + + return (double)iy*s; + + + + + +} diff --git a/src/c/auxiliaryFunctions/sign/i16signa.c b/src/c/auxiliaryFunctions/sign/i16signa.c new file mode 100644 index 00000000..a2b61823 --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/i16signa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sign.h" + +void i16signa(int16 *in, int size, int16 *out) { + int i = 0; + + for (i = 0 ; i < size ; ++i) { + out[i] = i16signs(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/sign/i16signs.c b/src/c/auxiliaryFunctions/sign/i16signs.c new file mode 100644 index 00000000..b6e70a8a --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/i16signs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sign.h" + +int16 i16signs(int16 num) { + if (num > 0) { + return (int16)1; + } + if (num < 0) { + return (int16)-1; + } + /* num == 0 */ + return (int16)0; +} diff --git a/src/c/auxiliaryFunctions/sign/i8signa.c b/src/c/auxiliaryFunctions/sign/i8signa.c new file mode 100644 index 00000000..3390b042 --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/i8signa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sign.h" + +void i8signa(int8 *in, int size, int8 *out) { + int i = 0; + + for (i = 0 ; i < size ; ++i) { + out[i] = i8signs(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/sign/i8signs.c b/src/c/auxiliaryFunctions/sign/i8signs.c new file mode 100644 index 00000000..4bbefeb3 --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/i8signs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sign.h" + +int8 i8signs(int8 num) { + if (num > 0) { + return (int8)1; + } + if (num < 0) { + return (int8)-1; + } + /* num == 0 */ + return (int8)0; +} diff --git a/src/c/auxiliaryFunctions/sign/u16signa.c b/src/c/auxiliaryFunctions/sign/u16signa.c new file mode 100644 index 00000000..b962ee2d --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/u16signa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sign.h" + +void u16signa(uint16 *in, int size, int16 *out) { + int i = 0; + + for (i = 0 ; i < size ; ++i) { + out[i] = u16signs(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/sign/u16signs.c b/src/c/auxiliaryFunctions/sign/u16signs.c new file mode 100644 index 00000000..d04d19cd --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/u16signs.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sign.h" + +int16 u16signs(uint16 num) { + if (num > 0) { + return (int16)1; + } + if (num < 0) { + return (int16)-1; + } + /* num == 0 */ + return (int16)0; +} diff --git a/src/c/auxiliaryFunctions/sign/u8signa.c b/src/c/auxiliaryFunctions/sign/u8signa.c new file mode 100644 index 00000000..980931ec --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/u8signa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sign.h" + +void u8signa(uint8 *in, int size, int8 *out) { + int i = 0; + + for (i = 0 ; i < size ; ++i) { + out[i] = u8signs(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/sign/u8signs.c b/src/c/auxiliaryFunctions/sign/u8signs.c new file mode 100644 index 00000000..69d766b0 --- /dev/null +++ b/src/c/auxiliaryFunctions/sign/u8signs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sign.h" + +int8 u8signs(uint8 num) { + if (num > 0) { + return (int8)1; + } + if (num < 0) { + return (int8)-1; + } + /* num == 0 */ + return (int8)0; +} diff --git a/src/c/differential_calculus/diff/ddiffca.c b/src/c/differential_calculus/diff/ddiffca.c new file mode 100644 index 00000000..92727da0 --- /dev/null +++ b/src/c/differential_calculus/diff/ddiffca.c @@ -0,0 +1,203 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + /* This function calculates difference between adjacent members of given + input array/matrix */ + +#include "diffc.h" + + +void ddiffca(double *in, int row, int col, int depth, int dim, double *out) +{ + int counter, depth_count; + int row_count, col_count; + double *buffer; /*To store intermediate results*/ + + depth_count = 1; + + if(dim == 0) + { /*For dim = 0, we calculate difference between adjacent elements + in case of arrays. In case of matrices, we calculate difference along + first column, and then continue to second (diff between first element + of second column and last element of first column, then third etc.*/ + if(depth == 1) + {/*for depth=1, a buffer is not needed. Directly write result in + out buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = in[counter+1] - in[counter]; + } + } + else + { /*define buffer for storing intermediate results*/ + + buffer = (double *) malloc (sizeof(double)*(row*col-1)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*calculate diff and store in buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + buffer[counter] = in[counter+1] - in[counter]; + } + } + else if(depth_count < depth) + { + for(counter = 0; counter <= row*col - depth_count ; counter++) + { + buffer[counter] = buffer[counter+1] - buffer[counter]; + } + } + /*For last step use output buffer to store result*/ + else + { + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = buffer[counter+1] - buffer[counter]; + } + } + depth_count += 1; + } + } + + } + else if(dim == 1) + { + /*For dim = 1, difference is calculated along rows. Each element of + first row is subtracted from corresponding element of second row and + result is stored in first row. Same thing is repeated till last row. */ + + if (depth == 1) + { + /*If depth is 1, store result directly in out buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + out[col_count*(row-1)+row_count] = in[col_count*row + row_count+1] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (double *) malloc (sizeof(double)*((row-1)*col)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*For first step, use in buffer and store results in buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + buffer[col_count*row+row_count] = in[col_count*row + row_count + 1] \ + - in[col_count*row + row_count]; + } + + } + } + else if(depth_count < depth) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + buffer[col_count*row+row_count] = buffer[col_count*row + row_count + 1] \ + - buffer[col_count*row + row_count]; + } + + } + } + else + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + out[col_count*(row-depth_count)+row_count] = buffer[col_count*row + row_count+1] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count +=1; + } + } + } + else if(dim == 2) + { + /*For dim = 2, difference is calculated along columns. Each element of + first column is subtracted from corresponding element of second column + and result is stored in first column. Same thing is repeated till last + column. */ + if(depth == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + out[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (double *) malloc (sizeof(double)*(row*(col-1))); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + buffer[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else if(depth_count < depth) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + buffer[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + else + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + out[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count += 1; + } + } + } +} diff --git a/src/c/differential_calculus/diff/i16diffca.c b/src/c/differential_calculus/diff/i16diffca.c new file mode 100644 index 00000000..d1c70a53 --- /dev/null +++ b/src/c/differential_calculus/diff/i16diffca.c @@ -0,0 +1,203 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + /* This function calculates difference between adjacent members of given + input array/matrix */ + +#include "diffc.h" + + +void i16diffca(int16 *in, int row, int col, int depth, int dim, int16 *out) +{ + int counter, depth_count; + int row_count, col_count; + int16 *buffer; /*To store intermediate results*/ + + depth_count = 1; + + if(dim == 0) + { /*For dim = 0, we calculate difference between adjacent elements + in case of arrays. In case of matrices, we calculate difference along + first column, and then continue to second (diff between first element + of second column and last element of first column, then third etc.*/ + if(depth == 1) + {/*for depth=1, a buffer is not needed. Directly write result in + out buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = in[counter+1] - in[counter]; + } + } + else + { /*define buffer for storing intermediate results*/ + + buffer = (int16 *) malloc (sizeof(int16)*(row*col-1)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*calculate diff and store in buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + buffer[counter] = in[counter+1] - in[counter]; + } + } + else if(depth_count < depth) + { + for(counter = 0; counter <= row*col - depth_count ; counter++) + { + buffer[counter] = buffer[counter+1] - buffer[counter]; + } + } + /*For last step use output buffer to store result*/ + else + { + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = buffer[counter+1] - buffer[counter]; + } + } + depth_count += 1; + } + } + + } + else if(dim == 1) + { + /*For dim = 1, difference is calculated along rows. Each element of + first row is subtracted from corresponding element of second row and + result is stored in first row. Same thing is repeated till last row. */ + + if (depth == 1) + { + /*If depth is 1, store result directly in out buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + out[col_count*(row-1)+row_count] = in[col_count*row + row_count+1] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (int16 *) malloc (sizeof(int16)*((row-1)*col)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*For first step, use in buffer and store results in buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + buffer[col_count*row+row_count] = in[col_count*row + row_count + 1] \ + - in[col_count*row + row_count]; + } + + } + } + else if(depth_count < depth) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + buffer[col_count*row+row_count] = buffer[col_count*row + row_count + 1] \ + - buffer[col_count*row + row_count]; + } + + } + } + else + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + out[col_count*(row-depth_count)+row_count] = buffer[col_count*row + row_count+1] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count +=1; + } + } + } + else if(dim == 2) + { + /*For dim = 2, difference is calculated along columns. Each element of + first column is subtracted from corresponding element of second column + and result is stored in first column. Same thing is repeated till last + column. */ + if(depth == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + out[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (int16 *) malloc (sizeof(int16)*(row*(col-1))); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + buffer[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else if(depth_count < depth) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + buffer[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + else + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + out[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count += 1; + } + } + } +} diff --git a/src/c/differential_calculus/diff/i8diffca.c b/src/c/differential_calculus/diff/i8diffca.c new file mode 100644 index 00000000..7b76f961 --- /dev/null +++ b/src/c/differential_calculus/diff/i8diffca.c @@ -0,0 +1,203 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + /* This function calculates difference between adjacent members of given + input array/matrix */ + +#include "diffc.h" + + +void i8diffca(int8 *in, int row, int col, int depth, int dim, int8 *out) +{ + int counter, depth_count; + int row_count, col_count; + int8 *buffer; /*To store intermediate results*/ + + depth_count = 1; + + if(dim == 0) + { /*For dim = 0, we calculate difference between adjacent elements + in case of arrays. In case of matrices, we calculate difference along + first column, and then continue to second (diff between first element + of second column and last element of first column, then third etc.*/ + if(depth == 1) + {/*for depth=1, a buffer is not needed. Directly write result in + out buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = in[counter+1] - in[counter]; + } + } + else + { /*define buffer for storing intermediate results*/ + + buffer = (int8 *) malloc (sizeof(int8)*(row*col-1)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*calculate diff and store in buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + buffer[counter] = in[counter+1] - in[counter]; + } + } + else if(depth_count < depth) + { + for(counter = 0; counter <= row*col - depth_count ; counter++) + { + buffer[counter] = buffer[counter+1] - buffer[counter]; + } + } + /*For last step use output buffer to store result*/ + else + { + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = buffer[counter+1] - buffer[counter]; + } + } + depth_count += 1; + } + } + + } + else if(dim == 1) + { + /*For dim = 1, difference is calculated along rows. Each element of + first row is subtracted from corresponding element of second row and + result is stored in first row. Same thing is repeated till last row. */ + + if (depth == 1) + { + /*If depth is 1, store result directly in out buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + out[col_count*(row-1)+row_count] = in[col_count*row + row_count+1] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (int8 *) malloc (sizeof(int8)*((row-1)*col)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*For first step, use in buffer and store results in buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + buffer[col_count*row+row_count] = in[col_count*row + row_count + 1] \ + - in[col_count*row + row_count]; + } + + } + } + else if(depth_count < depth) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + buffer[col_count*row+row_count] = buffer[col_count*row + row_count + 1] \ + - buffer[col_count*row + row_count]; + } + + } + } + else + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + out[col_count*(row-depth_count)+row_count] = buffer[col_count*row + row_count+1] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count +=1; + } + } + } + else if(dim == 2) + { + /*For dim = 2, difference is calculated along columns. Each element of + first column is subtracted from corresponding element of second column + and result is stored in first column. Same thing is repeated till last + column. */ + if(depth == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + out[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (int8 *) malloc (sizeof(int8)*(row*(col-1))); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + buffer[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else if(depth_count < depth) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + buffer[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + else + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + out[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count += 1; + } + } + } +} diff --git a/src/c/differential_calculus/diff/sdiffca.c b/src/c/differential_calculus/diff/sdiffca.c new file mode 100644 index 00000000..67526ad5 --- /dev/null +++ b/src/c/differential_calculus/diff/sdiffca.c @@ -0,0 +1,203 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + /* This function calculates difference between adjacent members of given + input array/matrix */ + +#include "diffc.h" + + +void sdiffca(float *in, int row, int col, int depth, int dim, float *out) +{ + int counter, depth_count; + int row_count, col_count; + float *buffer; /*To store intermediate results*/ + + depth_count = 1; + + if(dim == 0) + { /*For dim = 0, we calculate difference between adjacent elements + in case of arrays. In case of matrices, we calculate difference along + first column, and then continue to second (diff between first element + of second column and last element of first column, then third etc.*/ + if(depth == 1) + {/*for depth=1, a buffer is not needed. Directly write result in + out buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = in[counter+1] - in[counter]; + } + } + else + { /*define buffer for storing intermediate results*/ + + buffer = (float *) malloc (sizeof(float)*(row*col-1)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*calculate diff and store in buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + buffer[counter] = in[counter+1] - in[counter]; + } + } + else if(depth_count < depth) + { + for(counter = 0; counter <= row*col - depth_count ; counter++) + { + buffer[counter] = buffer[counter+1] - buffer[counter]; + } + } + /*For last step use output buffer to store result*/ + else + { + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = buffer[counter+1] - buffer[counter]; + } + } + depth_count += 1; + } + } + + } + else if(dim == 1) + { + /*For dim = 1, difference is calculated along rows. Each element of + first row is subtracted from corresponding element of second row and + result is stored in first row. Same thing is repeated till last row. */ + + if (depth == 1) + { + /*If depth is 1, store result directly in out buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + out[col_count*(row-1)+row_count] = in[col_count*row + row_count+1] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (float *) malloc (sizeof(float)*((row-1)*col)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*For first step, use in buffer and store results in buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + buffer[col_count*row+row_count] = in[col_count*row + row_count + 1] \ + - in[col_count*row + row_count]; + } + + } + } + else if(depth_count < depth) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + buffer[col_count*row+row_count] = buffer[col_count*row + row_count + 1] \ + - buffer[col_count*row + row_count]; + } + + } + } + else + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + out[col_count*(row-depth_count)+row_count] = buffer[col_count*row + row_count+1] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count +=1; + } + } + } + else if(dim == 2) + { + /*For dim = 2, difference is calculated along columns. Each element of + first column is subtracted from corresponding element of second column + and result is stored in first column. Same thing is repeated till last + column. */ + if(depth == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + out[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (float *) malloc (sizeof(float)*(row*(col-1))); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + buffer[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else if(depth_count < depth) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + buffer[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + else + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + out[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count += 1; + } + } + } +} diff --git a/src/c/differential_calculus/diff/u16diffca.c b/src/c/differential_calculus/diff/u16diffca.c new file mode 100644 index 00000000..d83a9e6e --- /dev/null +++ b/src/c/differential_calculus/diff/u16diffca.c @@ -0,0 +1,203 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + /* This function calculates difference between adjacent members of given + input array/matrix */ + +#include "diffc.h" + + +void u16diffca(uint16 *in, int row, int col, int depth, int dim, uint16 *out) +{ + int counter, depth_count; + int row_count, col_count; + uint16 *buffer; /*To store intermediate results*/ + + depth_count = 1; + + if(dim == 0) + { /*For dim = 0, we calculate difference between adjacent elements + in case of arrays. In case of matrices, we calculate difference along + first column, and then continue to second (diff between first element + of second column and last element of first column, then third etc.*/ + if(depth == 1) + {/*for depth=1, a buffer is not needed. Directly write result in + out buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = in[counter+1] - in[counter]; + } + } + else + { /*define buffer for storing intermediate results*/ + + buffer = (uint16 *) malloc (sizeof(uint16)*(row*col-1)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*calculate diff and store in buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + buffer[counter] = in[counter+1] - in[counter]; + } + } + else if(depth_count < depth) + { + for(counter = 0; counter <= row*col - depth_count ; counter++) + { + buffer[counter] = buffer[counter+1] - buffer[counter]; + } + } + /*For last step use output buffer to store result*/ + else + { + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = buffer[counter+1] - buffer[counter]; + } + } + depth_count += 1; + } + } + + } + else if(dim == 1) + { + /*For dim = 1, difference is calculated along rows. Each element of + first row is subtracted from corresponding element of second row and + result is stored in first row. Same thing is repeated till last row. */ + + if (depth == 1) + { + /*If depth is 1, store result directly in out buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + out[col_count*(row-1)+row_count] = in[col_count*row + row_count+1] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (uint16 *) malloc (sizeof(uint16)*((row-1)*col)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*For first step, use in buffer and store results in buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + buffer[col_count*row+row_count] = in[col_count*row + row_count + 1] \ + - in[col_count*row + row_count]; + } + + } + } + else if(depth_count < depth) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + buffer[col_count*row+row_count] = buffer[col_count*row + row_count + 1] \ + - buffer[col_count*row + row_count]; + } + + } + } + else + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + out[col_count*(row-depth_count)+row_count] = buffer[col_count*row + row_count+1] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count +=1; + } + } + } + else if(dim == 2) + { + /*For dim = 2, difference is calculated along columns. Each element of + first column is subtracted from corresponding element of second column + and result is stored in first column. Same thing is repeated till last + column. */ + if(depth == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + out[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (uint16 *) malloc (sizeof(uint16)*(row*(col-1))); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + buffer[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else if(depth_count < depth) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + buffer[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + else + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + out[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count += 1; + } + } + } +} diff --git a/src/c/differential_calculus/diff/u8diffca.c b/src/c/differential_calculus/diff/u8diffca.c new file mode 100644 index 00000000..567ff8e6 --- /dev/null +++ b/src/c/differential_calculus/diff/u8diffca.c @@ -0,0 +1,203 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + /* This function calculates difference between adjacent members of given + input array/matrix */ + +#include "diffc.h" + + +void u8diffca(uint8 *in, int row, int col, int depth, int dim, uint8 *out) +{ + int counter, depth_count; + int row_count, col_count; + uint8 *buffer; /*To store intermediate results*/ + + depth_count = 1; + + if(dim == 0) + { /*For dim = 0, we calculate difference between adjacent elements + in case of arrays. In case of matrices, we calculate difference along + first column, and then continue to second (diff between first element + of second column and last element of first column, then third etc.*/ + if(depth == 1) + {/*for depth=1, a buffer is not needed. Directly write result in + out buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = in[counter+1] - in[counter]; + } + } + else + { /*define buffer for storing intermediate results*/ + + buffer = (uint8 *) malloc (sizeof(uint8)*(row*col-1)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*calculate diff and store in buffer*/ + for(counter = 0; counter < row*col - depth_count; counter++) + { + buffer[counter] = in[counter+1] - in[counter]; + } + } + else if(depth_count < depth) + { + for(counter = 0; counter <= row*col - depth_count ; counter++) + { + buffer[counter] = buffer[counter+1] - buffer[counter]; + } + } + /*For last step use output buffer to store result*/ + else + { + for(counter = 0; counter < row*col - depth_count; counter++) + { + out[counter] = buffer[counter+1] - buffer[counter]; + } + } + depth_count += 1; + } + } + + } + else if(dim == 1) + { + /*For dim = 1, difference is calculated along rows. Each element of + first row is subtracted from corresponding element of second row and + result is stored in first row. Same thing is repeated till last row. */ + + if (depth == 1) + { + /*If depth is 1, store result directly in out buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + out[col_count*(row-1)+row_count] = in[col_count*row + row_count+1] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (uint8 *) malloc (sizeof(uint8)*((row-1)*col)); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + /*For first step, use in buffer and store results in buffer*/ + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - 1; row_count++) + { + buffer[col_count*row+row_count] = in[col_count*row + row_count + 1] \ + - in[col_count*row + row_count]; + } + + } + } + else if(depth_count < depth) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + buffer[col_count*row+row_count] = buffer[col_count*row + row_count + 1] \ + - buffer[col_count*row + row_count]; + } + + } + } + else + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count < row - depth_count; row_count++) + { + out[col_count*(row-depth_count)+row_count] = buffer[col_count*row + row_count+1] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count +=1; + } + } + } + else if(dim == 2) + { + /*For dim = 2, difference is calculated along columns. Each element of + first column is subtracted from corresponding element of second column + and result is stored in first column. Same thing is repeated till last + column. */ + if(depth == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + out[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else + { + /*If depth is not 1, declare a buffer to store intermediate + results. At last step store result into out buffer*/ + buffer = (uint8 *) malloc (sizeof(uint8)*(row*(col-1))); + + while(depth_count <= depth) + { + if(depth_count == 1) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - 1; col_count++) + { + buffer[col_count*row+row_count] = in[(col_count+1)*row + row_count] \ + - in[col_count*row + row_count]; + } + } + } + else if(depth_count < depth) + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + buffer[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + else + { + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col - depth_count; col_count++) + { + out[col_count*row+row_count] = buffer[(col_count+1)*row + row_count] \ + - buffer[col_count*row + row_count]; + } + } + } + depth_count += 1; + } + } + } +} diff --git a/src/c/differential_calculus/includes/diffc.h b/src/c/differential_calculus/includes/diffc.h new file mode 100644 index 00000000..2e2cf018 --- /dev/null +++ b/src/c/differential_calculus/includes/diffc.h @@ -0,0 +1,39 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __DIFFC_H__ +#define __DIFFC_H__ + +#include "types.h" +#include <stdio.h> +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void ddiffca(double *in, int row, int col, int depth, int dim, double *out); + +void sdiffca(float *in, int row, int col, int depth, int dim, float *out); + +void u8diffca(uint8 *in, int row, int col, int depth, int dim, uint8 *out); + +void i8diffca(int8 *in, int row, int col, int depth, int dim, int8 *out); + +void u16diffca(uint16 *in, int row, int col, int depth, int dim, uint16 *out); + +void i16diffca(int16 *in, int row, int col, int depth, int dim, int16 *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__DIFFC_H__*/ diff --git a/src/c/differential_calculus/includes/ode.h b/src/c/differential_calculus/includes/ode.h new file mode 100644 index 00000000..7e110031 --- /dev/null +++ b/src/c/differential_calculus/includes/ode.h @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ODE_H__ +#define __ODE_H__ + +double dodes(double initial_value, double start_time, double end_time, \ + int (*ode_function)(double, double*, double*, int*), char *solver_type, double nequs, double eps_abs, double eps_rel, \ + double step_size, int *params); + +void dodea(double *initial_value, double start_time, double end_time, \ + int (*ode_function)(double, double*, double*, int*), char *solver_type, double nequs, double eps_abs, double eps_rel, \ + double step_size, int *params, double *out); + +#endif /*__ODE_H__*/
\ No newline at end of file diff --git a/src/c/differential_calculus/interfaces/int_diffc.h b/src/c/differential_calculus/interfaces/int_diffc.h new file mode 100644 index 00000000..3c032426 --- /dev/null +++ b/src/c/differential_calculus/interfaces/int_diffc.h @@ -0,0 +1,105 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_DIFFC_H__ +#define __INT_DIFFC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2diffd2(in, size, out) ddiffca(in, size[0], size[1], 1, 0, out) + +#define d2d0diffd2(in, size, depth, out) ddiffca (in, size[0], size[1], \ + depth, 0, out) + +#define d2d0d0diffd2(in, size, depth, dim, out) ddiffca(in, size[0], size[1], \ + depth, dim, out) + +#define s2diffs2(in, size, out) sdiffca(in, size[0], size[1], 1, 0, out) + +#define s2d0diffs2(in, size, depth, out) sdiffca (in, size[0], size[1], \ + depth, 0, out) + +#define s2s0diffs2(in, size, depth, out) sdiffca (in, size[0], size[1], \ + depth, 0, out) + +#define s2s0d0diffs2(in, size, depth, dim, out) sdiffca(in, size[0], size[1], \ + depth, dim, out) + +#define s2d0d0diffs2(in, size, depth, dim, out) sdiffca(in, size[0], size[1], \ + depth, dim, out) + +#define u82diffu82(in, size, out) u8diffca(in, size[0], size[1], 1, 0, out) + +#define u82d0diffu82(in, size, depth, out) u8diffca (in, size[0], size[1], \ + depth, 0, out) + +#define u82u80diffu82(in, size, depth, out) u8diffca (in, size[0], size[1], \ + depth, 0, out) + +#define u82u80d0diffu82(in, size, depth, dim, out) u8diffca(in, size[0], size[1], \ + depth, dim, out) + + +#define u82d0d0diffu82(in, size, depth, dim, out) u8diffca(in, size[0], size[1], \ + depth, dim, out) + +#define i82diffi82(in, size, out) i8diffca(in, size[0], size[1], 1, 0, out) + +#define i82d0diffi82(in, size, depth, out) i8diffca (in, size[0], size[1], \ + depth, 0, out) + +#define i82u80diffi82(in, size, depth, out) i8diffca (in, size[0], size[1], \ + depth, 0, out) + +#define i82u80d0diffi82(in, size, depth, dim, out) i8diffca(in, size[0], size[1], \ + depth, dim, out) + + +#define i82d0d0diffi82(in, size, depth, dim, out) i8diffca(in, size[0], size[1], \ + depth, dim, out) + +#define u162diffu162(in, size, out) u16diffca(in, size[0], size[1], 1, 0, out) + +#define u162d0diffu162(in, size, depth, out) u16diffca (in, size[0], size[1], \ + depth, 0, out) + +#define u162u160diffu162(in, size, depth, out) u16diffca (in, size[0], size[1], \ + depth, 0, out) + +#define u162u160d0diffu162(in, size, depth, dim, out) u16diffca(in, size[0], size[1], \ + depth, dim, out) + + +#define u162d0d0diffu162(in, size, depth, dim, out) u16diffca(in, size[0], size[1], \ + depth, dim, out) + +#define i162diffi162(in, size, out) i16diffca(in, size[0], size[1], 1, 0, out) + +#define i162d0diffi162(in, size, depth, out) i16diffca (in, size[0], size[1], \ + depth, 0, out) + +#define i162u160diffi162(in, size, depth, out) i16diffca (in, size[0], size[1], \ + depth, 0, out) + +#define i162u160d0diffi162(in, size, depth, dim, out) i16diffca(in, size[0], size[1], \ + depth, dim, out) + + +#define i162d0d0diffi162(in, size, depth, dim, out) i16diffca(in, size[0], size[1], \ + depth, dim, out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_DIFFC_H__*/ diff --git a/src/c/differential_calculus/interfaces/int_ode.h b/src/c/differential_calculus/interfaces/int_ode.h new file mode 100644 index 00000000..51764ea1 --- /dev/null +++ b/src/c/differential_calculus/interfaces/int_ode.h @@ -0,0 +1,68 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_ODE_H__ +#define __INT_ODE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0fn0oded0(in1, in2, in3, func_name) dodes(in1, in2, in3, \ + func_name, "rkf",1, 1.0e-2, 1.0e-2, 1.0e-6, NULL) + +#define d2d0d0fn0oded2(in1, size1, in2, in3, func_name, out) dodea(in1, \ + in2, in3, func_name, "rkf",size1[1], 1.0e-2, 1.0e-2, \ + 1.0e-6, size1, out) + +#define d0d0d2fn0oded2(in1, in2, in3, size3, func_name, out) dodea(in1, in2, \ + in3, func_name, "rkf", 1, 1.0e-2, 1.0e-2, 1.0e-6, size3, out) + +#define d2d0d2fn0oded2(in1, size1, in2, in3, size3, func_name, out) dodea(in1, \ + in2, in3, func_name, "rkf",size1[1], 1.0e-2, 1.0e-2, \ + 1.0e-6, size1, out) + +#define g2d0d0d0fn0oded0(solvertype, typesize, in1, in2, in3, func_name) dodes(in1, in2, in3, \ + func_name, solvertype, 1, 1.0e-2, 1.0e-2, 1.0e-6, NULL) + +#define g2d2d0d0fn0oded2(solvertype, typesize, in1, size1, in2, in3, func_name, out) \ + dodea(in1, in2, in3, func_name, solvertype, size1[1], \ + 1.0e-2, 1.0e-2, 1.0e-6, size1, out) + +#define g2d0d0d2fn0oded2(solvertype, typesize, in1, in2, in3, size3, func_name, out) \ + dodea(in1, in2, in3, func_name, solvertype,1, 1.0e-2, 1.0e-2, \ + 1.0e-6, size3, out) + +#define g2d2d0d2fn0oded2(solvertype, typesize, in1, size1, in2, in3, size3, func_name, out) dodea(in1, \ + in2, in3, func_name, solvertype, size1[1], 1.0e-2, 1.0e-2, \ + 1.0e-6, size1, out) + +#define d0d0d0d0d0fn0oded0(in1, in2, in3, in4, in5, func_name) \ + dodes(in1, in2, in3, func_name, "rkf",1, in5, in4, 1.0e-6, NULL) + +#define d2d0d0d0d0fn0oded2(in1, size1, in2, in3, in4, in5, func_name, out) \ + dodea(in1, in2, in3, func_name, "rkf", size1[1], in5, in4, \ + 1.0e-6, size1, out) + +#define d0d0d2d0d0fn0oded2(in1, in2, in3, size3, in4, in5, func_name, out) \ + dodea(in1, in2, in3, func_name, "rkf", 1, in5, in4, 1.0e-6, size3, out) + +#define d2d0d2d0d0fn0oded2(in1, size1, in2, in3, size3, in4, in5, func_name, out) \ + dodea(in1, in2, in3, func_name, "rkf", size1[1], in5, in4, \ + 1.0e-6, size1, out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /*__INT_ODE_H__*/
\ No newline at end of file diff --git a/src/c/differential_calculus/ode/dodea.c b/src/c/differential_calculus/ode/dodea.c new file mode 100644 index 00000000..97d56a1a --- /dev/null +++ b/src/c/differential_calculus/ode/dodea.c @@ -0,0 +1,67 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for solving ODEs using GSL library*/ + +#include "ode.h" +#include "types.h" +#include <gsl/gsl_errno.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_odeiv2.h> + + +void dodea(double *initial_value, double start_time, double end_time, \ + int (*ode_function)(double, double*, double*, int*), char *solver_type, double nequs, double eps_abs, \ + double eps_rel, double step_size, int *params, double *out) +{ + double t = start_time; + gsl_odeiv2_step_type *step_type; + + /*Initialise output to initial state*/ + int counter = 0; + for (counter = 0; counter<nequs;counter++) + { + out[counter] = initial_value[counter]; + } + + /*Setup ODE related parameters*/ + gsl_odeiv2_system sys = {ode_function, NULL, nequs, params}; + + /*Select step solver*/ + if (solver_type == "adams") + step_type = gsl_odeiv2_step_msadams; + if (solver_type == "stiff") + step_type = gsl_odeiv2_step_msbdf; + if (solver_type == "rk") + step_type = gsl_odeiv2_step_rk4; + if (solver_type == "rkf") + step_type = gsl_odeiv2_step_rkf45; + if (solver_type == "root") + step_type = gsl_odeiv2_step_rkck; + if (solver_type == "discrete") + step_type = gsl_odeiv2_step_rk8pd; + else + step_type = gsl_odeiv2_step_rkf45; + + gsl_odeiv2_step *s = gsl_odeiv2_step_alloc (step_type, nequs); + gsl_odeiv2_control *c = gsl_odeiv2_control_y_new (eps_abs, eps_rel); + gsl_odeiv2_evolve *e = gsl_odeiv2_evolve_alloc (nequs); + + while(t < end_time) + { + gsl_odeiv2_evolve_apply_fixed_step (e, c, s, &sys, &t, step_size, out); + } + + gsl_odeiv2_evolve_free (e); + gsl_odeiv2_control_free (c); + gsl_odeiv2_step_free (s); +} diff --git a/src/c/differential_calculus/ode/dodes.c b/src/c/differential_calculus/ode/dodes.c new file mode 100644 index 00000000..6d1a8672 --- /dev/null +++ b/src/c/differential_calculus/ode/dodes.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for solving ODEs using GSL library*/ + +#include "ode.h" +#include "types.h" +#include <gsl/gsl_errno.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_odeiv2.h> + + +double dodes(double initial_value, double start_time, double end_time, \ + int (*ode_function)(double, double*, double*, int*), \ + char *solver_type, double nequs, double eps_abs, \ + double eps_rel, double step_size, int *params) +{ + double out = 0, t = 0; + //int status; + out = initial_value; + t = start_time; + //Setup ODE related parameters + gsl_odeiv2_system sys = {ode_function, NULL, nequs, NULL}; + + gsl_odeiv2_step *s = gsl_odeiv2_step_alloc (gsl_odeiv2_step_rkf45, nequs); + gsl_odeiv2_control *c = gsl_odeiv2_control_y_new (eps_abs, eps_rel); + gsl_odeiv2_evolve *e = gsl_odeiv2_evolve_alloc (nequs); + + while(t < end_time) + { + gsl_odeiv2_evolve_apply_fixed_step (e, c, s, &sys, &t, step_size, &out); + } + + gsl_odeiv2_evolve_free (e); + gsl_odeiv2_control_free (c); + gsl_odeiv2_step_free (s); + + return out; + +} diff --git a/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c b/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c new file mode 100644 index 00000000..65a6f4a2 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/dcosda.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +#include "cosd.h" +#include <math.h> + +void dcosda(double* in,int size,double* out) +{ + int i=0; + for (i=0;i<size;i++) + { + out[i] = dcosds(in[i]); + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c b/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c new file mode 100644 index 00000000..8bc6d4ab --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/dcosds.c @@ -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 +*/ + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + +#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/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c b/src/c/elementaryFunctions/Trigonometry/cosd/scosda.c new file mode 100644 index 00000000..7e0714db --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/scosda.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c b/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c new file mode 100644 index 00000000..45c788ff --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cosd/scosds.c @@ -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 +*/ + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + +#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/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c b/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.c new file mode 100644 index 00000000..3a4b23c1 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/dcotda.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cotd.h" + +void dcotda(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=dcotds(in[i]); + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c b/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.c new file mode 100644 index 00000000..34befb62 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/dcotds.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + +#include <math.h> +#include "cotd.h" + +double dcotds(double in) +{ + return (1/tan((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c b/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c new file mode 100644 index 00000000..fbdf0f50 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/scotda.c @@ -0,0 +1,20 @@ +/* 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 +*/ + +#include "cotd.h" + +void scotda(float* in, int size, float* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = scotds(in[i]); + } +} diff --git a/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c b/src/c/elementaryFunctions/Trigonometry/cotd/scotds.c new file mode 100644 index 00000000..e7e02b9d --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cotd/scotds.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + +#include <math.h> +#include "cotd.h" + +float scotds(float in) +{ + return (1/tanf((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c b/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c new file mode 100644 index 00000000..44a366e8 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/ccotha.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +#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]); + } + +} diff --git a/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c b/src/c/elementaryFunctions/Trigonometry/coth/ccoths.c new file mode 100644 index 00000000..b7f90263 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/ccoths.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c b/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c new file mode 100644 index 00000000..bb54b200 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/dcotha.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +#include "coth.h" +#include <math.h> + +void dcotha(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=cosh(in[i])/sinh(in[i]); + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c b/src/c/elementaryFunctions/Trigonometry/coth/dcoths.c new file mode 100644 index 00000000..55c9a5b4 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/dcoths.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/coth/scotha.c b/src/c/elementaryFunctions/Trigonometry/coth/scotha.c new file mode 100644 index 00000000..53351621 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/scotha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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]); + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/coth/scoths.c b/src/c/elementaryFunctions/Trigonometry/coth/scoths.c new file mode 100644 index 00000000..2865f566 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/scoths.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c b/src/c/elementaryFunctions/Trigonometry/coth/zcotha.c new file mode 100644 index 00000000..206cc43f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/zcotha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c b/src/c/elementaryFunctions/Trigonometry/coth/zcoths.c new file mode 100644 index 00000000..8b3b19f5 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/coth/zcoths.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c b/src/c/elementaryFunctions/Trigonometry/csc/ccsca.c new file mode 100644 index 00000000..7ec9a6b8 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/ccsca.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c b/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c new file mode 100644 index 00000000..f16aa1b9 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/ccscs.c @@ -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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c b/src/c/elementaryFunctions/Trigonometry/csc/dcsca.c new file mode 100644 index 00000000..b1a3cf3b --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/dcsca.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c b/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c new file mode 100644 index 00000000..f9e128c2 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/dcscs.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +#include "csc.h" +#include <math.h> + +double dcscs(double in) +{ + double out; + out=1/sin(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/scsca.c b/src/c/elementaryFunctions/Trigonometry/csc/scsca.c new file mode 100644 index 00000000..cea8338f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/scsca.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csc/scscs.c b/src/c/elementaryFunctions/Trigonometry/csc/scscs.c new file mode 100644 index 00000000..f0ad15e4 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/scscs.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +#include "csc.h" +#include <math.h> + +float scscs(float in) +{ + float out; + out=1/sin(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c b/src/c/elementaryFunctions/Trigonometry/csc/zcsca.c new file mode 100644 index 00000000..59430925 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/zcsca.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c b/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c new file mode 100644 index 00000000..64fce57a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csc/zcscs.c @@ -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 +*/ + +#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) +{ + double real = zreals(z); + double imag = zimags(z); + return zrdivs(DoubleComplex(1,0),(DoubleComplex(dsins(real) * dcoshs(imag), dcoss(real) * dsinhs(imag)))); +} diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c new file mode 100644 index 00000000..ed13f9e7 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/ccscda.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.c new file mode 100644 index 00000000..39b2576a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/ccscds.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c new file mode 100644 index 00000000..8ca3df94 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/dcscda.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +#include "cscd.h" +#include <math.h> + +void dcscda(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=dcscds(in[i]); + } +} + diff --git a/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c new file mode 100644 index 00000000..af4dc30b --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/dcscds.c @@ -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 +*/ + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + +#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/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/scscda.c new file mode 100644 index 00000000..17936628 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/scscda.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c new file mode 100644 index 00000000..ebf36d2d --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/scscds.c @@ -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 +*/ + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + + +#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/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c b/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c new file mode 100644 index 00000000..a8a617c2 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/zcscda.c @@ -0,0 +1,24 @@ +/* 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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c b/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.c new file mode 100644 index 00000000..47d5dfc1 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/cscd/zcscds.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c b/src/c/elementaryFunctions/Trigonometry/csch/ccscha.c new file mode 100644 index 00000000..a95da200 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/ccscha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c b/src/c/elementaryFunctions/Trigonometry/csch/ccschs.c new file mode 100644 index 00000000..ddcc733f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/ccschs.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c b/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c new file mode 100644 index 00000000..32489051 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/dcscha.c @@ -0,0 +1,20 @@ +/* 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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c b/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c new file mode 100644 index 00000000..7b1f15ae --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/dcschs.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +#include "csch.h" +#include <math.h> + +double dcschs(double in) +{ + double out; + out=1/sinh(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/scscha.c b/src/c/elementaryFunctions/Trigonometry/csch/scscha.c new file mode 100644 index 00000000..18d5ea79 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/scscha.c @@ -0,0 +1,20 @@ +/* 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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csch/scschs.c b/src/c/elementaryFunctions/Trigonometry/csch/scschs.c new file mode 100644 index 00000000..ec550850 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/scschs.c @@ -0,0 +1,21 @@ +/* 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 +*/ + +#include "csch.h" +#include <math.h> + +float scschs(float in) +{ + float out; + out=1/sinh(in); + return out; +} diff --git a/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c b/src/c/elementaryFunctions/Trigonometry/csch/zcscha.c new file mode 100644 index 00000000..fab5cc43 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/zcscha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c b/src/c/elementaryFunctions/Trigonometry/csch/zcschs.c new file mode 100644 index 00000000..33a4fccd --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/csch/zcschs.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sec/cseca.c b/src/c/elementaryFunctions/Trigonometry/sec/cseca.c new file mode 100644 index 00000000..fcb9b81a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/cseca.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sec/csecs.c b/src/c/elementaryFunctions/Trigonometry/sec/csecs.c new file mode 100644 index 00000000..c2d9b9ed --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/csecs.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sec/dseca.c b/src/c/elementaryFunctions/Trigonometry/sec/dseca.c new file mode 100644 index 00000000..c39f7c6e --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/dseca.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c b/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c new file mode 100644 index 00000000..5278b371 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/dsecs.c @@ -0,0 +1,19 @@ +/* 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 +*/ + +#include <math.h> +#include "sec.h" + +double dsecs(double in) +{ + return (1/cos(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/sseca.c b/src/c/elementaryFunctions/Trigonometry/sec/sseca.c new file mode 100644 index 00000000..0ac7cc62 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/sseca.c @@ -0,0 +1,20 @@ +/* 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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c b/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c new file mode 100644 index 00000000..ad480005 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/ssecs.c @@ -0,0 +1,19 @@ +/* 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 +*/ + +#include <math.h> +#include "sec.h" + +float ssecs(float in) +{ + return (1/cos(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sec/zseca.c b/src/c/elementaryFunctions/Trigonometry/sec/zseca.c new file mode 100644 index 00000000..dec365d1 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/zseca.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c b/src/c/elementaryFunctions/Trigonometry/sec/zsecs.c new file mode 100644 index 00000000..9629db71 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sec/zsecs.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sec.h" +#include "cos.h" +#include <math.h> +#include "doubleComplex.h" +#include "division.h" + +doubleComplex zsecs(doubleComplex z) +{ + + doubleComplex out; + out = zrdivs(DoubleComplex(1,0),zcoss(z)); + return out; +}
\ No newline at end of file diff --git a/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c b/src/c/elementaryFunctions/Trigonometry/secd/dsecda.c new file mode 100644 index 00000000..f9f70f0c --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/dsecda.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c b/src/c/elementaryFunctions/Trigonometry/secd/dsecds.c new file mode 100644 index 00000000..aa95f29a --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/dsecds.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + + +#include <math.h> +#include "sec.h" +#include "secd.h" + +double dsecds(double in) +{ + return (1/cos((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c b/src/c/elementaryFunctions/Trigonometry/secd/ssecda.c new file mode 100644 index 00000000..c1fc5e53 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/ssecda.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#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/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c b/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c new file mode 100644 index 00000000..eaf3a298 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/secd/ssecds.c @@ -0,0 +1,24 @@ +/* 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 +*/ + + +#ifdef _WIN32 + #define _USE_MATH_DEFINES +#endif + +#include <math.h> +#include "secd.h" +#include "sec.h" + +float ssecds(float in) { + return (1/cos((M_PI/180.0)*in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/csecha.c b/src/c/elementaryFunctions/Trigonometry/sech/csecha.c new file mode 100644 index 00000000..c8d52d82 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/csecha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sech/csechs.c b/src/c/elementaryFunctions/Trigonometry/sech/csechs.c new file mode 100644 index 00000000..e707e8b1 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/csechs.c @@ -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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c b/src/c/elementaryFunctions/Trigonometry/sech/dsecha.c new file mode 100644 index 00000000..4092c9e8 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/dsecha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c b/src/c/elementaryFunctions/Trigonometry/sech/dsechs.c new file mode 100644 index 00000000..fdcfd69c --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/dsechs.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sech.h" +#include "cosh.h" +#include "cos.h" + + +double dsechs(double in) +{ + return (1/cosh(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c b/src/c/elementaryFunctions/Trigonometry/sech/ssecha.c new file mode 100644 index 00000000..d7e71b33 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/ssecha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c b/src/c/elementaryFunctions/Trigonometry/sech/ssechs.c new file mode 100644 index 00000000..9fcd50b7 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/ssechs.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sech.h" +#include "cosh.h" +#include "cos.h" + + +float ssechs(float in) +{ + return (1/cosh(in)); +} diff --git a/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c b/src/c/elementaryFunctions/Trigonometry/sech/zsecha.c new file mode 100644 index 00000000..a3c3189f --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/zsecha.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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c b/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c new file mode 100644 index 00000000..d23d2ef4 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sech/zsechs.c @@ -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 +*/ + +#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/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c b/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c new file mode 100644 index 00000000..0cd24e96 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c @@ -0,0 +1,46 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "sinc.h" +#define PI 3.14159265358979 +void dsinca(double* sample,int size,double* oup) +{ + int j; + for(j=0;j<size;j++) + { + if(sample[j]==0) + { + oup[j]=1; + } + else + { + oup[j]=(sin(sample[j]))/(sample[j]); + } + } +} +/* +int main() +{ + int n; + printf("Enter the length of the array"); + scanf("%d",&n); + double arr[100000]; + int i; + printf("Now enter the element of the array"); + for(i=0;i<n;i++) + { + scanf("%ld",&arr[i]); + } + sinc(arr[],n); +} +*/ diff --git a/src/c/elementaryFunctions/Trigonometry/sinc/int_sinc.h b/src/c/elementaryFunctions/Trigonometry/sinc/int_sinc.h new file mode 100644 index 00000000..0dc969de --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sinc/int_sinc.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SINC_H__ +#define __INT_SINC_H__ + +#define d2sincd2(sample,size,oup) dsinca(sample,size,oup) + +#endif /* !__INT_SINC_H__! */ diff --git a/src/c/elementaryFunctions/Trigonometry/sinc/sinc.h b/src/c/elementaryFunctions/Trigonometry/sinc/sinc.h new file mode 100644 index 00000000..6a5c315b --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sinc/sinc.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SINC_H__ +#define __SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsinca(double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINC_H__ */ diff --git a/src/c/elementaryFunctions/Trigonometry/sinc/zsinca.c b/src/c/elementaryFunctions/Trigonometry/sinc/zsinca.c new file mode 100644 index 00000000..1f6cf9ba --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sinc/zsinca.c @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "sinc.h" +#include "sin.h" +#include "doubleComplex.h" +#include "division.h" +void zsinca(doubleComplex* sample,int size,doubleComplex* oup) +{ + int j; + double r,i; + for(j=0;j<size;j++) + { + r=zreals(sample[j]); + i=zimags(sample[j]); + if(r==0 && i==0) + { + oup[j]=DoubleComplex(1,0); + } + else + { + oup[j]=zrdivs(zsins(sample[j]),sample[j]); + } + } +} diff --git a/src/c/elementaryFunctions/acosd/cacoss.c b/src/c/elementaryFunctions/acosd/cacoss.c new file mode 100644 index 00000000..97420313 --- /dev/null +++ b/src/c/elementaryFunctions/acosd/cacoss.c @@ -0,0 +1,147 @@ +/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET
+ * Copyright (C) Bruno Pincon
+ *
+ * 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 fonction is a translation of fortran wacos write by Bruno Pincon <Bruno.Pincon@iecn.u-nancy.fr>
+ * REFERENCE
+ * This is a Fortran-77 translation of an algorithm by
+ * T.E. Hull, T. F. Fairgrieve and P.T.P. Tang which
+ * appears in their article :
+ * "Implementing the Complex Arcsine and Arccosine
+ * Functions Using Exception Handling", ACM, TOMS,
+ * Vol 23, No. 3, Sept 1997, p. 299-335
+ */
+
+#include "acos.h"
+#include "atan.h"
+#include "log.h"
+#include "log1p.h"
+#include "sqrt.h"
+#include "abs.h"
+#include "lapack.h"
+#include "min.h"
+#include "max.h"
+
+#define localSign(x) (x>0 ? 1.0f : -1.0f)
+
+floatComplex cacoss(floatComplex z) {
+ static float sfltPi = 3.1415926535897932384626433f;
+ static float sfltPi_2 = 1.5707963267948966192313216f;
+ static float sfltLn2 = 0.6931471805599453094172321f;
+ static float sfltAcross = 1.5f;
+ static float sfltBcross = 0.6417f;
+
+ float fltLsup = ssqrts((float) getOverflowThreshold())/8.0f;
+ float fltLinf = 4.0f * ssqrts((float) getUnderflowThreshold());
+ float fltEpsm = ssqrts((float) getRelativeMachinePrecision());
+
+ float fltAbsReal = sabss(creals(z));
+ float fltAbsImg = sabss(cimags(z));
+ float fltSignReal = localSign(creals(z));
+ float fltSignImg = localSign(cimags(z));
+
+ float fltR = 0, fltS = 0, fltA = 0, fltB = 0;
+
+ float fltTemp = 0;
+
+ float _pfltReal = 0;
+ float _pfltImg = 0;
+
+ if( min(fltAbsReal, fltAbsImg) > fltLinf && max(fltAbsReal, fltAbsImg) <= fltLsup)
+ {/* we are in the safe region */
+ fltR = ssqrts( (fltAbsReal + 1 )*(fltAbsReal + 1 ) + fltAbsImg*fltAbsImg);
+ fltS = ssqrts( (fltAbsReal - 1 )*(fltAbsReal - 1 ) + fltAbsImg*fltAbsImg);
+ fltA = 0.5f * ( fltR + fltS );
+ fltB = fltAbsReal / fltA;
+
+
+ /* compute the real part */
+ if(fltB <= sfltBcross)
+ _pfltReal = sacoss(fltB);
+ else if( fltAbsReal <= 1)
+ _pfltReal = satans(ssqrts(0.5f * (fltA + fltAbsReal) * (fltAbsImg*fltAbsImg / (fltR + (fltAbsReal + 1)) + (fltS + (1 - fltAbsReal)))) / fltAbsReal);
+ else
+ _pfltReal = satans((fltAbsImg * ssqrts(0.5f * ((fltA + fltAbsReal) / (fltR + (fltAbsReal + 1)) + (fltA + fltAbsReal) / (fltS + (fltAbsReal - 1))))) / fltAbsReal);
+
+ /* compute the imaginary part */
+ if(fltA <= sfltAcross)
+ {
+ float fltImg1 = 0;
+
+ if(fltAbsReal < 1)
+ /* Am1 = 0.5d0*((y**2)/(R+(x+1.d0))+(y**2)/(S+(1.d0-x))) */
+ fltImg1 = 0.5f * (fltAbsImg*fltAbsImg / (fltR + (fltAbsReal + 1)) + fltAbsImg*fltAbsImg / (fltS + (1 - fltAbsReal)));
+ else
+ /* Am1 = 0.5d0*((y**2)/(R+(x+1.d0))+(S+(x-1.d0))) */
+ fltImg1 = 0.5f * (fltAbsImg*fltAbsImg / (fltR + (fltAbsReal + 1)) + (fltS + (fltAbsReal - 1)));
+ /* ai = logp1(Am1 + sqrt(Am1*(A+1.d0))) */
+ fltTemp = fltImg1 + ssqrts(fltImg1 *( fltA + 1));
+ _pfltImg = slog1ps(fltTemp);
+ }
+ else
+ /* ai = log(A + sqrt(A**2 - 1.d0)) */
+ _pfltImg = slogs(fltA + ssqrts(fltA*fltA - 1));
+ }
+ else
+ {/* evaluation in the special regions ... */
+ if(fltAbsImg <= fltEpsm * sabss(fltAbsReal - 1))
+ {
+ if(fltAbsReal < 1)
+ {
+ _pfltReal = sacoss(fltAbsReal);
+ _pfltImg = fltAbsImg / ssqrts((1 + fltAbsReal) * (1 - fltAbsReal));
+ }
+ else
+ {
+ _pfltReal = 0;
+ if(fltAbsReal <= fltLsup)
+ {
+ fltTemp = (fltAbsReal - 1) + ssqrts((fltAbsReal - 1) * (fltAbsReal + 1));
+ _pfltImg = slog1ps(fltTemp);
+ }
+ else
+ _pfltImg = sfltLn2 + slogs(fltAbsReal);
+ }
+ }
+ else if(fltAbsImg < fltLinf)
+ {
+ _pfltReal = ssqrts(fltAbsImg);
+ _pfltImg = _pfltReal;
+ }
+ else if((fltEpsm * fltAbsImg - 1 >= fltAbsReal))
+ {
+ _pfltReal = sfltPi_2;
+ _pfltImg = sfltLn2 + slogs(fltAbsImg);
+ }
+ else if(fltAbsReal > 1)
+ {
+ _pfltReal = satans(fltAbsImg / fltAbsReal);
+ fltTemp = (fltAbsReal / fltAbsImg)*(fltAbsReal / fltAbsImg);
+ _pfltImg = sfltLn2 + slogs(fltAbsImg) + 0.5f * slog1ps(fltTemp);
+ }
+ else
+ {
+ float fltTemp2 = ssqrts(1 + fltAbsImg*fltAbsImg);
+ _pfltReal = sfltPi_2;
+ fltTemp = 2 * fltAbsImg * (fltAbsImg + fltTemp2);
+ _pfltImg = 0.5f * slog1ps(fltTemp);
+ }
+ }
+ if(fltSignReal < 0)
+ _pfltReal = sfltPi - _pfltReal;
+
+ if(fltAbsImg != 0 || fltSignReal < 0)
+ _pfltImg = - fltSignImg * _pfltImg;
+
+ return FloatComplex(_pfltReal, _pfltImg);
+}
diff --git a/src/c/elementaryFunctions/acosd/dacosda.c b/src/c/elementaryFunctions/acosd/dacosda.c new file mode 100644 index 00000000..2e95e9fc --- /dev/null +++ b/src/c/elementaryFunctions/acosd/dacosda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +void dacosda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacosds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acosd/dacosds.c b/src/c/elementaryFunctions/acosd/dacosds.c new file mode 100644 index 00000000..8f59dab6 --- /dev/null +++ b/src/c/elementaryFunctions/acosd/dacosds.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +double dacosds(double x) +{ + return ((acos(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acosd/sacosda.c b/src/c/elementaryFunctions/acosd/sacosda.c new file mode 100644 index 00000000..440d9dc3 --- /dev/null +++ b/src/c/elementaryFunctions/acosd/sacosda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +void sacosda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacosds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acosd/sacosds.c b/src/c/elementaryFunctions/acosd/sacosds.c new file mode 100644 index 00000000..c166ff0e --- /dev/null +++ b/src/c/elementaryFunctions/acosd/sacosds.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +double sacosds(float x) +{ + return ((acos(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acot/cacota.c b/src/c/elementaryFunctions/acot/cacota.c new file mode 100644 index 00000000..64e82b21 --- /dev/null +++ b/src/c/elementaryFunctions/acot/cacota.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" +#include "floatComplex.h" + +void cacota(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = cacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/cacots.c b/src/c/elementaryFunctions/acot/cacots.c new file mode 100644 index 00000000..f4c6236e --- /dev/null +++ b/src/c/elementaryFunctions/acot/cacots.c @@ -0,0 +1,23 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" +#include "division.h" +#include "floatComplex.h" +#include "atan.h" + +floatComplex cacots(floatComplex x) +{ + floatComplex xinv; + xinv = crdivs(FloatComplex(1,0),x); + return catans(xinv); +} diff --git a/src/c/elementaryFunctions/acot/dacota.c b/src/c/elementaryFunctions/acot/dacota.c new file mode 100644 index 00000000..794d0817 --- /dev/null +++ b/src/c/elementaryFunctions/acot/dacota.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" + +void dacota(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = dacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/dacots.c b/src/c/elementaryFunctions/acot/dacots.c new file mode 100644 index 00000000..42ce7b57 --- /dev/null +++ b/src/c/elementaryFunctions/acot/dacots.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" + +double dacots(double x) +{ + return ((3.14159265359/2)-atan(x)); +} diff --git a/src/c/elementaryFunctions/acot/sacota.c b/src/c/elementaryFunctions/acot/sacota.c new file mode 100644 index 00000000..b99a7739 --- /dev/null +++ b/src/c/elementaryFunctions/acot/sacota.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" + +void sacota(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = sacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/sacots.c b/src/c/elementaryFunctions/acot/sacots.c new file mode 100644 index 00000000..db6dca2f --- /dev/null +++ b/src/c/elementaryFunctions/acot/sacots.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" + +float sacots(float x) +{ + return ((3.14159265359/2)-atanf(x)); +} diff --git a/src/c/elementaryFunctions/acot/zacota.c b/src/c/elementaryFunctions/acot/zacota.c new file mode 100644 index 00000000..d08ebddd --- /dev/null +++ b/src/c/elementaryFunctions/acot/zacota.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" +#include "doubleComplex.h" + +void zacota(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = zacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/zacots.c b/src/c/elementaryFunctions/acot/zacots.c new file mode 100644 index 00000000..3bf99b2c --- /dev/null +++ b/src/c/elementaryFunctions/acot/zacots.c @@ -0,0 +1,23 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" +#include "division.h" +#include "doubleComplex.h" +#include "atan.h" + +doubleComplex zacots(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zatans(xinv); +} diff --git a/src/c/elementaryFunctions/acotd/dacotda.c b/src/c/elementaryFunctions/acotd/dacotda.c new file mode 100644 index 00000000..a2b64856 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/dacotda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acotd.h" + +void dacotda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = dacotds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acotd/dacotds.c b/src/c/elementaryFunctions/acotd/dacotds.c new file mode 100644 index 00000000..f149ac23 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/dacotds.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acotd.h" + +double dacotds(double x) +{ + return ((((3.14159265359/2)-atan(x))*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acotd/sacotda.c b/src/c/elementaryFunctions/acotd/sacotda.c new file mode 100644 index 00000000..39503044 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/sacotda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acotd.h" + +void sacotda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = sacotds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acotd/sacotds.c b/src/c/elementaryFunctions/acotd/sacotds.c new file mode 100644 index 00000000..25797532 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/sacotds.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acotd.h" + +float sacotds(float x) +{ + return ((((3.14159265359/2)-atanf(x))*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acoth/cacotha.c b/src/c/elementaryFunctions/acoth/cacotha.c new file mode 100644 index 00000000..f4e72dc6 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/cacotha.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" +#include "floatComplex.h" + +void cacotha(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = cacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/cacoths.c b/src/c/elementaryFunctions/acoth/cacoths.c new file mode 100644 index 00000000..658c227a --- /dev/null +++ b/src/c/elementaryFunctions/acoth/cacoths.c @@ -0,0 +1,23 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acoth.h" +#include "division.h" +#include "floatComplex.h" +#include "atanh.h" + +floatComplex cacoths(floatComplex x) +{ + floatComplex xinv; + xinv = crdivs(FloatComplex(1,0),x); + return catanhs(xinv); +} diff --git a/src/c/elementaryFunctions/acoth/dacotha.c b/src/c/elementaryFunctions/acoth/dacotha.c new file mode 100644 index 00000000..b97b9039 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/dacotha.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" + +void dacotha(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/dacoths.c b/src/c/elementaryFunctions/acoth/dacoths.c new file mode 100644 index 00000000..aa20a7bd --- /dev/null +++ b/src/c/elementaryFunctions/acoth/dacoths.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acoth.h" +#include "log.h" + + +double dacoths(double x) +{ + return (log((1+x)/(x-1))/2); +} diff --git a/src/c/elementaryFunctions/acoth/sacotha.c b/src/c/elementaryFunctions/acoth/sacotha.c new file mode 100644 index 00000000..383f1882 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/sacotha.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" + +void sacotha(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/sacoths.c b/src/c/elementaryFunctions/acoth/sacoths.c new file mode 100644 index 00000000..9a2137a6 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/sacoths.c @@ -0,0 +1,19 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acoth.h" +#include "log.h" + +float sacoths(float x) +{ + return (log((1+x)/(x-1))/2); +} diff --git a/src/c/elementaryFunctions/acoth/zacotha.c b/src/c/elementaryFunctions/acoth/zacotha.c new file mode 100644 index 00000000..3eb335ea --- /dev/null +++ b/src/c/elementaryFunctions/acoth/zacotha.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" +#include "doubleComplex.h" + +void zacotha(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = zacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/zacoths.c b/src/c/elementaryFunctions/acoth/zacoths.c new file mode 100644 index 00000000..bbb387b0 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/zacoths.c @@ -0,0 +1,23 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acoth.h" +#include "division.h" +#include "doubleComplex.h" +#include "atanh.h" + +doubleComplex zacoths(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zatanhs(xinv); +} diff --git a/src/c/elementaryFunctions/acsc/cacsca.c b/src/c/elementaryFunctions/acsc/cacsca.c new file mode 100644 index 00000000..0512a20f --- /dev/null +++ b/src/c/elementaryFunctions/acsc/cacsca.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "floatComplex.h" + +void cacsca(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = cacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/cacscs.c b/src/c/elementaryFunctions/acsc/cacscs.c new file mode 100644 index 00000000..9eea94e5 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/cacscs.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "floatComplex.h" +#include "asin.h" +#include "division.h" + +floatComplex cacscs(floatComplex x) +{ + floatComplex xinv; + xinv = crdivs(FloatComplex(1,0),x); + return casins(xinv); +} diff --git a/src/c/elementaryFunctions/acsc/dacsca.c b/src/c/elementaryFunctions/acsc/dacsca.c new file mode 100644 index 00000000..3f00d216 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/dacsca.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +void dacsca(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/dacscs.c b/src/c/elementaryFunctions/acsc/dacscs.c new file mode 100644 index 00000000..4b5ac25d --- /dev/null +++ b/src/c/elementaryFunctions/acsc/dacscs.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +double dacscs(double x) +{ + return asin(1/x); +} diff --git a/src/c/elementaryFunctions/acsc/sacsca.c b/src/c/elementaryFunctions/acsc/sacsca.c new file mode 100644 index 00000000..79e6bf95 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/sacsca.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +void sacsca(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/sacscs.c b/src/c/elementaryFunctions/acsc/sacscs.c new file mode 100644 index 00000000..e91fa398 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/sacscs.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +float sacscs(float x) +{ + return asin(1/x); +} diff --git a/src/c/elementaryFunctions/acsc/zacsca.c b/src/c/elementaryFunctions/acsc/zacsca.c new file mode 100644 index 00000000..164406f6 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/zacsca.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" + +void zacsca(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = zacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/zacscs.c b/src/c/elementaryFunctions/acsc/zacscs.c new file mode 100644 index 00000000..91bb6c8c --- /dev/null +++ b/src/c/elementaryFunctions/acsc/zacscs.c @@ -0,0 +1,23 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" +#include "division.h" +#include "asin.h" + +doubleComplex zacscs(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zasins(xinv); +} diff --git a/src/c/elementaryFunctions/acscd/dacscda.c b/src/c/elementaryFunctions/acscd/dacscda.c new file mode 100644 index 00000000..84eeaed2 --- /dev/null +++ b/src/c/elementaryFunctions/acscd/dacscda.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +void dacscda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacscds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acscd/dacscds.c b/src/c/elementaryFunctions/acscd/dacscds.c new file mode 100644 index 00000000..27512ada --- /dev/null +++ b/src/c/elementaryFunctions/acscd/dacscds.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +double dacscds(double x) +{ + return ((asin(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acscd/sacscda.c b/src/c/elementaryFunctions/acscd/sacscda.c new file mode 100644 index 00000000..a5d130cf --- /dev/null +++ b/src/c/elementaryFunctions/acscd/sacscda.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +void sacscda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacscds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acscd/sacscds.c b/src/c/elementaryFunctions/acscd/sacscds.c new file mode 100644 index 00000000..1c820c2a --- /dev/null +++ b/src/c/elementaryFunctions/acscd/sacscds.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +float sacscds(float x) +{ + return ((asin(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acsch/cacscha.c b/src/c/elementaryFunctions/acsch/cacscha.c new file mode 100644 index 00000000..0512a20f --- /dev/null +++ b/src/c/elementaryFunctions/acsch/cacscha.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "floatComplex.h" + +void cacsca(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = cacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/cacschs.c b/src/c/elementaryFunctions/acsch/cacschs.c new file mode 100644 index 00000000..a250b9dc --- /dev/null +++ b/src/c/elementaryFunctions/acsch/cacschs.c @@ -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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" +#include "floatComplex.h" +#include "asin.h" +#include "division.h" + +floatComplex cacschs(floatComplex x) +{ + floatComplex xinv; + floatComplex temp; + xinv = crdivs(FloatComplex(1,0),x); + temp = sqrt(1+cmuls(xinv*xinv)) + +} + + + + + +log(sqrt(1+(1/(x*x)))+(1/x)); diff --git a/src/c/elementaryFunctions/acsch/dacscha.c b/src/c/elementaryFunctions/acsch/dacscha.c new file mode 100644 index 00000000..e7177105 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/dacscha.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +void dacscha(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacschs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/dacschs.c b/src/c/elementaryFunctions/acsch/dacschs.c new file mode 100644 index 00000000..b0a32291 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/dacschs.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +double dacschs(double x) +{ + return log(sqrt(1+(1/(x*x)))+(1/x)); +} diff --git a/src/c/elementaryFunctions/acsch/sacscha.c b/src/c/elementaryFunctions/acsch/sacscha.c new file mode 100644 index 00000000..c2321c6d --- /dev/null +++ b/src/c/elementaryFunctions/acsch/sacscha.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +void sacscha(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacschs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/sacschs.c b/src/c/elementaryFunctions/acsch/sacschs.c new file mode 100644 index 00000000..031773b9 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/sacschs.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +double sacschs(float x) +{ + return log(sqrt(1+(1/(x*x)))+(1/x)); +} diff --git a/src/c/elementaryFunctions/acsch/zacscha.c b/src/c/elementaryFunctions/acsch/zacscha.c new file mode 100644 index 00000000..164406f6 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/zacscha.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" + +void zacsca(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = zacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/zacschs.c b/src/c/elementaryFunctions/acsch/zacschs.c new file mode 100644 index 00000000..6e33e25b --- /dev/null +++ b/src/c/elementaryFunctions/acsch/zacschs.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" +#include "division.h" +#include "asin.h" + +doubleComplex zacscs(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zasins(xinv); +} diff --git a/src/c/elementaryFunctions/asec/daseca.c b/src/c/elementaryFunctions/asec/daseca.c new file mode 100644 index 00000000..2cf1dcd8 --- /dev/null +++ b/src/c/elementaryFunctions/asec/daseca.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +void daseca(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasecs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asec/dasecs.c b/src/c/elementaryFunctions/asec/dasecs.c new file mode 100644 index 00000000..4f2f766e --- /dev/null +++ b/src/c/elementaryFunctions/asec/dasecs.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +double dasecs(double x) +{ + return acos(1/x); +} diff --git a/src/c/elementaryFunctions/asec/saseca.c b/src/c/elementaryFunctions/asec/saseca.c new file mode 100644 index 00000000..3b0afd84 --- /dev/null +++ b/src/c/elementaryFunctions/asec/saseca.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +void saseca(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasecs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asec/sasecs.c b/src/c/elementaryFunctions/asec/sasecs.c new file mode 100644 index 00000000..5db46a61 --- /dev/null +++ b/src/c/elementaryFunctions/asec/sasecs.c @@ -0,0 +1,27 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +double sasecs(float x) +{ + return acos(1/x); +} diff --git a/src/c/elementaryFunctions/asecd/dasecda.c b/src/c/elementaryFunctions/asecd/dasecda.c new file mode 100644 index 00000000..e692762c --- /dev/null +++ b/src/c/elementaryFunctions/asecd/dasecda.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +void dasecda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasecds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asecd/dasecds.c b/src/c/elementaryFunctions/asecd/dasecds.c new file mode 100644 index 00000000..dead3189 --- /dev/null +++ b/src/c/elementaryFunctions/asecd/dasecds.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +double dasecds(double x) +{ + return ((acos(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/asecd/sasecda.c b/src/c/elementaryFunctions/asecd/sasecda.c new file mode 100644 index 00000000..5c9a42fd --- /dev/null +++ b/src/c/elementaryFunctions/asecd/sasecda.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +void sasecda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasecds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asecd/sasecds.c b/src/c/elementaryFunctions/asecd/sasecds.c new file mode 100644 index 00000000..2e265178 --- /dev/null +++ b/src/c/elementaryFunctions/asecd/sasecds.c @@ -0,0 +1,17 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +double sasecds(float x) +{ + return ((acos(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/asech/dasecha.c b/src/c/elementaryFunctions/asech/dasecha.c new file mode 100644 index 00000000..7309e3f2 --- /dev/null +++ b/src/c/elementaryFunctions/asech/dasecha.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" + +void dasecha(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasechs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asech/dasechs.c b/src/c/elementaryFunctions/asech/dasechs.c new file mode 100644 index 00000000..ad5756ae --- /dev/null +++ b/src/c/elementaryFunctions/asech/dasechs.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" +#include "log.h" + +double dasechs(double x) +{ + return log(sqrt((1/x)+1)*sqrt((1/x)-1)+(1/x)); +} diff --git a/src/c/elementaryFunctions/asech/sasecha.c b/src/c/elementaryFunctions/asech/sasecha.c new file mode 100644 index 00000000..f28eace6 --- /dev/null +++ b/src/c/elementaryFunctions/asech/sasecha.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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" + +void sasecha(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasechs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asech/sasechs.c b/src/c/elementaryFunctions/asech/sasechs.c new file mode 100644 index 00000000..b1a1cab2 --- /dev/null +++ b/src/c/elementaryFunctions/asech/sasechs.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" +#include "log.h" + +double sasechs(float x) +{ + return log(sqrt((1/x)+1)*sqrt((1/x)-1)+(1/x)); +} diff --git a/src/c/elementaryFunctions/asind/dasinda.c b/src/c/elementaryFunctions/asind/dasinda.c new file mode 100644 index 00000000..4c7d9af7 --- /dev/null +++ b/src/c/elementaryFunctions/asind/dasinda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "asind.h" + +void dasinda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasinds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asind/dasinds.c b/src/c/elementaryFunctions/asind/dasinds.c new file mode 100644 index 00000000..bc028a15 --- /dev/null +++ b/src/c/elementaryFunctions/asind/dasinds.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "asind.h" + +double dasinds(double x) +{ + return ((asin(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/asind/sasinda.c b/src/c/elementaryFunctions/asind/sasinda.c new file mode 100644 index 00000000..100d09cb --- /dev/null +++ b/src/c/elementaryFunctions/asind/sasinda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "asind.h" + +void sasinda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasinds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asind/sasinds.c b/src/c/elementaryFunctions/asind/sasinds.c new file mode 100644 index 00000000..1bbb3624 --- /dev/null +++ b/src/c/elementaryFunctions/asind/sasinds.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "asind.h" + +double sasinds(float x) +{ + return ((asin(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/atan/datans.c b/src/c/elementaryFunctions/atan/datans.c index a16df82d..11785c04 100644 --- a/src/c/elementaryFunctions/atan/datans.c +++ b/src/c/elementaryFunctions/atan/datans.c @@ -13,6 +13,7 @@ #include <math.h> #include "atan.h" -double datans(double x) { +double datans(double x) +{ return (atan(x)); } diff --git a/src/c/elementaryFunctions/atand/datanda.c b/src/c/elementaryFunctions/atand/datanda.c new file mode 100644 index 00000000..5bf8cd9c --- /dev/null +++ b/src/c/elementaryFunctions/atand/datanda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "atand.h" + +void datanda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = datands(x[i]); + } +} diff --git a/src/c/elementaryFunctions/atand/datands.c b/src/c/elementaryFunctions/atand/datands.c new file mode 100644 index 00000000..8346ebe9 --- /dev/null +++ b/src/c/elementaryFunctions/atand/datands.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "atand.h" + +double datands(double x) +{ + return ((atan(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/atand/satanda.c b/src/c/elementaryFunctions/atand/satanda.c new file mode 100644 index 00000000..1669d69b --- /dev/null +++ b/src/c/elementaryFunctions/atand/satanda.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: Ashish Kamble +// Email: toolbox@scilab.in + +#include "atand.h" + +void satanda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = satands(x[i]); + } +} diff --git a/src/c/elementaryFunctions/atand/satands.c b/src/c/elementaryFunctions/atand/satands.c new file mode 100644 index 00000000..49ee6286 --- /dev/null +++ b/src/c/elementaryFunctions/atand/satands.c @@ -0,0 +1,18 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "atand.h" + +double satands(float x) +{ + return ((atan(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/bitand/u16bitanda.c b/src/c/elementaryFunctions/bitand/u16bitanda.c new file mode 100644 index 00000000..ff92399c --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u16bitanda.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitand.h" + +void u16bitanda(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitands(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitand/u16bitands.c b/src/c/elementaryFunctions/bitand/u16bitands.c new file mode 100644 index 00000000..2fb78d17 --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u16bitands.c @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "bitand.h" + +uint16 u16bitands(uint16 x,uint16 y) +{ + return (x & y); + +} diff --git a/src/c/elementaryFunctions/bitand/u8bitanda.c b/src/c/elementaryFunctions/bitand/u8bitanda.c new file mode 100644 index 00000000..1622ec57 --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u8bitanda.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "bitand.h" + +void u8bitanda(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitands(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitand/u8bitands.c b/src/c/elementaryFunctions/bitand/u8bitands.c new file mode 100644 index 00000000..30dde0fd --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u8bitands.c @@ -0,0 +1,19 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitand.h" + +uint8 u8bitands(uint8 x,uint8 y) +{ + return (x & y); + +} diff --git a/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c b/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c new file mode 100644 index 00000000..2d25d8d9 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "bitcmp.h" +void u16bitcmpa(uint16 *x,uint16 y,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i] = u16bitcmps(x[i],y); + + } + + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u16bitcmps.c b/src/c/elementaryFunctions/bitcmp/u16bitcmps.c new file mode 100644 index 00000000..1cc2e296 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u16bitcmps.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "bitcmp.h" +uint16 u16bitcmps(uint16 x,uint16 y) +{ + + return (~x); + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c b/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c new file mode 100644 index 00000000..c368f7d7 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "bitcmp.h" +void u8bitcmpa(uint8 *x,uint8 y,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i] = u8bitcmps(x[i],y); + + } + + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u8bitcmps.c b/src/c/elementaryFunctions/bitcmp/u8bitcmps.c new file mode 100644 index 00000000..9d1affe0 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u8bitcmps.c @@ -0,0 +1,21 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "bitcmp.h" +uint8 u8bitcmps(uint8 x,uint8 y) +{ + return (~x); + +} + + diff --git a/src/c/elementaryFunctions/bitget/u16bitgets.c b/src/c/elementaryFunctions/bitget/u16bitgets.c new file mode 100644 index 00000000..659d785b --- /dev/null +++ b/src/c/elementaryFunctions/bitget/u16bitgets.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitget.h" +#include<stdio.h> + +uint16 u16bitgets(uint16 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint16 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/src/c/elementaryFunctions/bitget/u8bitgets.c b/src/c/elementaryFunctions/bitget/u8bitgets.c new file mode 100644 index 00000000..03cc9097 --- /dev/null +++ b/src/c/elementaryFunctions/bitget/u8bitgets.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "bitget.h" +#include<stdio.h> + +uint8 u8bitgets(uint8 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint8 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/src/c/elementaryFunctions/bitor/u16bitora.c b/src/c/elementaryFunctions/bitor/u16bitora.c new file mode 100644 index 00000000..152ab53b --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u16bitora.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "bitor.h" + +void u16bitora(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitor/u16bitors.c b/src/c/elementaryFunctions/bitor/u16bitors.c new file mode 100644 index 00000000..984191ed --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u16bitors.c @@ -0,0 +1,19 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitor.h" + +uint16 u16bitors(uint16 x,uint16 y) +{ + return (x | y); + +} diff --git a/src/c/elementaryFunctions/bitor/u8bitora.c b/src/c/elementaryFunctions/bitor/u8bitora.c new file mode 100644 index 00000000..83d08d50 --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u8bitora.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "bitor.h" + +void u8bitora(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitor/u8bitors.c b/src/c/elementaryFunctions/bitor/u8bitors.c new file mode 100644 index 00000000..9327effe --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u8bitors.c @@ -0,0 +1,19 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitor.h" + +uint8 u8bitors(uint8 x,uint8 y) +{ + return (x | y); + +} diff --git a/src/c/elementaryFunctions/bitset/u16bitsets.c b/src/c/elementaryFunctions/bitset/u16bitsets.c new file mode 100644 index 00000000..179b7f21 --- /dev/null +++ b/src/c/elementaryFunctions/bitset/u16bitsets.c @@ -0,0 +1,30 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitset.h" +#include<stdio.h> + +uint16 u16bitsets(uint16 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; /* we could cast to unsigned char, just to be safe */ + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); /*we could cast to unsigned char, just to be safe*/ + return (mask2 & value); + + } + +} diff --git a/src/c/elementaryFunctions/bitset/u8bitsets.c b/src/c/elementaryFunctions/bitset/u8bitsets.c new file mode 100644 index 00000000..1ff0d16f --- /dev/null +++ b/src/c/elementaryFunctions/bitset/u8bitsets.c @@ -0,0 +1,30 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitset.h" +#include<stdio.h> + +uint8 u8bitsets(uint8 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; /* we could cast to unsigned char, just to be safe */ + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); /* we could cast to unsigned char, just to be safe */ + return (mask2 & value); + + } + +} diff --git a/src/c/elementaryFunctions/bitxor/u16bitxora.c b/src/c/elementaryFunctions/bitxor/u16bitxora.c new file mode 100644 index 00000000..413caa60 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u16bitxora.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "bitxor.h" + +void u16bitxora(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitxors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitxor/u16bitxors.c b/src/c/elementaryFunctions/bitxor/u16bitxors.c new file mode 100644 index 00000000..b60fbb67 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u16bitxors.c @@ -0,0 +1,19 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitxor.h" + +uint16 u16bitxors(uint16 x,uint16 y) +{ + return (x ^ y); + +} diff --git a/src/c/elementaryFunctions/bitxor/u8bitxora.c b/src/c/elementaryFunctions/bitxor/u8bitxora.c new file mode 100644 index 00000000..7463487e --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u8bitxora.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "bitxor.h" + +void u8bitxora(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitxors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitxor/u8bitxors.c b/src/c/elementaryFunctions/bitxor/u8bitxors.c new file mode 100644 index 00000000..338f5482 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u8bitxors.c @@ -0,0 +1,19 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "bitxor.h" + +uint8 u8bitxors(uint8 x,uint8 y) +{ + return (x ^ y); + +} diff --git a/src/c/elementaryFunctions/ceil/i16ceila.c b/src/c/elementaryFunctions/ceil/i16ceila.c new file mode 100644 index 00000000..7b639e22 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i16ceila.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +void i16ceila(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/i16ceils.c b/src/c/elementaryFunctions/ceil/i16ceils.c new file mode 100644 index 00000000..0b13c7e7 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i16ceils.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +int16 i16ceils(int16 x) { + return (int16)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/i8ceila.c b/src/c/elementaryFunctions/ceil/i8ceila.c new file mode 100644 index 00000000..aab8f78f --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i8ceila.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +void i8ceila(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/i8ceils.c b/src/c/elementaryFunctions/ceil/i8ceils.c new file mode 100644 index 00000000..901f87c6 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i8ceils.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +int8 i8ceils(int8 x) { + return (int8)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/u16ceila.c b/src/c/elementaryFunctions/ceil/u16ceila.c new file mode 100644 index 00000000..cde894dc --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u16ceila.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +void u16ceila(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/u16ceils.c b/src/c/elementaryFunctions/ceil/u16ceils.c new file mode 100644 index 00000000..1110b4b1 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u16ceils.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +uint16 u16ceils(uint16 x) { + return (uint16)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/u8ceila.c b/src/c/elementaryFunctions/ceil/u8ceila.c new file mode 100644 index 00000000..3d05a504 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u8ceila.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +void u8ceila(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/u8ceils.c b/src/c/elementaryFunctions/ceil/u8ceils.c new file mode 100644 index 00000000..c1ba0b0a --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u8ceils.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "ceil.h" + +uint8 u8ceils(uint8 x) { + return (uint8)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/cos/i16cosa.c b/src/c/elementaryFunctions/cos/i16cosa.c new file mode 100644 index 00000000..426eeabc --- /dev/null +++ b/src/c/elementaryFunctions/cos/i16cosa.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cos.h" + +void i16cosa(int16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16coss(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cos/i16coss.c b/src/c/elementaryFunctions/cos/i16coss.c new file mode 100644 index 00000000..787f713b --- /dev/null +++ b/src/c/elementaryFunctions/cos/i16coss.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "cos.h" + +float i16coss(int16 x) { + return (cos((double)x)); +} diff --git a/src/c/elementaryFunctions/cos/i8cosa.c b/src/c/elementaryFunctions/cos/i8cosa.c new file mode 100644 index 00000000..2f0053c8 --- /dev/null +++ b/src/c/elementaryFunctions/cos/i8cosa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cos.h" + +void i8cosa(int8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8coss(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cos/i8coss.c b/src/c/elementaryFunctions/cos/i8coss.c new file mode 100644 index 00000000..4b344e1d --- /dev/null +++ b/src/c/elementaryFunctions/cos/i8coss.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "cos.h" + +float i8coss(int8 x) { + return (cos((double)x)); +} diff --git a/src/c/elementaryFunctions/cos/u16cosa.c b/src/c/elementaryFunctions/cos/u16cosa.c new file mode 100644 index 00000000..6e752e2b --- /dev/null +++ b/src/c/elementaryFunctions/cos/u16cosa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cos.h" + +void u16cosa(uint16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16coss(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cos/u16coss.c b/src/c/elementaryFunctions/cos/u16coss.c new file mode 100644 index 00000000..fb25ac56 --- /dev/null +++ b/src/c/elementaryFunctions/cos/u16coss.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "cos.h" + +float u16coss(uint16 x) { + return (cos((double)x)); +} diff --git a/src/c/elementaryFunctions/cos/u8cosa.c b/src/c/elementaryFunctions/cos/u8cosa.c new file mode 100644 index 00000000..ad129e12 --- /dev/null +++ b/src/c/elementaryFunctions/cos/u8cosa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cos.h" + +void u8cosa(uint8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8coss(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cos/u8coss.c b/src/c/elementaryFunctions/cos/u8coss.c new file mode 100644 index 00000000..26e2eba5 --- /dev/null +++ b/src/c/elementaryFunctions/cos/u8coss.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "cos.h" + +float u8coss(uint8 x) { + return (cos((double)x)); +} diff --git a/src/c/elementaryFunctions/cosh/i16cosha.c b/src/c/elementaryFunctions/cosh/i16cosha.c new file mode 100644 index 00000000..edb56f9c --- /dev/null +++ b/src/c/elementaryFunctions/cosh/i16cosha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cosh.h" + +void i16cosha(int16* x, int size, int16* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16coshs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cosh/i16coshs.c b/src/c/elementaryFunctions/cosh/i16coshs.c new file mode 100644 index 00000000..10d3eb95 --- /dev/null +++ b/src/c/elementaryFunctions/cosh/i16coshs.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) +// = 0.5 ( y + 1/y ) with y = exp(|z|) +*/ + +#include <math.h> +#include "cosh.h" +#include "exp.h" +#include "abs.h" +#include "types.h" + +float i16coshs(int16 x) { + double y = i16exps(i16abss(x)); + return (0.5 * (y + 1.0/y)); +} diff --git a/src/c/elementaryFunctions/cosh/i8cosha.c b/src/c/elementaryFunctions/cosh/i8cosha.c new file mode 100644 index 00000000..4ec75920 --- /dev/null +++ b/src/c/elementaryFunctions/cosh/i8cosha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cosh.h" + +void i8cosha(int8* x, int size, int8* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8coshs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cosh/i8coshs.c b/src/c/elementaryFunctions/cosh/i8coshs.c new file mode 100644 index 00000000..bc301221 --- /dev/null +++ b/src/c/elementaryFunctions/cosh/i8coshs.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) +// = 0.5 ( y + 1/y ) with y = exp(|z|) +*/ + +#include <math.h> +#include "cosh.h" +#include "exp.h" +#include "abs.h" +#include "types.h" + +float i8coshs(int8 x) { + double y = i8exps(i8abss(x)); + return (0.5 * (y + 1.0/y)); +} diff --git a/src/c/elementaryFunctions/cosh/u16cosha.c b/src/c/elementaryFunctions/cosh/u16cosha.c new file mode 100644 index 00000000..83d3786c --- /dev/null +++ b/src/c/elementaryFunctions/cosh/u16cosha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cosh.h" + +void u16cosha(uint16* x, int size, uint16* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16coshs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cosh/u16coshs.c b/src/c/elementaryFunctions/cosh/u16coshs.c new file mode 100644 index 00000000..22f6ded0 --- /dev/null +++ b/src/c/elementaryFunctions/cosh/u16coshs.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 + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) +// = 0.5 ( y + 1/y ) with y = exp(|z|) +*/ + +#include <math.h> +#include "cosh.h" +#include "exp.h" +#include "abs.h" +#include "types.h" + +float u16coshs(uint16 x) { + double y = u16exps(u16abss(x)); + return (0.5 * (y + 1.0/y)); +} diff --git a/src/c/elementaryFunctions/cosh/u8cosha.c b/src/c/elementaryFunctions/cosh/u8cosha.c new file mode 100644 index 00000000..4b44c28b --- /dev/null +++ b/src/c/elementaryFunctions/cosh/u8cosha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cosh.h" + +void u8cosha(uint8* x, int size, uint8* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8coshs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/cosh/u8coshs.c b/src/c/elementaryFunctions/cosh/u8coshs.c new file mode 100644 index 00000000..bed1eb93 --- /dev/null +++ b/src/c/elementaryFunctions/cosh/u8coshs.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +// cosh(z) = 0.5 (exp(|z|) + exp(-|z|)) +// = 0.5 ( y + 1/y ) with y = exp(|z|) +*/ + +#include <math.h> +#include "cosh.h" +#include "exp.h" +#include "abs.h" +#include "types.h" + +float u8coshs(uint8 x) { + double y = u8exps(u8abss(x)); + return (0.5 * (y + 1.0/y)); +} diff --git a/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c b/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c new file mode 100644 index 00000000..9ac76b5a --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/factor/dfactors.c @@ -0,0 +1,39 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +# 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) + { + out[k++]=2; + n = n/2; + } + + for (i = 3; i <= (int)sqrt((double)n); i = i+2) + { + while (n%i == 0) + { + out[k++]=i; + n = n/i; + } + } + + if (n > 2) + { + out[k++]=n; + } +} + diff --git a/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c b/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c new file mode 100644 index 00000000..a2eed09f --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/factor/sfactors.c @@ -0,0 +1,39 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +# 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) + { + out[k++]=2; + n = n/2; + } + + for (i = 3; i <= (int)sqrt((double)n); i = i+2) + { + while (n%i == 0) + { + out[k++]=i; + n = n/i; + } + } + + if (n > 2) + { + out[k++]=n; + } +} + diff --git a/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactoriala.c b/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactoriala.c new file mode 100644 index 00000000..68a118ba --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactoriala.c @@ -0,0 +1,23 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactorials.c b/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactorials.c new file mode 100644 index 00000000..354eb6a8 --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/factorial/dfactorials.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactoriala.c b/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactoriala.c new file mode 100644 index 00000000..14f46d84 --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactoriala.c @@ -0,0 +1,23 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactorials.c b/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactorials.c new file mode 100644 index 00000000..e4f1017b --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/factorial/sfactorials.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c b/src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c new file mode 100644 index 00000000..a32ed773 --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c @@ -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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "gcd.h" +#include "types.h" + +void dgcda(double *in,int size,double *out) +{ + double a=in[0]; + double b=in[1]; + while(a!=b && a!=0 && b!=0) + { + if(a>b) + { + a=a-b; + } + else + { + b=b-a; + } + } + out[0]=b; +} diff --git a/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c new file mode 100644 index 00000000..121d26ae --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c @@ -0,0 +1,62 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include<stdio.h> +/* This is the "gcd" function , which takes two input. first + one is the array and the second one is the length of the array. + Now to calculate the gcd of two elements we fin the maximum of + the two elements, and then iterate from maximum value down to 1, + and check whether the particular value divides the two elements. + And in this way we can calculate the gcd of the whole array. +*/ +#include "gcd.h" +uint8 u8gcdua(uint8* in,int size) +{ + + int temp; + if(size==1) + { + temp=*in; + } + else + { + int x=*in; + int y=*(in+1); + int max=(x>y)?x:y; + int i; + for(i=max;i>=1;i--) + { + if(x%i==0 && y%i==0) + { + temp=i; + break; + } + } + int j; + for(j=2;j<size;j++) + { + x=temp; + y=*(in+j); + max=(x>y)?x:y; + for(i=max;i>=1;i--) + { + if(x%i==0 && y%i==0) + { + temp=i; + break; + } + } + } +} + + return temp; +} + diff --git a/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c new file mode 100644 index 00000000..75f831fc --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c @@ -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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "gcd.h" +#include "types.h" + +int8 u8gcds(int8 *in,int size) +{ + int a=in[0]; + int b=in[1]; + while(a!=b && a!=0 && b!=0) + { + if(a>b) + { + a=a-b; + } + else + { + b=b-a; + } + } + return b; +} diff --git a/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c b/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c new file mode 100644 index 00000000..b01c8047 --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c @@ -0,0 +1,69 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include<stdio.h> +/* This is the "lcm" function, accepting two inputs which are the array of integers + and second the size of the array. The algorithm works like this: + We take a temproary variable and store the lcm of the first two elements of the + array in it. Now using this temproary variable we recursively fin the lcm of + the whole array. + Now to fin the lcm of two elements we fin the maximum of the two elements and + check whether it is divisible by both the elements, if the condition is true we + get the lcm, else increase the maximum value by itself unless we get the lcm. +*/ +#include "lcm.h" +uint8 u8lcma(uint8* in,int size) +{ + long long int lcm_temp; + if(size==1) + { + lcm_temp=*in; + } + else + { + + int x1=*in; + int x2=*(in+1); + long long int max=(x1>x2)?x1:x2; + long long int i=max; + while(1) + { + if(i%x1==0 && i%x2==0) + { + lcm_temp=i; + break; + } + else + i+=max; + } + int j; + for(j=2;j<size;j++) + { + x1=lcm_temp; + x2=*(in+j); + max=(x1>x2)?x1:x2; + i=max; + while(1) + { + if(i%x1==0 && i%x2==0) + { + lcm_temp=i; + break; + } + else + i+=max; + } + } + + } + return lcm_temp; +} + diff --git a/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c b/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c new file mode 100644 index 00000000..3aa0af4d --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c b/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c new file mode 100644 index 00000000..bff39d74 --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/exp/i16expa.c b/src/c/elementaryFunctions/exp/i16expa.c new file mode 100644 index 00000000..cd66c85c --- /dev/null +++ b/src/c/elementaryFunctions/exp/i16expa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "exp.h" + +void i16expa(int16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16exps(x[i]); + } +} diff --git a/src/c/elementaryFunctions/exp/i16exps.c b/src/c/elementaryFunctions/exp/i16exps.c new file mode 100644 index 00000000..12e85ee4 --- /dev/null +++ b/src/c/elementaryFunctions/exp/i16exps.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "exp.h" + +float i16exps(int16 x) { + return (expf(x)); +} diff --git a/src/c/elementaryFunctions/exp/i8expa.c b/src/c/elementaryFunctions/exp/i8expa.c new file mode 100644 index 00000000..e45becbd --- /dev/null +++ b/src/c/elementaryFunctions/exp/i8expa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "exp.h" + +void i8expa(int8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8exps(x[i]); + } +} diff --git a/src/c/elementaryFunctions/exp/i8exps.c b/src/c/elementaryFunctions/exp/i8exps.c new file mode 100644 index 00000000..8d33d203 --- /dev/null +++ b/src/c/elementaryFunctions/exp/i8exps.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "exp.h" + +float i8exps(int8 x) { + return (expf(x)); +} diff --git a/src/c/elementaryFunctions/exp/u16expa.c b/src/c/elementaryFunctions/exp/u16expa.c new file mode 100644 index 00000000..1655dfe9 --- /dev/null +++ b/src/c/elementaryFunctions/exp/u16expa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "exp.h" + +void u16expa(uint16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16exps(x[i]); + } +} diff --git a/src/c/elementaryFunctions/exp/u16exps.c b/src/c/elementaryFunctions/exp/u16exps.c new file mode 100644 index 00000000..d36cf1ef --- /dev/null +++ b/src/c/elementaryFunctions/exp/u16exps.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <math.h> +#include "exp.h" + +float u16exps(uint16 x) { + return (expf(x)); +} diff --git a/src/c/elementaryFunctions/exp/u8expa.c b/src/c/elementaryFunctions/exp/u8expa.c new file mode 100644 index 00000000..828fb3da --- /dev/null +++ b/src/c/elementaryFunctions/exp/u8expa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "exp.h" + +void u8expa(uint8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8exps(x[i]); + } +} diff --git a/src/c/elementaryFunctions/exp/u8exps.c b/src/c/elementaryFunctions/exp/u8exps.c new file mode 100644 index 00000000..cae731a2 --- /dev/null +++ b/src/c/elementaryFunctions/exp/u8exps.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "exp.h" + +float u8exps(uint8 x) { + return (expf(x)); +} diff --git a/src/c/elementaryFunctions/fix/i16fixa.c b/src/c/elementaryFunctions/fix/i16fixa.c new file mode 100644 index 00000000..07cd75b0 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i16fixa.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +void i16fixa(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/i16fixs.c b/src/c/elementaryFunctions/fix/i16fixs.c new file mode 100644 index 00000000..f133d8a3 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i16fixs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" + +int16 i16fixs(int16 x) { + if (x>=0) return i16floors(x); + else return i16ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/i8fixa.c b/src/c/elementaryFunctions/fix/i8fixa.c new file mode 100644 index 00000000..bb20f2d3 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i8fixa.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" + +void i8fixa(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/i8fixs.c b/src/c/elementaryFunctions/fix/i8fixs.c new file mode 100644 index 00000000..adeb3dd0 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i8fixs.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +int8 i8fixs(int8 x) { + if (x>=0) return i8floors(x); + else return i8ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/u16fixa.c b/src/c/elementaryFunctions/fix/u16fixa.c new file mode 100644 index 00000000..acddf8df --- /dev/null +++ b/src/c/elementaryFunctions/fix/u16fixa.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" + +void u16fixa(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/u16fixs.c b/src/c/elementaryFunctions/fix/u16fixs.c new file mode 100644 index 00000000..1ff7a8a5 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u16fixs.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +uint16 u16fixs(uint16 x) { + if (x>=0) return u16floors(x); + else return u16ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/u8fixa.c b/src/c/elementaryFunctions/fix/u8fixa.c new file mode 100644 index 00000000..c86545b9 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u8fixa.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" + +void u8fixa(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/u8fixs.c b/src/c/elementaryFunctions/fix/u8fixs.c new file mode 100644 index 00000000..c7740045 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u8fixs.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +uint8 u8fixs(uint8 x) { + if (x>=0) return u8floors(x); + else return u8ceils(x); +} diff --git a/src/c/elementaryFunctions/float/dfloata.c b/src/c/elementaryFunctions/float/dfloata.c new file mode 100644 index 00000000..9705bd1a --- /dev/null +++ b/src/c/elementaryFunctions/float/dfloata.c @@ -0,0 +1,18 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_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/src/c/elementaryFunctions/float/dfloats.c b/src/c/elementaryFunctions/float/dfloats.c new file mode 100644 index 00000000..ece554a8 --- /dev/null +++ b/src/c/elementaryFunctions/float/dfloats.c @@ -0,0 +1,16 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_float.h" + +float dfloats(double x) { + return (float) x; +} diff --git a/src/c/elementaryFunctions/float/i16floata.c b/src/c/elementaryFunctions/float/i16floata.c new file mode 100644 index 00000000..c8113af9 --- /dev/null +++ b/src/c/elementaryFunctions/float/i16floata.c @@ -0,0 +1,17 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_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/src/c/elementaryFunctions/float/i16floats.c b/src/c/elementaryFunctions/float/i16floats.c new file mode 100644 index 00000000..9f3ee063 --- /dev/null +++ b/src/c/elementaryFunctions/float/i16floats.c @@ -0,0 +1,16 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_float.h" + +float i16floats(int16 x) { + return (float) x; +} diff --git a/src/c/elementaryFunctions/float/i8floata.c b/src/c/elementaryFunctions/float/i8floata.c new file mode 100644 index 00000000..52f9a6a6 --- /dev/null +++ b/src/c/elementaryFunctions/float/i8floata.c @@ -0,0 +1,17 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_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/src/c/elementaryFunctions/float/i8floats.c b/src/c/elementaryFunctions/float/i8floats.c new file mode 100644 index 00000000..88127b3f --- /dev/null +++ b/src/c/elementaryFunctions/float/i8floats.c @@ -0,0 +1,16 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_float.h" + +float i8floats(int8 x) { + return (float) x; +} diff --git a/src/c/elementaryFunctions/float/sfloata.c b/src/c/elementaryFunctions/float/sfloata.c new file mode 100644 index 00000000..34337068 --- /dev/null +++ b/src/c/elementaryFunctions/float/sfloata.c @@ -0,0 +1,18 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_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/src/c/elementaryFunctions/float/sfloats.c b/src/c/elementaryFunctions/float/sfloats.c new file mode 100644 index 00000000..3351fb03 --- /dev/null +++ b/src/c/elementaryFunctions/float/sfloats.c @@ -0,0 +1,16 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_float.h" + +float sfloats(float x) { + return (float) x; +} diff --git a/src/c/elementaryFunctions/float/u16floata.c b/src/c/elementaryFunctions/float/u16floata.c new file mode 100644 index 00000000..febe5e08 --- /dev/null +++ b/src/c/elementaryFunctions/float/u16floata.c @@ -0,0 +1,17 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_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/src/c/elementaryFunctions/float/u16floats.c b/src/c/elementaryFunctions/float/u16floats.c new file mode 100644 index 00000000..47e19aed --- /dev/null +++ b/src/c/elementaryFunctions/float/u16floats.c @@ -0,0 +1,16 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_float.h" + +float u16floats(uint16 x) { + return (float) x; +} diff --git a/src/c/elementaryFunctions/float/u8floata.c b/src/c/elementaryFunctions/float/u8floata.c new file mode 100644 index 00000000..a4a1fec3 --- /dev/null +++ b/src/c/elementaryFunctions/float/u8floata.c @@ -0,0 +1,17 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_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/src/c/elementaryFunctions/float/u8floats.c b/src/c/elementaryFunctions/float/u8floats.c new file mode 100644 index 00000000..8b7dd8df --- /dev/null +++ b/src/c/elementaryFunctions/float/u8floats.c @@ -0,0 +1,16 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include "get_float.h" + +float u8floats(uint8 x) { + return (float) x; +} diff --git a/src/c/elementaryFunctions/floor/i16floora.c b/src/c/elementaryFunctions/floor/i16floora.c new file mode 100644 index 00000000..7b7a211b --- /dev/null +++ b/src/c/elementaryFunctions/floor/i16floora.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +void i16floora(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/i16floors.c b/src/c/elementaryFunctions/floor/i16floors.c new file mode 100644 index 00000000..cc35cf9a --- /dev/null +++ b/src/c/elementaryFunctions/floor/i16floors.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +int16 i16floors(int16 x) { + return (int16)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/i8floora.c b/src/c/elementaryFunctions/floor/i8floora.c new file mode 100644 index 00000000..5579321a --- /dev/null +++ b/src/c/elementaryFunctions/floor/i8floora.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +void i8floora(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/i8floors.c b/src/c/elementaryFunctions/floor/i8floors.c new file mode 100644 index 00000000..30967cdc --- /dev/null +++ b/src/c/elementaryFunctions/floor/i8floors.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +int8 i8floors(int8 x) { + return (int8)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/u16floora.c b/src/c/elementaryFunctions/floor/u16floora.c new file mode 100644 index 00000000..abff8077 --- /dev/null +++ b/src/c/elementaryFunctions/floor/u16floora.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +void u16floora(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/u16floors.c b/src/c/elementaryFunctions/floor/u16floors.c new file mode 100644 index 00000000..a1fca9b5 --- /dev/null +++ b/src/c/elementaryFunctions/floor/u16floors.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +uint16 u16floors(uint16 x) { + return (uint16)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/u8floora.c b/src/c/elementaryFunctions/floor/u8floora.c new file mode 100644 index 00000000..04a980e9 --- /dev/null +++ b/src/c/elementaryFunctions/floor/u8floora.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +void u8floora(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/u8floors.c b/src/c/elementaryFunctions/floor/u8floors.c new file mode 100644 index 00000000..87a4e1fd --- /dev/null +++ b/src/c/elementaryFunctions/floor/u8floors.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "floor.h" + +uint8 u8floors(uint8 x) { + return (uint8)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/includes/acosd.h b/src/c/elementaryFunctions/includes/acosd.h new file mode 100644 index 00000000..96dae80a --- /dev/null +++ b/src/c/elementaryFunctions/includes/acosd.h @@ -0,0 +1,33 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOSD_H__ +#define __ACOSD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacosds(double x); + +void dacosda(double* x, int size, double* y); + +double sacosds(float x); + +void sacosda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOSD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acot.h b/src/c/elementaryFunctions/includes/acot.h new file mode 100644 index 00000000..430be12d --- /dev/null +++ b/src/c/elementaryFunctions/includes/acot.h @@ -0,0 +1,43 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOT_H__ +#define __ACOT_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacots(double x); + +void dacota(double* x, int size, double* y); + +float sacots(float x); + +void sacota(float* x, int size, float* y); + +floatComplex cacots(floatComplex x); + +void cacota(floatComplex* x, int size, floatComplex* y); + +doubleComplex zacots(doubleComplex x); + +void zacota(doubleComplex* x, int size, doubleComplex* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOT_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acotd.h b/src/c/elementaryFunctions/includes/acotd.h new file mode 100644 index 00000000..3be05ccf --- /dev/null +++ b/src/c/elementaryFunctions/includes/acotd.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOTD_H__ +#define __ACOTD_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dacotds(double x); + +void dacotda(double* x, int size, double* y); + +float sacotds(float x); + +void sacotda(float* x, int size, float* y); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acoth.h b/src/c/elementaryFunctions/includes/acoth.h new file mode 100644 index 00000000..975182fe --- /dev/null +++ b/src/c/elementaryFunctions/includes/acoth.h @@ -0,0 +1,44 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOTH_H__ +#define __ACOTH_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dacoths(double x); + +void dacotha(double* x, int size, double* y); + +float sacoths(float x); + +void sacotha(float* x, int size, float* y); + +floatComplex cacoths(floatComplex x); + +void cacotha(floatComplex* x, int size, floatComplex* y); + +doubleComplex zacoths(doubleComplex x); + +void zacotha(doubleComplex* x, int size, doubleComplex* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTH_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acsc.h b/src/c/elementaryFunctions/includes/acsc.h new file mode 100644 index 00000000..be6455a4 --- /dev/null +++ b/src/c/elementaryFunctions/includes/acsc.h @@ -0,0 +1,44 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __ACSC_H__ +#define __ACSC_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacscs(double x); + +void dacsca(double* x, int size, double* y); + +float sacscs(float x); + +void sacsca(float* x, int size, float* y); + +floatComplex cacscs(floatComplex x); + +void cacsca(floatComplex* x, int size, floatComplex* y); + +doubleComplex zacscs(doubleComplex x); + +void zacsca(doubleComplex* x, int size, doubleComplex* y); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSC_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acscd.h b/src/c/elementaryFunctions/includes/acscd.h new file mode 100644 index 00000000..3c5bb18d --- /dev/null +++ b/src/c/elementaryFunctions/includes/acscd.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __ACSCD_H__ +#define __ACSCD_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacscds(double x); + +void dacscda(double* x, int size, double* y); + +float sacscds(float x); + +void sacscda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acsch.h b/src/c/elementaryFunctions/includes/acsch.h new file mode 100644 index 00000000..ba2b1e1d --- /dev/null +++ b/src/c/elementaryFunctions/includes/acsch.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __ACSCH_H__ +#define __ACSCH_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacschs(double x); + +void dacscha(double* x, int size, double* y); + +double sacschs(float x); + +void sacscha(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCH_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asec.h b/src/c/elementaryFunctions/includes/asec.h new file mode 100644 index 00000000..8d1a65d1 --- /dev/null +++ b/src/c/elementaryFunctions/includes/asec.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASEC_H__ +#define __ASEC_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasecs(double x); + +void daseca(double* x, int size, double* y); + +double sasecs(float x); + +void saseca(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASEC_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asecd.h b/src/c/elementaryFunctions/includes/asecd.h new file mode 100644 index 00000000..104677bd --- /dev/null +++ b/src/c/elementaryFunctions/includes/asecd.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASECD_H__ +#define __ASECD_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasecds(double x); + +void dasecda(double* x, int size, double* y); + +double sasecds(float x); + +void sasecda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asech.h b/src/c/elementaryFunctions/includes/asech.h new file mode 100644 index 00000000..5e6c5e9c --- /dev/null +++ b/src/c/elementaryFunctions/includes/asech.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASECH_H__ +#define __ASECH_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasechs(double x); + +void dasecha(double* x, int size, double* y); + +double sasechs(float x); + +void sasecha(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECH_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asind.h b/src/c/elementaryFunctions/includes/asind.h new file mode 100644 index 00000000..8f7d7102 --- /dev/null +++ b/src/c/elementaryFunctions/includes/asind.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASIND_H__ +#define __ASIND_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasinds(double x); + +void dasinda(double* x, int size, double* y); + +double sasinds(float x); + +void sasinda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASIND_H__ */ + diff --git a/src/c/elementaryFunctions/includes/atand.h b/src/c/elementaryFunctions/includes/atand.h new file mode 100644 index 00000000..ed10f09f --- /dev/null +++ b/src/c/elementaryFunctions/includes/atand.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ATAND_H__ +#define __ATAND_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double datands(double x); + +void datanda(double* x, int size, double* y); + +double satands(float x); + +void satanda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ATAND_H__ */ + diff --git a/src/c/elementaryFunctions/includes/base2dec.h b/src/c/elementaryFunctions/includes/base2dec.h new file mode 100644 index 00000000..426388ef --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/bin2dec.h b/src/c/elementaryFunctions/includes/bin2dec.h new file mode 100644 index 00000000..ea1585f5 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/bitand.h b/src/c/elementaryFunctions/includes/bitand.h new file mode 100644 index 00000000..ee132625 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitand.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __BITAND_H__ +#define __BITAND_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* bitand returns the logical AND operation + 12 = 00001100 (In Binary) + 25 = 00011001 (In Binary) + +Bit Operation of 12 and 25 + 00001100 +& 00011001 + ________ + 00001000 = 8 (In decimal) +*/ + +uint8 u8bitands(uint8 in1,uint8 in2); + +void u8bitanda(uint8* in1,uint8* in2,int size,uint8* out); + +uint16 u16bitands(uint16 in1,uint16 in2); + +void u16bitanda(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +#endif /* !__BITAND_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitcmp.h b/src/c/elementaryFunctions/includes/bitcmp.h new file mode 100644 index 00000000..ead0b827 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitcmp.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __BITCMP_H__ +#define __BITCMP_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* bitcmp returns the complement +35=00100011 (In Binary) + +Bitwise complement Operation of 35 +~ 00100011 + ________ + 11011100 = 220 (In decimal) +*/ + +EXTERN_ELEMFUNCT uint8 u8bitcmps(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitcmpa(uint8* in1,uint8 in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitcmps(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitcmpa(uint16* in1,uint16 in2,int size,uint16* out); + + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITCMP_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitget.h b/src/c/elementaryFunctions/includes/bitget.h new file mode 100644 index 00000000..9e12abdc --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitget.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __BITGET_H__ +#define __BITGET_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT uint8 u8bitgets(uint8 value,int position); + +EXTERN_ELEMFUNCT uint16 u16bitgets(uint16 value,int position); + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITGET_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitor.h b/src/c/elementaryFunctions/includes/bitor.h new file mode 100644 index 00000000..3f2ae085 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitor.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __BITOR_H__ +#define __BITOR_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* bitor returns the logical OR operation + 12 = 00001100 (In Binary) +25 = 00011001 (In Binary) + +Bitwise OR Operation of 12 and 25 + 00001100 +| 00011001 + ________ + 00011101 = 29 (In decimal) */ + +EXTERN_ELEMFUNCT uint8 u8bitors(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitora(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitors(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitora(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITOR_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitset.h b/src/c/elementaryFunctions/includes/bitset.h new file mode 100644 index 00000000..5d519de9 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitset.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __BITSET_H__ +#define __BITSET_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT uint8 u8bitsets(uint8 value,int position,int bit_value); + +EXTERN_ELEMFUNCT uint16 u16bitsets(uint16 value,int position,int bit_value); + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITSET_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitxor.h b/src/c/elementaryFunctions/includes/bitxor.h new file mode 100644 index 00000000..5d429571 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitxor.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __BITXOR_H__ +#define __BITXOR_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* bitxor returns the logical OR operation + 12 = 00001100 (In Binary) +25 = 00011001 (In Binary) + +Bitwise XOR Operation of 12 and 25 + 00001100 +^ 00011001 + ________ + 00010101 = 21 (In decimal) */ + +EXTERN_ELEMFUNCT uint8 u8bitxors(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitxora(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitxors(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitxora(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITXOR_H__ */ diff --git a/src/c/elementaryFunctions/includes/ceil.h b/src/c/elementaryFunctions/includes/ceil.h index 960b8b3b..57df72d5 100644 --- a/src/c/elementaryFunctions/includes/ceil.h +++ b/src/c/elementaryFunctions/includes/ceil.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus @@ -33,6 +34,14 @@ EXTERN_ELEMFUNCT floatComplex cceils(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zceils(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8ceils(uint8 in); + +EXTERN_ELEMFUNCT int8 i8ceils(int8 in); + +EXTERN_ELEMFUNCT uint16 u16ceils(uint16 in); + +EXTERN_ELEMFUNCT int16 i16ceils(int16 in); + EXTERN_ELEMFUNCT void sceila(float* in, int size, float* out); EXTERN_ELEMFUNCT void dceila(double* in, int size, double* out); @@ -41,6 +50,14 @@ EXTERN_ELEMFUNCT void cceila(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zceila(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8ceila(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8ceila(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16ceila(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16ceila(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/cos.h b/src/c/elementaryFunctions/includes/cos.h index 5d573b1e..25c76945 100644 --- a/src/c/elementaryFunctions/includes/cos.h +++ b/src/c/elementaryFunctions/includes/cos.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -49,6 +50,30 @@ EXTERN_ELEMFUNCT floatComplex ccoss(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zcoss(doubleComplex in); /* +** \brief Uint8 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u8coss(uint8 in); + +/* +** \brief Int8 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i8coss(int8 in); + +/* +** \brief Uint16 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u16coss(uint16 in); + +/* +** \brief Int8 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i16coss(int16 in); + +/* ** \brief Float Matrix Cosine function ** \param in : input array value. ** \param out : output array value. @@ -80,6 +105,38 @@ EXTERN_ELEMFUNCT void ccosa(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void zcosa(doubleComplex* in, int size, doubleComplex* out); +/* +** \brief uint8 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u8cosa(uint8* in, int size, float* out); + +/* +** \brief int8 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i8cosa(int8* in, int size, float* out); + +/* +** \brief uint16 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u16cosa(uint16* in, int size, float* out); + +/* +** \brief int16 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i16cosa(int16* in, int size, float* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/cosd.h b/src/c/elementaryFunctions/includes/cosd.h new file mode 100644 index 00000000..7cb59be1 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/cosh.h b/src/c/elementaryFunctions/includes/cosh.h index 0cbf8eb4..5c7c8b71 100644 --- a/src/c/elementaryFunctions/includes/cosh.h +++ b/src/c/elementaryFunctions/includes/cosh.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus @@ -50,6 +51,30 @@ EXTERN_ELEMFUNCT floatComplex ccoshs(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zcoshs(doubleComplex in); /* +** \brief uint8 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u8coshs(uint8 in); + +/* +** \brief int8 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i8coshs(int8 in); + +/* +** \brief uint16 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u16coshs(uint16 in); + +/* +** \brief int16 Cosine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i16coshs(int16 in); + +/* ** \brief Float Matrix Cosine function ** \param in : input array value. ** \param out : output array value. @@ -81,6 +106,39 @@ EXTERN_ELEMFUNCT void ccosha(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void zcosha(doubleComplex* in, int size, doubleComplex* out); +/* +** \brief Uint8 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u8cosha(uint8* in, int size, uint8* out); + +/* +** \brief Int8 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i8cosha(int8* in, int size, int8* out); + +/* +** \brief Uint16 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u16cosha(uint16* in, int size, uint16* out); + +/* +** \brief Int16 Matrix Cosine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i16cosha(int16* in, int size, int16* out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/cotd.h b/src/c/elementaryFunctions/includes/cotd.h new file mode 100644 index 00000000..d2140cb0 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/coth.h b/src/c/elementaryFunctions/includes/coth.h new file mode 100644 index 00000000..ac3f82c7 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/csc.h b/src/c/elementaryFunctions/includes/csc.h new file mode 100644 index 00000000..6914c933 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/cscd.h b/src/c/elementaryFunctions/includes/cscd.h new file mode 100644 index 00000000..fad31551 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/csch.h b/src/c/elementaryFunctions/includes/csch.h new file mode 100644 index 00000000..fd7b8cd1 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/dec2base.h b/src/c/elementaryFunctions/includes/dec2base.h new file mode 100644 index 00000000..aa830072 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/dec2bin.h b/src/c/elementaryFunctions/includes/dec2bin.h new file mode 100644 index 00000000..d0917bba --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/dec2hex.h b/src/c/elementaryFunctions/includes/dec2hex.h new file mode 100644 index 00000000..e973a871 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/dec2oct.h b/src/c/elementaryFunctions/includes/dec2oct.h new file mode 100644 index 00000000..b0e38fa5 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/exp.h b/src/c/elementaryFunctions/includes/exp.h index 297a5769..6e8f027c 100644 --- a/src/c/elementaryFunctions/includes/exp.h +++ b/src/c/elementaryFunctions/includes/exp.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus @@ -50,6 +51,30 @@ EXTERN_ELEMFUNCT floatComplex cexps(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zexps(doubleComplex in); /* +** \brief Uint8 Exponential function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u8exps(uint8 in); + +/* +** \brief Int8 Exponential function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i8exps(int8 in); + +/* +** \brief Uint16 Exponential function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u16exps(uint16 in); + +/* +** \brief Int16 Exponential function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i16exps(int16 in); + +/* ** \brief Float Matrix Exponential function ** \param in : input array value. ** \param out : output array value. @@ -81,6 +106,39 @@ EXTERN_ELEMFUNCT void cexpa(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void zexpa(doubleComplex* in, int size, doubleComplex* out); +/* +** \brief Uint8 Matrix Exponential function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u8expa(uint8* in, int size, float* out); + +/* +** \brief Int8 Matrix Exponential function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i8expa(int8* in, int size, float* out); + +/* +** \brief Uint16 Matrix Exponential function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u16expa(uint16* in, int size, float* out); + +/* +** \brief Int16 Matrix Exponential function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i16expa(int16* in, int size, float* out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/factor.h b/src/c/elementaryFunctions/includes/factor.h new file mode 100644 index 00000000..bec7277b --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/factorial.h b/src/c/elementaryFunctions/includes/factorial.h new file mode 100644 index 00000000..077191e3 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/fix.h b/src/c/elementaryFunctions/includes/fix.h index 504a63c1..592905b4 100644 --- a/src/c/elementaryFunctions/includes/fix.h +++ b/src/c/elementaryFunctions/includes/fix.h @@ -16,6 +16,10 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" +#include "floor.h" +#include "ceil.h" + #ifdef __cplusplus extern "C" { @@ -35,6 +39,14 @@ EXTERN_ELEMFUNCT floatComplex cfixs(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zfixs(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8fixs(uint8 in); + +EXTERN_ELEMFUNCT int8 i8fixs(int8 in); + +EXTERN_ELEMFUNCT uint16 u16fixs(uint16 in); + +EXTERN_ELEMFUNCT int16 i16fixs(int16 in); + EXTERN_ELEMFUNCT void sfixa(float* in, int size, float* out); EXTERN_ELEMFUNCT void dfixa(double* in, int size, double* out); @@ -43,6 +55,14 @@ EXTERN_ELEMFUNCT void cfixa(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zfixa(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8fixa(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8fixa(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16fixa(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16fixa(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/floor.h b/src/c/elementaryFunctions/includes/floor.h index 971cdf65..cd566416 100644 --- a/src/c/elementaryFunctions/includes/floor.h +++ b/src/c/elementaryFunctions/includes/floor.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -32,6 +33,14 @@ EXTERN_ELEMFUNCT floatComplex cfloors(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zfloors(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8floors(uint8 in); + +EXTERN_ELEMFUNCT int8 i8floors(int8 in); + +EXTERN_ELEMFUNCT uint16 u16floors(uint16 in); + +EXTERN_ELEMFUNCT int16 i16floors(int16 in); + EXTERN_ELEMFUNCT void sfloora(float* in, int size, float* out); EXTERN_ELEMFUNCT void dfloora(double* in, int size, double* out); @@ -40,6 +49,14 @@ EXTERN_ELEMFUNCT void cfloora(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zfloora(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8floora(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8floora(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16floora(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16floora(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/gcd.h b/src/c/elementaryFunctions/includes/gcd.h new file mode 100644 index 00000000..179eea0e --- /dev/null +++ b/src/c/elementaryFunctions/includes/gcd.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __GCD_H__ +#define __GCD_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C"{ + #endif + +uint8 u8gcda(uint8* in,int size); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__GCD_H__*/ diff --git a/src/c/elementaryFunctions/includes/get_float.h b/src/c/elementaryFunctions/includes/get_float.h new file mode 100644 index 00000000..285cb9c9 --- /dev/null +++ b/src/c/elementaryFunctions/includes/get_float.h @@ -0,0 +1,56 @@ +/* + * 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 __GET_FLOAT_H__ +#define __GET_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 u8floats(uint8 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 /* !__GET_FLOAT_H__ */ + diff --git a/src/c/elementaryFunctions/includes/hex2dec.h b/src/c/elementaryFunctions/includes/hex2dec.h new file mode 100644 index 00000000..f16a8541 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/int16.h b/src/c/elementaryFunctions/includes/int16.h new file mode 100644 index 00000000..6135e6b0 --- /dev/null +++ b/src/c/elementaryFunctions/includes/int16.h @@ -0,0 +1,54 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT16_H__ +#define __INT16_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + int16(X) returns the signed int part of the double value +*/ + +EXTERN_ELEMFUNCT int16 sint16s(float in); + +EXTERN_ELEMFUNCT int16 dint16s(double in); + +EXTERN_ELEMFUNCT int16 u8int16s(uint8 in); + +EXTERN_ELEMFUNCT int16 i8int16s(int8 in); + +EXTERN_ELEMFUNCT int16 u16int16s(uint16 in); + +EXTERN_ELEMFUNCT void sint16a(float* in, int size, int16* out); + +EXTERN_ELEMFUNCT void dint16a(double* in, int size, int16* out); + +EXTERN_ELEMFUNCT void u8int16a(uint8* in, int size, int16* out); + +EXTERN_ELEMFUNCT void i8int16a(int8* in, int size, int16* out); + +EXTERN_ELEMFUNCT void u16int16a(uint16* in, int size, int16* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__INT16_H__ */ + diff --git a/src/c/elementaryFunctions/includes/int32.h b/src/c/elementaryFunctions/includes/int32.h new file mode 100644 index 00000000..26b7bcbf --- /dev/null +++ b/src/c/elementaryFunctions/includes/int32.h @@ -0,0 +1,62 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT32_H__ +#define __INT32_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + int32(X) returns the signed int part of the double value +*/ + +EXTERN_ELEMFUNCT int32 sint32s(float in); + +EXTERN_ELEMFUNCT int32 dint32s(double in); + +EXTERN_ELEMFUNCT int32 u8int32s(uint8 in); + +EXTERN_ELEMFUNCT int32 i8int32s(int8 in); + +EXTERN_ELEMFUNCT int32 u16int32s(uint16 in); + +EXTERN_ELEMFUNCT int32 i16int32s(int16 in); + +EXTERN_ELEMFUNCT int32 u32int32s(uint32 in); + +EXTERN_ELEMFUNCT void sint32a(float* in, int size, int32* out); + +EXTERN_ELEMFUNCT void dint32a(double* in, int size, int32* out); + +EXTERN_ELEMFUNCT void u8int32a(uint8* in, int size, int32* out); + +EXTERN_ELEMFUNCT void i8int32a(int8* in, int size, int32* out); + +EXTERN_ELEMFUNCT void u16int32a(uint16* in, int size, int32* out); + +EXTERN_ELEMFUNCT void i16int32a(int16* in, int size, int32* out); + +EXTERN_ELEMFUNCT void u32int32a(uint32* in, int size, int32* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__INT32_H__ */ + diff --git a/src/c/elementaryFunctions/includes/int8.h b/src/c/elementaryFunctions/includes/int8.h new file mode 100644 index 00000000..0ac8723f --- /dev/null +++ b/src/c/elementaryFunctions/includes/int8.h @@ -0,0 +1,54 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT8_H__ +#define __INT8_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + int8(X) returns the signed char part of the double value +*/ + +EXTERN_ELEMFUNCT int8 sint8s(float in); + +EXTERN_ELEMFUNCT int8 dint8s(double in); + +EXTERN_ELEMFUNCT int8 u8int8s(uint8 in); + +EXTERN_ELEMFUNCT int8 u16int8s(uint16 in); + +EXTERN_ELEMFUNCT int8 i16int8s(int16 in); + +EXTERN_ELEMFUNCT void sint8a(float* in, int size, int8* out); + +EXTERN_ELEMFUNCT void dint8a(double* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u8int8a(uint8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16int8a(uint16* in, int size, int8* out); + +EXTERN_ELEMFUNCT void i16int8a(int16* in, int size, int8* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__INT8_H__ */ + diff --git a/src/c/elementaryFunctions/includes/iscolumn.h b/src/c/elementaryFunctions/includes/iscolumn.h new file mode 100644 index 00000000..e9711766 --- /dev/null +++ b/src/c/elementaryFunctions/includes/iscolumn.h @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ISCOLUMN_H__ +#define __ISCOLUMN_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char discolumna(double* , int); +char discolumns(double); +char siscolumna( float* , int); +char siscolumns( float); +char giscolumna(char* , int); +char giscolumns(char); +char ziscolumna(doubleComplex*, int); +char ziscolumns(doubleComplex); +char u16iscolumna(uint16*, int); +char u16iscolumns(uint16); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/isequal.h b/src/c/elementaryFunctions/includes/isequal.h new file mode 100644 index 00000000..d22a8047 --- /dev/null +++ b/src/c/elementaryFunctions/includes/isequal.h @@ -0,0 +1,38 @@ + /* 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 __ISEQUAL_H__ +#define __ISEQUAL_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char disequals(double inp1, double inp2); +char disequala(double* inp1, int size1r, int size1c, double* inp2, int size2r, int size2c); +char sisequals(float inp1, float inp2); +char sisequala(float* inp1, int size1r, int size1c, float* inp2, int size2r, int size2c); +char zisequals(doubleComplex inp1, doubleComplex inp2); +char zisequala(doubleComplex* inp1, int size1r, int size1c, doubleComplex* inp2, int size2r, int size2c); +char u16isequals(uint16 inp1, uint16 inp2); +char u16isequala(uint16* inp1, int size1r, int size1c, uint16* inp2, int size2r, int size2c); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ISEQUAL_H__*/ diff --git a/src/c/elementaryFunctions/includes/isinf.h b/src/c/elementaryFunctions/includes/isinf.h new file mode 100644 index 00000000..6752c377 --- /dev/null +++ b/src/c/elementaryFunctions/includes/isinf.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 __ISINF_H__ +#define __ISINF_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char disinfs(double x); +char sisinfs(float x); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__ISINF_H__ */ + diff --git a/src/c/elementaryFunctions/includes/ismatrix.h b/src/c/elementaryFunctions/includes/ismatrix.h new file mode 100644 index 00000000..0dd8b4a3 --- /dev/null +++ b/src/c/elementaryFunctions/includes/ismatrix.h @@ -0,0 +1,41 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ISMATRIX_H__ +#define __ISMATRIX_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char dismatrixa(double*); +char dismatrixs(double); +char sismatrixa(float*); +char sismatrixs(float); +char gismatrixa(char*); +char gismatrixs(char); +char zismatrixa(doubleComplex*); +char zismatrixs(doubleComplex); +char u16ismatrixa(uint16*); +char u16ismatrixs(uint16); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/isreal.h b/src/c/elementaryFunctions/includes/isreal.h new file mode 100644 index 00000000..0183ebce --- /dev/null +++ b/src/c/elementaryFunctions/includes/isreal.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-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 __ISREAL_H__ +#define __ISREAL_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +float sisreals(float a); + +double disreals(double a); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/isrow.h b/src/c/elementaryFunctions/includes/isrow.h new file mode 100644 index 00000000..2de7da3d --- /dev/null +++ b/src/c/elementaryFunctions/includes/isrow.h @@ -0,0 +1,41 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ISROW_H__ +#define __ISROW_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char disrowa(double* , int); +char disrows(double); +char sisrowa( float* , int); +char sisrows( float); +char gisrowa(char* , int); +char gisrows(char); +char zisrowa(doubleComplex*, int); +char zisrows(doubleComplex); +char u16isrowa(uint16*, int); +char u16isrows(uint16); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/isscalar.h b/src/c/elementaryFunctions/includes/isscalar.h new file mode 100644 index 00000000..f4880437 --- /dev/null +++ b/src/c/elementaryFunctions/includes/isscalar.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ISSCALAR_H__ +#define __ISSCALAR_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char disscalara(double* , int); +char disscalars(double); +char sisscalara( float* , int); +char sisscalars( float); +char gisscalara(char* , int); +char gisscalars(char); +char zisscalara(doubleComplex*, int); +char zisscalars(doubleComplex); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/issquare.h b/src/c/elementaryFunctions/includes/issquare.h new file mode 100644 index 00000000..70e4c455 --- /dev/null +++ b/src/c/elementaryFunctions/includes/issquare.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ISSQUARE_H__ +#define __ISSQUARE_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char dissquarea(double* , int, int); +char dissquares(double); +char sissquarea( float* , int, int); +char sissquares( float); +char gissquarea(char* , int, int); +char gissquares(char); +char zissquarea(doubleComplex*, int, int); +char zissquares(doubleComplex); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/isvector.h b/src/c/elementaryFunctions/includes/isvector.h new file mode 100644 index 00000000..75599cdd --- /dev/null +++ b/src/c/elementaryFunctions/includes/isvector.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __ISVECTOR_H__ +#define __ISVECTOR_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char disvectora(double* , int, int); +char disvectors(double); +char sisvectora( float* , int, int); +char sisvectors( float); +char gisvectora(char* , int, int ); +char gisvectors(char); +char zisvectora(doubleComplex*, int, int); +char zisvectors(doubleComplex); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/lcm.h b/src/c/elementaryFunctions/includes/lcm.h new file mode 100644 index 00000000..3a3e66fb --- /dev/null +++ b/src/c/elementaryFunctions/includes/lcm.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __LCM_H__ +#define __LCM_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8lcma(uint8* in,int size); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__LCM_H__*/ + diff --git a/src/c/elementaryFunctions/includes/linspace.h b/src/c/elementaryFunctions/includes/linspace.h new file mode 100644 index 00000000..62d45015 --- /dev/null +++ b/src/c/elementaryFunctions/includes/linspace.h @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __LINSPACE_H__ +#define __LINSPACE_H__ + +#include "dynlib_elementaryfunctions.h" +#ifdef __cplusplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT void dlinspaces(double low_limit,double up_limit,double range_num, double* out); + +EXTERN_ELEMFUNCT void slinspaces(float low_limit,float up_limit,float range_num, float* out); + +EXTERN_ELEMFUNCT void dlinspacea(double *low_limit,int row,double *up_limit,double range_num, double* out); + +EXTERN_ELEMFUNCT void slinspacea(float *low_limit,int row,float *up_limit,float range_num, float* out); + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__LINSPACE_H__ */ + diff --git a/src/c/elementaryFunctions/includes/log2.h b/src/c/elementaryFunctions/includes/log2.h new file mode 100644 index 00000000..e7b2affb --- /dev/null +++ b/src/c/elementaryFunctions/includes/log2.h @@ -0,0 +1,39 @@ + /* 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 __LOG2_H__ +#define __LOG2_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" +#include "log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dlog2s(double inp); +float slog2s(float inp); +doubleComplex zlog2s(doubleComplex inp); +void dlog2a(double* inp,int size, double* out); +void slog2a(float* inp,int size, float* out); +void zlog2a(doubleComplex* inp,int size, doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__LOG2_H__ */ + diff --git a/src/c/elementaryFunctions/includes/logspace.h b/src/c/elementaryFunctions/includes/logspace.h new file mode 100644 index 00000000..eee39de7 --- /dev/null +++ b/src/c/elementaryFunctions/includes/logspace.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __LOGSPACE_H__ +#define __LOGSPACE_H__ + +#include "dynlib_elementaryfunctions.h" +#ifdef __cplusplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT void dlogspaces(double low_limit,double up_limit,double range_num, double* out); + +EXTERN_ELEMFUNCT void dlogspacea(double *low_limit,int row,double *up_limit,double range_num, double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__LOGSPACE_H__ */ + diff --git a/src/c/elementaryFunctions/includes/nancumsum.h b/src/c/elementaryFunctions/includes/nancumsum.h new file mode 100644 index 00000000..48ccc96e --- /dev/null +++ b/src/c/elementaryFunctions/includes/nancumsum.h @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __NANCUMSUM_H__ +#define __NANCUMSUM_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dnancumsuma(double* , int , double*); +void dnancumsumrowa(double*, int, int, double*); +void dnancumsumcola(double*, int, int, double*); + +void snancumsuma(float* , int, float* ); +void snancumsumrowa(float*, int, int, float*); +void snancumsumcola(float*, int, int, float*); + +void znancumsuma(doubleComplex* , int , doubleComplex*); +void znancumsumrowa(doubleComplex*, int, int, doubleComplex*); +void znancumsumcola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NANCUMSUM_H__*/ diff --git a/src/c/elementaryFunctions/includes/nanmax.h b/src/c/elementaryFunctions/includes/nanmax.h new file mode 100644 index 00000000..83cfa0e9 --- /dev/null +++ b/src/c/elementaryFunctions/includes/nanmax.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __NANMAX_H__ +#define __NANMAX_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmaxa (double* , int); +double dnanmax1a (double* , int, int , double*); +double dnanmax2a (double* , int, double*); +void dnanmaxrowa (double*, int , int, double*, double*); +void dnanmaxcola (double*, int , int, double*, double*); +void dnanmaxrow1a (double*, int , int, double*); +void dnanmaxcol1a (double*, int , int, double*); + +float snanmaxa (float* , int); +float snanmax1a (float* , int, int , float*); +float snanmax2a (float* , int, float*); +void snanmaxrowa (float*, int , int, float*, float*); +void snanmaxcola (float*, int , int, float*, float*); +void snanmaxrow1a (float*, int , int, float*); +void snanmaxcol1a (float*, int , int, float*); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/nanmean.h b/src/c/elementaryFunctions/includes/nanmean.h new file mode 100644 index 00000000..097fec4e --- /dev/null +++ b/src/c/elementaryFunctions/includes/nanmean.h @@ -0,0 +1,42 @@ +/* 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 +*/ + +#ifndef __NANMEAN_H__ +#define __NANMEAN_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmeana(double* in, int size); +void dnanmeancola(double *in, int row, int col, double* out); +void dnanmeanrowa(double *in, int row, int col, double* out); + +float snanmeana(float* in, int size); +void snanmeancola(float *in, int row, int col, float* out); +void snanmeanrowa(float *in, int row, int col, float* out); + +doubleComplex znanmeana(doubleComplex* in, int size); +void znanmeancola(doubleComplex *in, int row, int col, doubleComplex* out); +void znanmeanrowa(doubleComplex *in, int row, int col, doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NANMEAN_H__*/ diff --git a/src/c/elementaryFunctions/includes/nanmin.h b/src/c/elementaryFunctions/includes/nanmin.h new file mode 100644 index 00000000..34bbfefd --- /dev/null +++ b/src/c/elementaryFunctions/includes/nanmin.h @@ -0,0 +1,42 @@ +/* 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 +*/ + +#ifndef __NANMIN_H__ +#define __NANMIN_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmina(double* in, int row, int col, double* pos); +double dnanminnpa(double* in, int row, int col); +double dnanmins(double in, double* pos); +double dnanminnps(double in); + +void dnanminrownpa(double *in, int row, int col, double* out); +void dnanmincolnpa(double *in, int row, int col, double* out); +void dnanminrowa(double *in, int row, int col, double *out, double *p); +void dnanmincola(double *in, int row, int col, double *out, double *p); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NANMIN_H__*/ diff --git a/src/c/elementaryFunctions/includes/nansum.h b/src/c/elementaryFunctions/includes/nansum.h new file mode 100644 index 00000000..5a366631 --- /dev/null +++ b/src/c/elementaryFunctions/includes/nansum.h @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __NANSUM_H__ +#define __NANSUM_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnansuma(double* , int ); +void dnansumrowa(double*, int, int, double*); +void dnansumcola(double*, int, int, double*); + +float snansuma(float* , int ); +void snansumrowa(float*, int, int, float*); +void snansumcola(float*, int, int, float*); + +doubleComplex znansuma(doubleComplex* , int ); +void znansumrowa(doubleComplex*, int, int, doubleComplex*); +void znansumcola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MATRIX_H__*/ diff --git a/src/c/elementaryFunctions/includes/nextpow2.h b/src/c/elementaryFunctions/includes/nextpow2.h new file mode 100644 index 00000000..c86bea01 --- /dev/null +++ b/src/c/elementaryFunctions/includes/nextpow2.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __NEXTPOW2_H__ +#define __NEXTPOW2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void dnextpow2a(double *in,int size,double *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif + diff --git a/src/c/elementaryFunctions/includes/nthroot.h b/src/c/elementaryFunctions/includes/nthroot.h new file mode 100644 index 00000000..62b533a0 --- /dev/null +++ b/src/c/elementaryFunctions/includes/nthroot.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __NTHROOT_H__ +#define __NTHROOT_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dnthroota(double* , int ,int , double*, int , int, double*); +void dnthroot1a(double*, int , int, double, double*); +double dnthroots(double, double); +void snthroota(float* , int ,int , float*, int , int, double*); +void snthroot1a(float*, int , int, float, double*); +double snthroots(float, float); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/oct2dec.h b/src/c/elementaryFunctions/includes/oct2dec.h new file mode 100644 index 00000000..0b454d11 --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/pmodulo.h b/src/c/elementaryFunctions/includes/pmodulo.h new file mode 100644 index 00000000..d46febc3 --- /dev/null +++ b/src/c/elementaryFunctions/includes/pmodulo.h @@ -0,0 +1,40 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __PMODULO_H__ +#define __PMODULO_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dpmoduloa(double*, int ,double*, double*); +double dpmodulos(double, double); + +void spmoduloa(float*, int ,float*, float*); +float spmodulos(float, float); + +void i16pmoduloa(int16*, int ,int16*, int16*); +int16 i16pmodulos(int16, int16); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/pow.h b/src/c/elementaryFunctions/includes/pow.h index ec8216d8..2905b7ed 100644 --- a/src/c/elementaryFunctions/includes/pow.h +++ b/src/c/elementaryFunctions/includes/pow.h @@ -15,6 +15,11 @@ #include "dynlib_elementaryfunctions.h" #include "multiplication.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "uint8.h" +#include "uint16.h" +#include "int16.h" #ifdef __cplusplus extern "C" { @@ -27,6 +32,14 @@ EXTERN_ELEMFUNCT floatComplex cpows(floatComplex value, floatComplex expand); EXTERN_ELEMFUNCT doubleComplex zpows(doubleComplex value, doubleComplex expand); +EXTERN_ELEMFUNCT uint8 u8pows(uint8 value, uint8 expand); + +EXTERN_ELEMFUNCT uint16 u16pows(uint16 value, uint16 expand); + +EXTERN_ELEMFUNCT int8 i8pows(int8 value, int8 expand); + +EXTERN_ELEMFUNCT int16 i16pows(int16 value, int16 expand); + EXTERN_ELEMFUNCT void spowa(float *value, int size, float* expand, float *out); EXTERN_ELEMFUNCT void dpowa(double *value, int size, double* expand, double *out); @@ -35,6 +48,14 @@ EXTERN_ELEMFUNCT void cpowa(floatComplex *value, int size, floatComplex* expand EXTERN_ELEMFUNCT void zpowa(doubleComplex *value, int size, doubleComplex* expand, doubleComplex *out); +EXTERN_ELEMFUNCT void u8powa(uint8 *value, int size, uint8* expand, uint8 *out); + +EXTERN_ELEMFUNCT void u16powa(uint16 *value, int size, uint16* expand, uint16 *out); + +EXTERN_ELEMFUNCT void i8powa(int8 *value, int size, int8* expand, int8 *out); + +EXTERN_ELEMFUNCT void i16powa(int16 *value, int size, int16* expand, int16 *out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/primes.h b/src/c/elementaryFunctions/includes/primes.h new file mode 100644 index 00000000..c541df9e --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/round.h b/src/c/elementaryFunctions/includes/round.h index 1c3c0cea..6894265a 100644 --- a/src/c/elementaryFunctions/includes/round.h +++ b/src/c/elementaryFunctions/includes/round.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -32,6 +33,14 @@ EXTERN_ELEMFUNCT floatComplex crounds(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zrounds(doubleComplex in); +EXTERN_ELEMFUNCT uint8 u8rounds(uint8 in); + +EXTERN_ELEMFUNCT int8 i8rounds(int8 in); + +EXTERN_ELEMFUNCT uint16 u16rounds(uint16 in); + +EXTERN_ELEMFUNCT int16 i16rounds(int16 in); + EXTERN_ELEMFUNCT void srounda(float* in, int size, float* out); EXTERN_ELEMFUNCT void drounda(double* in, int size, double* out); @@ -40,6 +49,14 @@ EXTERN_ELEMFUNCT void crounda(floatComplex* in, int size, floatComplex* out); EXTERN_ELEMFUNCT void zrounda(doubleComplex* in, int size, doubleComplex* out); +EXTERN_ELEMFUNCT void u8rounda(uint8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8rounda(int8* in, int size, int8* out); + +EXTERN_ELEMFUNCT void u16rounda(uint16* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16rounda(int16* in, int size, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/sec.h b/src/c/elementaryFunctions/includes/sec.h new file mode 100644 index 00000000..a04c5f73 --- /dev/null +++ b/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); + +doubleComplex zsecs(doubleComplex 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/src/c/elementaryFunctions/includes/secd.h b/src/c/elementaryFunctions/includes/secd.h new file mode 100644 index 00000000..bf9c653d --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/sech.h b/src/c/elementaryFunctions/includes/sech.h new file mode 100644 index 00000000..9b85396a --- /dev/null +++ b/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/src/c/elementaryFunctions/includes/sin.h b/src/c/elementaryFunctions/includes/sin.h index 198b0665..ffb76269 100644 --- a/src/c/elementaryFunctions/includes/sin.h +++ b/src/c/elementaryFunctions/includes/sin.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -49,6 +50,33 @@ EXTERN_ELEMFUNCT floatComplex csins(floatComplex in); EXTERN_ELEMFUNCT doubleComplex zsins(doubleComplex in); /* +** \brief Uint8 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u8sins(uint8 in); + + +/* +** \brief Int8 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i8sins(int8 in); + + +/* +** \brief Uint16 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u16sins(uint16 in); + + +/* +** \brief Int16 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i16sins(int16 in); + +/* ** \brief Float Matrix Sine function ** \param in : input array value. ** \param out : output array value. @@ -80,6 +108,39 @@ EXTERN_ELEMFUNCT void csina(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void zsina(doubleComplex* in, int size, doubleComplex* out); +/* +** \brief uint8 Matrix Sine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u8sina(uint8* in, int size, float* out); + +/* +** \brief int8 Matrix Sine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i8sina(int8* in, int size, float* out); + +/* +** \brief uint16 Matrix Sine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u16sina(uint16* in, int size, float* out); + +/* +** \brief int16 Matrix Sine function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i16sina(int16* in, int size, float* out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/sinc.h b/src/c/elementaryFunctions/includes/sinc.h new file mode 100644 index 00000000..8bc98d28 --- /dev/null +++ b/src/c/elementaryFunctions/includes/sinc.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SINC_H__ +#define __SINC_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsinca(double* sample,int size,double* oup); +void zsinca(doubleComplex* sample,int size,doubleComplex* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINC_H__ */ diff --git a/src/c/elementaryFunctions/includes/sind.h b/src/c/elementaryFunctions/includes/sind.h new file mode 100644 index 00000000..d98bd683 --- /dev/null +++ b/src/c/elementaryFunctions/includes/sind.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 __SIND_H__ +#define __SIND_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dsinds(double x); +float ssinds(float x); +void dsinda(double* x, int size, double* y); +void ssinda(float* x, int size, double* y); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__SIND_H__ */ + diff --git a/src/c/elementaryFunctions/includes/sinh.h b/src/c/elementaryFunctions/includes/sinh.h index c052a901..c464fce0 100644 --- a/src/c/elementaryFunctions/includes/sinh.h +++ b/src/c/elementaryFunctions/includes/sinh.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -48,6 +49,31 @@ EXTERN_ELEMFUNCT floatComplex csinhs(floatComplex in); */ EXTERN_ELEMFUNCT doubleComplex zsinhs(doubleComplex in); + +/* +** \brief Uint8 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u8sinhs(uint8 in); + +/* +** \brief Int8 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i8sinhs(int8 in); + +/* +** \brief Uint16 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u16sinhs(uint16 in); + +/* +** \brief Int16 Sine function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i16sinhs(int16 in); + /* ** \brief Float Matrix Sine function ** \param in : input array value. @@ -80,6 +106,39 @@ EXTERN_ELEMFUNCT void csinha(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void zsinha(doubleComplex* in, int size, doubleComplex* out); +/* +** \brief Uint8 Matrix Sine function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u8sinha(uint8* in, int size, float* out); + +/* +** \brief Int8 Matrix Sine function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i8sinha(int8* in, int size, float* out); + +/* +** \brief Uint16 Matrix Sine function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u16sinha(uint16* in, int size, float* out); + +/* +** \brief Int16 Matrix Sine function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i16sinha(int16* in, int size, float* out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/sqrt.h b/src/c/elementaryFunctions/includes/sqrt.h index 7885c9c2..df11b20e 100644 --- a/src/c/elementaryFunctions/includes/sqrt.h +++ b/src/c/elementaryFunctions/includes/sqrt.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -48,13 +49,14 @@ EXTERN_ELEMFUNCT floatComplex csqrts(floatComplex in); */ EXTERN_ELEMFUNCT doubleComplex zsqrts(doubleComplex in); + /* ** \brief Float Matrix Square Root function ** \param in : input array value. ** \param out : output array value. ** \param size : the size of in and out arrays. */ -EXTERN_ELEMFUNCT void ssqrta(float* in, int size, float* out); +EXTERN_ELEMFUNCT void ssqrta(float* in, int size, float* out); /* ** \brief Double Matrix Square Root function @@ -80,6 +82,10 @@ EXTERN_ELEMFUNCT void csqrta(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void zsqrta(doubleComplex* in, int size, doubleComplex* out); + + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/tan.h b/src/c/elementaryFunctions/includes/tan.h index 77ef7868..2632a779 100644 --- a/src/c/elementaryFunctions/includes/tan.h +++ b/src/c/elementaryFunctions/includes/tan.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -49,6 +50,31 @@ EXTERN_ELEMFUNCT floatComplex ctans(floatComplex in); EXTERN_ELEMFUNCT doubleComplex ztans(doubleComplex in); /* +** \brief Uint8 Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u8tans(uint8 in); + +/* +** \brief Int8 Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i8tans(int8 in); + +/* +** \brief Uint16 Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u16tans(uint16 in); + +/* +** \brief Int16 Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i16tans(int16 in); + + +/* ** \brief Float Matrix Tangeant function ** \param in : input array value. ** \param out : input array value. @@ -80,6 +106,39 @@ EXTERN_ELEMFUNCT void ctana(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void ztana(doubleComplex* in, int size, doubleComplex* out); +/* +** \brief Uint8 Matrix Tangeant function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u8tana(uint8* in, int size, float* out); + +/* +** \brief Int8 Matrix Tangeant function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i8tana(int8* in, int size, float* out); + +/* +** \brief Uint16 Matrix Tangeant function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u16tana(uint16* in, int size, float* out); + +/* +** \brief Int16 Matrix Tangeant function +** \param in : input array value. +** \param out : input array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i16tana(int16* in, int size, float* out); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/tand (copy).h b/src/c/elementaryFunctions/includes/tand (copy).h new file mode 100644 index 00000000..918d43ab --- /dev/null +++ b/src/c/elementaryFunctions/includes/tand (copy).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 __TAND_H__ +#define __TAND_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +double dtands(double x); +float stands(float x); +void dtanda(double* x, int size, double* y); +void standa(float* x, int size, double* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__TAND_H__ */ + diff --git a/src/c/elementaryFunctions/includes/tand.h b/src/c/elementaryFunctions/includes/tand.h new file mode 100644 index 00000000..918d43ab --- /dev/null +++ b/src/c/elementaryFunctions/includes/tand.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 __TAND_H__ +#define __TAND_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +double dtands(double x); +float stands(float x); +void dtanda(double* x, int size, double* y); +void standa(float* x, int size, double* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__TAND_H__ */ + diff --git a/src/c/elementaryFunctions/includes/tanh.h b/src/c/elementaryFunctions/includes/tanh.h index 9ff440cf..6a654230 100644 --- a/src/c/elementaryFunctions/includes/tanh.h +++ b/src/c/elementaryFunctions/includes/tanh.h @@ -16,6 +16,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "sinh.h" #ifdef __cplusplus extern "C" { @@ -49,6 +50,30 @@ EXTERN_ELEMFUNCT floatComplex ctanhs(floatComplex in); EXTERN_ELEMFUNCT doubleComplex ztanhs(doubleComplex in); /* +** \brief Uint8 Hyperbolic Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u8tanhs(uint8 in); + +/* +** \brief Int8 Hyperbolic Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i8tanhs(int8 in); + +/* +** \brief Uint16 Hyperbolic Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float u16tanhs(uint16 in); + +/* +** \brief Int16 Hyperbolic Tangeant function +** \param in : input value. +*/ +EXTERN_ELEMFUNCT float i16tanhs(int16 in); + +/* ** \brief Float Matrix Hyperbolic Tangeant function ** \param in : input array value. ** \param out : output array value. @@ -80,6 +105,38 @@ EXTERN_ELEMFUNCT void ctanha(floatComplex* in, int size, floatComplex* out); */ EXTERN_ELEMFUNCT void ztanha(doubleComplex* in, int size, doubleComplex* out); +/* +** \brief Uint8 Matrix Hyperbolic Tangeant function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u8tanha(uint8* in, int size, float* out); + +/* +** \brief Int8 Matrix Hyperbolic Tangeant function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i8tanha(int8* in, int size, float* out); + +/* +** \brief Uint16 Matrix Hyperbolic Tangeant function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void u16tanha(uint16* in, int size, float* out); + +/* +** \brief Int16 Matrix Hyperbolic Tangeant function +** \param in : input array value. +** \param out : output array value. +** \param size : the size of in and out arrays. +*/ +EXTERN_ELEMFUNCT void i16tanha(int16* in, int size, float* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/elementaryFunctions/includes/uint16.h b/src/c/elementaryFunctions/includes/uint16.h new file mode 100644 index 00000000..9e162130 --- /dev/null +++ b/src/c/elementaryFunctions/includes/uint16.h @@ -0,0 +1,54 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __UINT16_H__ +#define __UINT16_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + uint16(X) returns the signed int part of the double value +*/ + +EXTERN_ELEMFUNCT uint16 suint16s(float in); + +EXTERN_ELEMFUNCT uint16 duint16s(double in); + +EXTERN_ELEMFUNCT uint16 u8uint16s(uint8 in); + +EXTERN_ELEMFUNCT uint16 i8uint16s(int8 in); + +EXTERN_ELEMFUNCT uint16 i16uint16s(int16 in); + +EXTERN_ELEMFUNCT void suint16a(float* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void duint16a(double* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void u8uint16a(uint8* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i8uint16a(int8* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void i16uint16a(int16* in, int size, uint16* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__UINT16_H__ */ + diff --git a/src/c/elementaryFunctions/includes/uint32.h b/src/c/elementaryFunctions/includes/uint32.h new file mode 100644 index 00000000..b90247bc --- /dev/null +++ b/src/c/elementaryFunctions/includes/uint32.h @@ -0,0 +1,62 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __UINT32_H__ +#define __UINT32_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + uint32(X) returns the unsigned int part of the double value +*/ + +EXTERN_ELEMFUNCT uint32 suint32s(float in); + +EXTERN_ELEMFUNCT uint32 duint32s(double in); + +EXTERN_ELEMFUNCT uint32 u8uint32s(uint8 in); + +EXTERN_ELEMFUNCT uint32 i8uint32s(int8 in); + +EXTERN_ELEMFUNCT uint32 u16uint32s(uint16 in); + +EXTERN_ELEMFUNCT uint32 i16uint32s(int16 in); + +EXTERN_ELEMFUNCT uint32 i32uint32s(int32 in); + +EXTERN_ELEMFUNCT void suint32a(float* in, int size, uint32* out); + +EXTERN_ELEMFUNCT void duint32a(double* in, int size, uint32* out); + +EXTERN_ELEMFUNCT void u8uint32a(uint8* in, int size, uint32* out); + +EXTERN_ELEMFUNCT void i8uint32a(int8* in, int size, uint32* out); + +EXTERN_ELEMFUNCT void u16uint32a(uint16* in, int size, uint32* out); + +EXTERN_ELEMFUNCT void i16uint32a(int16* in, int size, uint32* out); + +EXTERN_ELEMFUNCT void i32uint32a(int32* in, int size, uint32* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__UINT32_H__ */ + diff --git a/src/c/elementaryFunctions/includes/uint8.h b/src/c/elementaryFunctions/includes/uint8.h new file mode 100644 index 00000000..63071c4a --- /dev/null +++ b/src/c/elementaryFunctions/includes/uint8.h @@ -0,0 +1,54 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __UINT8_H__ +#define __UINT8_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + uint8(X) returns the unsigned char part of the double value +*/ + +EXTERN_ELEMFUNCT uint8 suint8s(float in); + +EXTERN_ELEMFUNCT uint8 duint8s(double in); + +EXTERN_ELEMFUNCT uint8 i8uint8s(int8 in); + +EXTERN_ELEMFUNCT uint8 u16uint8s(uint16 in); + +EXTERN_ELEMFUNCT uint8 i16uint8s(int16 in); + +EXTERN_ELEMFUNCT void suint8a(float* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void duint8a(double* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i8uint8a(int8* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void u16uint8a(uint16* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void i16uint8a(int16* in, int size, uint8* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__UINT8_H__ */ + diff --git a/src/c/elementaryFunctions/int16/dint16a.c b/src/c/elementaryFunctions/int16/dint16a.c new file mode 100644 index 00000000..e3b96116 --- /dev/null +++ b/src/c/elementaryFunctions/int16/dint16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int16.h" + +void dint16a(double* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = dint16s(x[i]); +} diff --git a/src/c/elementaryFunctions/int16/dint16s.c b/src/c/elementaryFunctions/int16/dint16s.c new file mode 100644 index 00000000..6f09631a --- /dev/null +++ b/src/c/elementaryFunctions/int16/dint16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int16.h" + +int16 dint16s(double x) { + return (int16) x; +} diff --git a/src/c/elementaryFunctions/int16/i8int16a.c b/src/c/elementaryFunctions/int16/i8int16a.c new file mode 100644 index 00000000..0885b021 --- /dev/null +++ b/src/c/elementaryFunctions/int16/i8int16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int16.h" + +void i8int16a(int8* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8int16s(x[i]); +} diff --git a/src/c/elementaryFunctions/int16/i8int16s.c b/src/c/elementaryFunctions/int16/i8int16s.c new file mode 100644 index 00000000..4a42acc0 --- /dev/null +++ b/src/c/elementaryFunctions/int16/i8int16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int16.h" + +int16 i8int16s(int8 x) { + return (int16) x; +} diff --git a/src/c/elementaryFunctions/int16/sint16a.c b/src/c/elementaryFunctions/int16/sint16a.c new file mode 100644 index 00000000..9769127b --- /dev/null +++ b/src/c/elementaryFunctions/int16/sint16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int16.h" + +void sint16a(float* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = sint16s(x[i]); +} diff --git a/src/c/elementaryFunctions/int16/sint16s.c b/src/c/elementaryFunctions/int16/sint16s.c new file mode 100644 index 00000000..2dd7af27 --- /dev/null +++ b/src/c/elementaryFunctions/int16/sint16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int16.h" + +int16 sint16s(float x) { + return (int16) x; +} diff --git a/src/c/elementaryFunctions/int16/u16int16a.c b/src/c/elementaryFunctions/int16/u16int16a.c new file mode 100644 index 00000000..bc631988 --- /dev/null +++ b/src/c/elementaryFunctions/int16/u16int16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int16.h" + +void u16int16a(uint16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16int16s(x[i]); +} diff --git a/src/c/elementaryFunctions/int16/u16int16s.c b/src/c/elementaryFunctions/int16/u16int16s.c new file mode 100644 index 00000000..ad226dba --- /dev/null +++ b/src/c/elementaryFunctions/int16/u16int16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int16.h" + +int16 u16int16s(uint16 x) { + return (int16) x; +} diff --git a/src/c/elementaryFunctions/int16/u8int16a.c b/src/c/elementaryFunctions/int16/u8int16a.c new file mode 100644 index 00000000..8c9f94b0 --- /dev/null +++ b/src/c/elementaryFunctions/int16/u8int16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int16.h" + +void u8int16a(uint8* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8int16s(x[i]); +} diff --git a/src/c/elementaryFunctions/int16/u8int16s.c b/src/c/elementaryFunctions/int16/u8int16s.c new file mode 100644 index 00000000..463565f1 --- /dev/null +++ b/src/c/elementaryFunctions/int16/u8int16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int16.h" + +int16 u8int16s(uint8 x) { + return (int16) x; +} diff --git a/src/c/elementaryFunctions/int32/dint32a.c b/src/c/elementaryFunctions/int32/dint32a.c new file mode 100644 index 00000000..f8b4b662 --- /dev/null +++ b/src/c/elementaryFunctions/int32/dint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +void dint32a(double* x, int size, int32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = dint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/int32/dint32s.c b/src/c/elementaryFunctions/int32/dint32s.c new file mode 100644 index 00000000..19366ef0 --- /dev/null +++ b/src/c/elementaryFunctions/int32/dint32s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int32.h" + +int32 dint32s(double x) { + return (int32) x; +} diff --git a/src/c/elementaryFunctions/int32/i16int32a.c b/src/c/elementaryFunctions/int32/i16int32a.c new file mode 100644 index 00000000..e970deb2 --- /dev/null +++ b/src/c/elementaryFunctions/int32/i16int32a.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "int32.h" + +void i16int32a(int16* x, int size, int32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16int32s(x[i]); +} diff --git a/src/c/elementaryFunctions/int32/i16int32s.c b/src/c/elementaryFunctions/int32/i16int32s.c new file mode 100644 index 00000000..ad079930 --- /dev/null +++ b/src/c/elementaryFunctions/int32/i16int32s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +int32 i16int32s(int16 x) { + return (int32) x; +} diff --git a/src/c/elementaryFunctions/int32/i8int32a.c b/src/c/elementaryFunctions/int32/i8int32a.c new file mode 100644 index 00000000..d046ba19 --- /dev/null +++ b/src/c/elementaryFunctions/int32/i8int32a.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "int32.h" + +void i8int32a(int8* x, int size, int32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8int32s(x[i]); +} diff --git a/src/c/elementaryFunctions/int32/i8int32s.c b/src/c/elementaryFunctions/int32/i8int32s.c new file mode 100644 index 00000000..c126662c --- /dev/null +++ b/src/c/elementaryFunctions/int32/i8int32s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +int32 i8int32s(int8 x) { + return (int32) x; +} diff --git a/src/c/elementaryFunctions/int32/sint32a.c b/src/c/elementaryFunctions/int32/sint32a.c new file mode 100644 index 00000000..14dbefec --- /dev/null +++ b/src/c/elementaryFunctions/int32/sint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +void sint32a(float* x, int size, int32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = sint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/int32/sint32s.c b/src/c/elementaryFunctions/int32/sint32s.c new file mode 100644 index 00000000..8a4f8e7e --- /dev/null +++ b/src/c/elementaryFunctions/int32/sint32s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +int32 sint32s(float x) { + return (int32) x; +} diff --git a/src/c/elementaryFunctions/int32/u16int32a.c b/src/c/elementaryFunctions/int32/u16int32a.c new file mode 100644 index 00000000..eaf90fda --- /dev/null +++ b/src/c/elementaryFunctions/int32/u16int32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +void u16int32a(uint16* x, int size, int32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16int32s(x[i]); +} diff --git a/src/c/elementaryFunctions/int32/u16int32s.c b/src/c/elementaryFunctions/int32/u16int32s.c new file mode 100644 index 00000000..be3909a2 --- /dev/null +++ b/src/c/elementaryFunctions/int32/u16int32s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +int32 u16int32s(uint16 x) { + return (int32) x; +} diff --git a/src/c/elementaryFunctions/int32/u32int32a.c b/src/c/elementaryFunctions/int32/u32int32a.c new file mode 100644 index 00000000..a135d12a --- /dev/null +++ b/src/c/elementaryFunctions/int32/u32int32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +void u32int32a(uint32* x, int size, int32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u32int32s(x[i]); +} diff --git a/src/c/elementaryFunctions/int32/u32int32s.c b/src/c/elementaryFunctions/int32/u32int32s.c new file mode 100644 index 00000000..ee5a16aa --- /dev/null +++ b/src/c/elementaryFunctions/int32/u32int32s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +int32 u32int32s(uint32 x) { + return (int32) x; +} diff --git a/src/c/elementaryFunctions/int32/u8int32a.c b/src/c/elementaryFunctions/int32/u8int32a.c new file mode 100644 index 00000000..1361feab --- /dev/null +++ b/src/c/elementaryFunctions/int32/u8int32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +void u8int32a(uint8* x, int size, int32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8int32s(x[i]); +} diff --git a/src/c/elementaryFunctions/int32/u8int32s.c b/src/c/elementaryFunctions/int32/u8int32s.c new file mode 100644 index 00000000..c3b06903 --- /dev/null +++ b/src/c/elementaryFunctions/int32/u8int32s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int32.h" + +int32 u8int32s(uint8 x) { + return (int32) x; +} diff --git a/src/c/elementaryFunctions/int8/dint8a.c b/src/c/elementaryFunctions/int8/dint8a.c new file mode 100644 index 00000000..035ea4f1 --- /dev/null +++ b/src/c/elementaryFunctions/int8/dint8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int8.h" + +void dint8a(double* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = dint8s(x[i]); +} diff --git a/src/c/elementaryFunctions/int8/dint8s.c b/src/c/elementaryFunctions/int8/dint8s.c new file mode 100644 index 00000000..3b554141 --- /dev/null +++ b/src/c/elementaryFunctions/int8/dint8s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int8.h" + +int8 dint8s(double x) { + return (int8) x; +} diff --git a/src/c/elementaryFunctions/int8/i16int8a.c b/src/c/elementaryFunctions/int8/i16int8a.c new file mode 100644 index 00000000..b9aa0931 --- /dev/null +++ b/src/c/elementaryFunctions/int8/i16int8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int8.h" + +void i16int8a(int16* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16int8s(x[i]); +} diff --git a/src/c/elementaryFunctions/int8/i16int8s.c b/src/c/elementaryFunctions/int8/i16int8s.c new file mode 100644 index 00000000..1bdd1764 --- /dev/null +++ b/src/c/elementaryFunctions/int8/i16int8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int8.h" + +int8 i16int8s(int16 x) { + return (int8) x; +} diff --git a/src/c/elementaryFunctions/int8/sint8a.c b/src/c/elementaryFunctions/int8/sint8a.c new file mode 100644 index 00000000..4a04a4b0 --- /dev/null +++ b/src/c/elementaryFunctions/int8/sint8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int8.h" + +void sint8a(float* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = sint8s(x[i]); +} diff --git a/src/c/elementaryFunctions/int8/sint8s.c b/src/c/elementaryFunctions/int8/sint8s.c new file mode 100644 index 00000000..6e4093e1 --- /dev/null +++ b/src/c/elementaryFunctions/int8/sint8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int8.h" + +int8 sint8s(float x) { + return (int8) x; +} diff --git a/src/c/elementaryFunctions/int8/u16int8a.c b/src/c/elementaryFunctions/int8/u16int8a.c new file mode 100644 index 00000000..958dcb7c --- /dev/null +++ b/src/c/elementaryFunctions/int8/u16int8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int8.h" + +void u16int8a(uint16* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16int8s(x[i]); +} diff --git a/src/c/elementaryFunctions/int8/u16int8s.c b/src/c/elementaryFunctions/int8/u16int8s.c new file mode 100644 index 00000000..440b5d8a --- /dev/null +++ b/src/c/elementaryFunctions/int8/u16int8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int8.h" + +int8 u16int8s(uint16 x) { + return (int8) x; +} diff --git a/src/c/elementaryFunctions/int8/u8int8a.c b/src/c/elementaryFunctions/int8/u8int8a.c new file mode 100644 index 00000000..310aafd6 --- /dev/null +++ b/src/c/elementaryFunctions/int8/u8int8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "int8.h" + +void u8int8a(uint8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8int8s(x[i]); +} diff --git a/src/c/elementaryFunctions/int8/u8int8s.c b/src/c/elementaryFunctions/int8/u8int8s.c new file mode 100644 index 00000000..40b7e932 --- /dev/null +++ b/src/c/elementaryFunctions/int8/u8int8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "int8.h" + +int8 u8int8s(uint8 x) { + return (int8) x; +} diff --git a/src/c/elementaryFunctions/interfaces/int_OpDotHat.h b/src/c/elementaryFunctions/interfaces/int_OpDotHat.h index 8e5c7042..2444f100 100644 --- a/src/c/elementaryFunctions/interfaces/int_OpDotHat.h +++ b/src/c/elementaryFunctions/interfaces/int_OpDotHat.h @@ -25,6 +25,14 @@ #define z0z0OpDotHatz0(in1, in2) zpows(in1, in2) +#define u80u80OpDotHatu80(in1, in2) u8pows(in1, in2) + +#define u160u160OpDotHatu160(in1, in2) u16pows(in1, in2) + +#define i80i80OpDotHati80(in1, in2) i8pows(in1, in2) + +#define i160i160OpDotHati60(in1, in2) i16pows(in1, in2) + #define s0c0OpDotHatc0(in1, in2) cpows(FloatComplex(in1,0), in2) #define c0s0OpDotHatc0(in1, in2) cpows(in1, FloatComplex(in2,0)) @@ -53,6 +61,20 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zpows(in1,in2[i]);\ } +#define u80u82OpDotHatu82(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u8pows(in1,in2[i]);\ + } + +#define u160u162OpDotHatu162(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u16pows(in1,in2[i]);\ + } +#define i80i82OpDotHati82(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i8pows(in1,in2[i]);\ + } + +#define i160i162OpDotHati162(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i16pows(in1,in2[i]);\ + } #define s0c2OpDotHatc2(in1, in2, size, out) {int i=0;\ @@ -90,6 +112,23 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zpows(in1[i],in2);\ } +#define u82u80OpDotHatu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u8pows(in1[i],in2);\ + } + +#define u162u160OpDotHatu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u16pows(in1[i],in2);\ + } + +#define i82i80OpDotHati82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i8pows(in1[i],in2);\ + } + +#define i162i160OpDotHati162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i16pows(in1[i],in2);\ + } + + #define s2c0OpDotHatc2(in1,size,in2,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=cpows(FloatComplex(in1[i],0),in2);\ } @@ -106,6 +145,24 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zpows(in1[i],DoubleComplex(in2,0));\ } +#define u82d0OpDotHatu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u8pows(in1[i],in2);\ + } + +#define u162d0OpDotHatu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u16pows(in1[i],in2);\ + } + + +#define i82d0OpDotHati82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i8pows(in1[i],in2);\ + } + +#define i162d0OpDotHatui62(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i16pows(in1[i],in2);\ + } + + /* Matrix - Matrix */ @@ -117,6 +174,14 @@ #define z2z2OpDotHatz2(in1, size1, in2, size2, out) zpowa(in1, size1[0]*size2[1], in2, out) +#define u82u82OpDotHatu82(in1, size1, in2, size2, out) u8powa(in1, size1[0]*size2[1], in2, out) + +#define u162u162OpDotHatu162(in1, size1, in2, size2, out) u16powa(in1, size1[0]*size2[1], in2, out) + +#define i82i82OpDotHati82(in1, size1, in2, size2, out) i8powa(in1, size1[0]*size2[1], in2, out) + +#define i162i162OpDotHati162(in1, size1, in2, size2, out) i16powa(in1, size1[0]*size2[1], in2, out) + #define s2c2OpDotHatc2(in1, size1, in2, size2, out) {int i=0;\ for (i=0;i<size1[0]*size2[1];i++) out[i]=cpows(FloatComplex(in1[i],0),in2[i]);\ } diff --git a/src/c/elementaryFunctions/interfaces/int_OpHat.h b/src/c/elementaryFunctions/interfaces/int_OpHat.h index 8cc8849c..f1bb8d51 100644 --- a/src/c/elementaryFunctions/interfaces/int_OpHat.h +++ b/src/c/elementaryFunctions/interfaces/int_OpHat.h @@ -23,6 +23,14 @@ #define c0c0OpHatc0(in1, in2) cpows(in1, in2) +#define u80u80OpHatu80(in1,in2) u8pows(in1, in2) + +#define u160u160OpHatu160(in1,in2) u16pows(in1, in2) + +#define i80i80OpHati80(in1,in2) i8pows(in1, in2) + +#define i160i60OpHati60(in1,in2) i6pows(in1, in2) + #define s0c0OpHatc0(in1, in2) cpows(FloatComplex(in1,0), in2) #define c0s0OpHatc0(in1, in2) cpows(in1, FloatComplex(in2,0)) @@ -54,6 +62,25 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zpows(in1,in2[i]);\ } +#define u80u82OpHatu82(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u8pows(in1,in2[i]);\ + } + + +#define u160u162OpHatu162(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u16pows(in1,in2[i]);\ + } + +#define i80i82OpHati82(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i8pows(in1,in2[i]);\ + } + + +#define i160i162OpHati162(in1, in2, size, out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i16pows(in1,in2[i]);\ + } + + #define s0c2OpHatc2(in1, in2, size, out) {int i=0;\ @@ -84,6 +111,22 @@ #define z2z0OpHatz2(in1,size,in2,out) zpowma(in1,size[0],in2,out); +#define u82u80OpHatu82(in1,size,in2,out) u8powa(in1,size[0],in2,out) + +#define u162u162OpHatu162(in1,size,in2,out) u16powa(in1,size[0],in2,out) + +#define i82i80OpHati82(in1,size,in2,out) i8powa(in1,size[0],in2,out) + +#define i162i160OpHati82(in1,size,in2,out) i16powa(in1,size[0],in2,out) + +#define u82d0OpHatu82(in1,size,in2,out) u8powa(in1,size[0],in2,out) + +#define u162d0OpHatu162(in1,size,in2,out) u16powa(in1,size[0],in2,out) + +#define i82d0OpHati82(in1,size,in2,out) i8powa(in1,size[0],in2,out) + +#define i162d0OpHati162(in1,sine,in2,out) i16powa(in1,size[0],in2,out) + /* FIXME : malloc here */ #define s2c0OpHatc2(in1,size,in2,out) {float* tmp;\ tmp = malloc((uint)(size[0]*size[1])*sizeof(float));\ diff --git a/src/c/elementaryFunctions/interfaces/int_acosd.h b/src/c/elementaryFunctions/interfaces/int_acosd.h new file mode 100644 index 00000000..ee188c98 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acosd.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACOSD_H__ +#define __INT_ACOSD_H__ + +#include "acosd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acosdd0(in1) dacosds(in1); + +#define d2acosdd2(in1,in2,in3) dacosda(in1,in2[0]*in2[1],in3); + +#define s0acosds0(in1) sacosds(in1); + +#define s2acosds2(in1,in2,in3) sacosda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOSD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acot.h b/src/c/elementaryFunctions/interfaces/int_acot.h new file mode 100644 index 00000000..371e64b5 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acot.h @@ -0,0 +1,42 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACOT_H__ +#define __INT_ACOT_H__ + +#include "acot.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acotd0(in1) dacots(in1); + +#define d2acotd2(in1,in2,in3) dacota(in1,in2[0]*in2[1],in3); + +#define s0acots0(in1) sacots(in1); + +#define s2acots2(in1,in2,in3) sacota(in1,in2[0]*in2[1],in3); + +#define c0acotd0(in1) cacots(in1); + +#define c2acotc2(in1,in2,in3) cacota(in1,in2[0]*in2[1],in3); + +#define z0acotz0(in1) zacots(in1); + +#define z2acotz2(in1,in2,in3) zacota(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOT_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acotd.h b/src/c/elementaryFunctions/interfaces/int_acotd.h new file mode 100644 index 00000000..22367bee --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acotd.h @@ -0,0 +1,33 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACOTD_H__ +#define __INT_ACOTD_H__ + +#include "acotd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acotdd0(in1) dacotds(in1); + +#define d2acotdd2(in1,in2,in3) dacotda(in1,in2[0]*in2[1],in3); + +#define s0acotds0(in1) sacotds(in1); + +#define s2acotds2(in1,in2,in3) sacotda(in1,in2[0]*in2[1],in3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acoth.h b/src/c/elementaryFunctions/interfaces/int_acoth.h new file mode 100644 index 00000000..8ec51a77 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acoth.h @@ -0,0 +1,43 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __INT_ACOTH_H__ +#define __INT_ACOTH_H__ + +#include "acoth.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acothd0(in1) dacoths(in1); + +#define d2acothd2(in1,in2,in3) dacotha(in1,in2[0]*in2[1],in3); + +#define s0acoths0(in1) sacoths(in1); + +#define s2acoths2(in1,in2,in3) sacotha(in1,in2[0]*in2[1],in3); + +#define c0acothc0(in1) cacoths(in1); + +#define c2acothc2(in1,in2,in3) cacotha(in1,in2[0]*in2[1],in3); + +#define z0acothz0(in1) zacoths(in1); + +#define z2acothz2(in1,in2,in3) zacotha(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTH_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acsc.h b/src/c/elementaryFunctions/interfaces/int_acsc.h new file mode 100644 index 00000000..e16f7c99 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acsc.h @@ -0,0 +1,42 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACSC_H__ +#define __INT_ACSC_H__ + +#include "acsc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acscd0(in1) dacscs(in1); + +#define d2acscd2(in1,in2,in3) dacsca(in1,in2[0]*in2[1],in3); + +#define s0acscs0(in1) sacscs(in1); + +#define s2acscs2(in1,in2,in3) sacsca(in1,in2[0]*in2[1],in3); + +#define c0acscc0(in1) cacscs(in1); + +#define c2acscc2(in1,in2,in3) cacsca(in1,in2[0]*in2[1],in3); + +#define z0acscz0(in1) zacscs(in1); + +#define z2acscz2(in1,in2,in3) zacsca(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSC_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acscd.h b/src/c/elementaryFunctions/interfaces/int_acscd.h new file mode 100644 index 00000000..fa13acb8 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acscd.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACSCD_H__ +#define __INT_ACSCD_H__ + +#include "acscd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acscdd0(in1) dacscds(in1); + +#define d2acscdd2(in1,in2,in3) dacscda(in1,in2[0]*in2[1],in3); + +#define s0acscds0(in1) sacscds(in1); + +#define s2acscds2(in1,in2,in3) sacscda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acsch.h b/src/c/elementaryFunctions/interfaces/int_acsch.h new file mode 100644 index 00000000..2101abe2 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acsch.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACSCH_H__ +#define __INT_ACSCH_H__ + +#include "acsch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acschd0(in1) dacschs(in1); + +#define d2acschd2(in1,in2,in3) dacscha(in1,in2[0]*in2[1],in3); + +#define s0acschs0(in1) sacschs(in1); + +#define s2acschs2(in1,in2,in3) sacscha(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCH_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asec.h b/src/c/elementaryFunctions/interfaces/int_asec.h new file mode 100644 index 00000000..25a1f111 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asec.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASEC_H__ +#define __INT_ASEC_H__ + +#include "asec.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asecd0(in1) dasecs(in1); + +#define d2asecd2(in1,in2,in3) daseca(in1,in2[0]*in2[1],in3); + +#define s0asecs0(in1) sasecs(in1); + +#define s2asecs2(in1,in2,in3) saseca(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASEC_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asecd.h b/src/c/elementaryFunctions/interfaces/int_asecd.h new file mode 100644 index 00000000..a722b6b8 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asecd.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASECD_H__ +#define __INT_ASECD_H__ + +#include "asecd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asecdd0(in1) dasecds(in1); + +#define d2asecdd2(in1,in2,in3) dasecda(in1,in2[0]*in2[1],in3); + +#define s0asecds0(in1) sasecds(in1); + +#define s2asecds2(in1,in2,in3) sasecda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asech.h b/src/c/elementaryFunctions/interfaces/int_asech.h new file mode 100644 index 00000000..c6830f5c --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asech.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASECH_H__ +#define __INT_ASECH_H__ + +#include "asech.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asechd0(in1) dasechs(in1); + +#define d2asechd2(in1,in2,in3) dasecha(in1,in2[0]*in2[1],in3); + +#define s0asechs0(in1) sasechs(in1); + +#define s2asechs2(in1,in2,in3) sasecha(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECH_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asind.h b/src/c/elementaryFunctions/interfaces/int_asind.h new file mode 100644 index 00000000..fe640ea5 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asind.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASIND_H__ +#define __INT_ASIND_H__ + +#include "asind.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asindd0(in1) dasinds(in1); + +#define d2asindd2(in1,in2,in3) dasinda(in1,in2[0]*in2[1],in3); + +#define s0asinds0(in1) sasinds(in1); + +#define s2asinds2(in1,in2,in3) sasinda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASIND_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_atand.h b/src/c/elementaryFunctions/interfaces/int_atand.h new file mode 100644 index 00000000..0adc9065 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_atand.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ATAND_H__ +#define __INT_ATAND_H__ + +#include "atand.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0atandd0(in1) datands(in1); + +#define d2atandd2(in1,in2,in3) datanda(in1,in2[0]*in2[1],in3); + +#define s0atands0(in1) satands(in1); + +#define s2atands2(in1,in2,in3) satanda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ATAND_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_base2dec.h b/src/c/elementaryFunctions/interfaces/int_base2dec.h new file mode 100644 index 00000000..8d5e68eb --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_bin2dec.h b/src/c/elementaryFunctions/interfaces/int_bin2dec.h new file mode 100644 index 00000000..c8e07b09 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_bitand.h b/src/c/elementaryFunctions/interfaces/int_bitand.h new file mode 100644 index 00000000..8b208eaa --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitand.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_BITAND_H__ +#define __INT_BITAND_H__ + + +#define u80u80bitandu80(in1,in2) u8bitands(in1,in2) + +#define u82u82bitandu82(in1,size1,in2,size2,out) u8bitanda(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitandu160(in1,in2) u16bitands(in1,in2) + +#define u162u162bitandu162(in1,size1,in2,size2,out) u16bitanda(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitcmp.h b/src/c/elementaryFunctions/interfaces/int_bitcmp.h new file mode 100644 index 00000000..d49289f1 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitcmp.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_BITCMP_H__ +#define __INT_BITCMP_H__ + + +#define u80d0bitcmpu80(in1,in2) u8bitcmps(in1,in2) + +#define u82d0bitcmpu82(in1,size1,in2,out) u8bitcmpa(in1,in2,size1[0]*size1[1],out) + +#define u160d0bitcmpu160(in1,in2) u16bitcmps(in1,in2) + +#define u162d0bitcmpu162(in1,size1,in2,out) u16bitcmpa(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitget.h b/src/c/elementaryFunctions/interfaces/int_bitget.h new file mode 100644 index 00000000..ea930ab1 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitget.h @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_BITGET_H__ +#define __INT_BITGET_H__ + +#define u80d0bitgetu80(in1,in2) u8bitgets(in1,in2) + +#define u160d0bitgetu160(in1,in2) u16bitgets(in1,in2) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitor.h b/src/c/elementaryFunctions/interfaces/int_bitor.h new file mode 100644 index 00000000..00edc483 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitor.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_BITOR_H__ +#define __INT_BITOR_H__ + + +#define u80u80bitoru80(in1,in2) u8bitors(in1,in2) + +#define u82u82bitoru82(in1,size1,in2,size2,out) u8bitora(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitoru160(in1,in2) u16bitors(in1,in2) + +#define u162u162bitoru162(in1,size1,in2,size2,out) u16bitora(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitset.h b/src/c/elementaryFunctions/interfaces/int_bitset.h new file mode 100644 index 00000000..a37160be --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitset.h @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_BITSET_H__ +#define __INT_BITSET_H__ + +#define u80d0d0bitsetu80(in1,in2,in3) u8bitsets(in1,in2,in3) + +#define u160d0d0bitsetu160(in1,in2,in3) u16bitsets(in1,in2,in3) + + + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitxor.h b/src/c/elementaryFunctions/interfaces/int_bitxor.h new file mode 100644 index 00000000..1722c909 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitxor.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_BITXOR_H__ +#define __INT_BITXOR_H__ + + +#define u80u80bitxoru80(in1,in2) u8bitxors(in1,in2) + +#define u82u82bitxoru82(in1,size1,in2,size2,out) u8bitxora(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitxoru160(in1,in2) u16bitxors(in1,in2) + +#define u162u162bitxoru162(in1,size1,in2,size2,out) u16bitxora(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_ceil.h b/src/c/elementaryFunctions/interfaces/int_ceil.h index 918dd5a0..33c01769 100644 --- a/src/c/elementaryFunctions/interfaces/int_ceil.h +++ b/src/c/elementaryFunctions/interfaces/int_ceil.h @@ -23,6 +23,14 @@ #define z0ceilz0(in) zceils(in) +#define u80ceilu80(in) u8ceils(in) + +#define i80ceili80(in) i8ceils(in) + +#define u160ceilu160(in) u16ceils(in) + +#define i160ceili160(in) i16ceils(in) + #define s2ceils2(in,size,out) sceila(in, size[0]*size[1], out) #define d2ceild2(in,size,out) dceila(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2ceilz2(in,size,out) zceila(in, size[0]*size[1], out) +#define u82ceilu82(in,size,out) u8ceila(in, size[0]*size[1], out) + +#define i82ceili82(in,size,out) i8ceila(in, size[0]*size[1], out) + +#define u162ceilu162(in,size,out) u16ceila(in, size[0]*size[1], out) + +#define i162ceili162(in,size,out) i16ceila(in, size[0]*size[1], out) + #endif /* !__INT_CEIL_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_cos.h b/src/c/elementaryFunctions/interfaces/int_cos.h index 647bff6c..b19bcfc1 100644 --- a/src/c/elementaryFunctions/interfaces/int_cos.h +++ b/src/c/elementaryFunctions/interfaces/int_cos.h @@ -23,6 +23,14 @@ #define z0cosz0(in) zcoss(in) +#define u80coss0(in) u8coss(in) + +#define i80coss0(in) i8coss(in) + +#define u160coss0(in) u16coss(in) + +#define i160coss0(in) i16coss(in) + #define s2coss2(in,size,out) scosa(in, size[0]*size[1], out) #define d2cosd2(in,size,out) dcosa(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2cosz2(in,size,out) zcosa(in, size[0]*size[1], out) +#define u82coss2(in,size,out) u8cosa(in, size[0]*size[1], out) + +#define i82coss2(in,size,out) i8cosa(in, size[0]*size[1], out) + +#define u162coss2(in,size,out) u16cosa(in, size[0]*size[1], out) + +#define i162coss2(in,size,out) i16cosa(in, size[0]*size[1], out) + #endif /* !__INT_COS_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_cosd.h b/src/c/elementaryFunctions/interfaces/int_cosd.h new file mode 100644 index 00000000..9ca9945b --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_cosh.h b/src/c/elementaryFunctions/interfaces/int_cosh.h index 28915ca3..c2b97ada 100644 --- a/src/c/elementaryFunctions/interfaces/int_cosh.h +++ b/src/c/elementaryFunctions/interfaces/int_cosh.h @@ -23,6 +23,14 @@ #define z0coshz0(in) zcoshs(in) +#define u80coshs0(in) u8coshs(in) + +#define i80coshs0(in) i8coshs(in) + +#define u160coshs0(in) u16coshs(in) + +#define i160coshs0(in) i16coshs(in) + #define s2coshs2(in,size,out) scosha(in, size[0]*size[1], out) #define d2coshd2(in,size,out) dcosha(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2coshz2(in,size,out) zcosha(in, size[0]*size[1], out) +#define u82coshs2(in,size,out) u8cosha(in, size[0]*size[1], out) + +#define i82coshs2(in,size,out) i8cosha(in, size[0]*size[1], out) + +#define u162coshs2(in,size,out) u16cosha(in, size[0]*size[1], out) + +#define i162coshs2(in,size,out) i16cosha(in, size[0]*size[1], out) + #endif /* !__INT_COSH_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_cotd.h b/src/c/elementaryFunctions/interfaces/int_cotd.h new file mode 100644 index 00000000..382f7802 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_coth.h b/src/c/elementaryFunctions/interfaces/int_coth.h new file mode 100644 index 00000000..db8887a3 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_csc.h b/src/c/elementaryFunctions/interfaces/int_csc.h new file mode 100644 index 00000000..74038c97 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_cscd.h b/src/c/elementaryFunctions/interfaces/int_cscd.h new file mode 100644 index 00000000..99bc49a3 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_csch.h b/src/c/elementaryFunctions/interfaces/int_csch.h new file mode 100644 index 00000000..ce355895 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_dec2base.h b/src/c/elementaryFunctions/interfaces/int_dec2base.h new file mode 100644 index 00000000..637f099c --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_dec2bin.h b/src/c/elementaryFunctions/interfaces/int_dec2bin.h new file mode 100644 index 00000000..c6f2008b --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_dec2hex.h b/src/c/elementaryFunctions/interfaces/int_dec2hex.h new file mode 100644 index 00000000..bed85be1 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_dec2oct.h b/src/c/elementaryFunctions/interfaces/int_dec2oct.h new file mode 100644 index 00000000..5cf61be1 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_exp.h b/src/c/elementaryFunctions/interfaces/int_exp.h index 3727e3b6..bcb8dd99 100644 --- a/src/c/elementaryFunctions/interfaces/int_exp.h +++ b/src/c/elementaryFunctions/interfaces/int_exp.h @@ -23,6 +23,14 @@ #define z0expz0(in) zexps(in) +#define u80exps0(in) u8exps(in) + +#define i80exps0(in) i8exps(in) + +#define u160exps0(in) u16exps(in) + +#define i160exps0(in) i16exps(in) + #define s2exps2(in,size,out) sexpa(in, size[0]*size[1], out) #define d2expd2(in,size,out) dexpa(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2expz2(in,size,out) zexpa(in, size[0]*size[1], out) +#define u82exps2(in,size,out) u8expa(in, size[0]*size[1], out) + +#define i82exps2(in,size,out) i8expa(in, size[0]*size[1], out) + +#define u162exps2(in,size,out) u16expa(in, size[0]*size[1], out) + +#define i162exps2(in,size,out) i16expa(in, size[0]*size[1], out) + #endif /* !__INT_EXP_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_factor.h b/src/c/elementaryFunctions/interfaces/int_factor.h new file mode 100644 index 00000000..5e0991aa --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_factorial.h b/src/c/elementaryFunctions/interfaces/int_factorial.h new file mode 100644 index 00000000..446b5135 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_fix.h b/src/c/elementaryFunctions/interfaces/int_fix.h index ac483c92..2a418a38 100644 --- a/src/c/elementaryFunctions/interfaces/int_fix.h +++ b/src/c/elementaryFunctions/interfaces/int_fix.h @@ -23,6 +23,15 @@ #define z0fixz0(in) zfixs(in) + +#define u80fixu80(in) u8fixs(in) + +#define i80fixi80(in) i8fixs(in) + +#define u160fixu160(in) u16fixs(in) + +#define i160fixi160(in) i16fixs(in) + #define s2fixs2(in,size,out) sfixa(in, size[0]*size[1], out) #define d2fixd2(in,size,out) dfixa(in, size[0]*size[1], out) @@ -31,4 +40,12 @@ #define z2fixz2(in,size,out) zfixa(in, size[0]*size[1], out) +#define u82fixu82(in,size,out) u8fixa(in, size[0]*size[1], out) + +#define i82fixi82(in,size,out) i8fixa(in, size[0]*size[1], out) + +#define u162fixu162(in,size,out) u16fixa(in, size[0]*size[1], out) + +#define i162fixi162(in,size,out) i16fixa(in, size[0]*size[1], out) + #endif /* !__INT_FIX_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_float.h b/src/c/elementaryFunctions/interfaces/int_float.h new file mode 100644 index 00000000..df9aa395 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_floor.h b/src/c/elementaryFunctions/interfaces/int_floor.h index 548c5e2a..639819a7 100644 --- a/src/c/elementaryFunctions/interfaces/int_floor.h +++ b/src/c/elementaryFunctions/interfaces/int_floor.h @@ -23,6 +23,14 @@ #define z0floorz0(in) zfloors(in) +#define u80flooru80(in) u8floors(in) + +#define i80floori80(in) i8floors(in) + +#define u160flooru160(in) u16floors(in) + +#define i160floori160(in) i16floors(in) + #define s2floors2(in,size,out) sfloora(in, size[0]*size[1], out) #define d2floord2(in,size,out) dfloora(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2floorz2(in,size,out) zfloora(in, size[0]*size[1], out) +#define u82flooru82(in,size,out) u8floora(in, size[0]*size[1], out) + +#define i82floori82(in,size,out) i8floora(in, size[0]*size[1], out) + +#define u162flooru162(in,size,out) u16floora(in, size[0]*size[1], out) + +#define i162floori162(in,size,out) i16floora(in, size[0]*size[1], out) + #endif /* !__INT_FLOOR_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_gcd.h b/src/c/elementaryFunctions/interfaces/int_gcd.h new file mode 100644 index 00000000..f3e117c5 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_gcd.h @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_GCD_H__ +#define __INT_GCD_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define u82gcdu80(in,size) u8gcda(in,size[1]) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_GCD_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_hex2dec.h b/src/c/elementaryFunctions/interfaces/int_hex2dec.h new file mode 100644 index 00000000..d5589369 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_int16.h b/src/c/elementaryFunctions/interfaces/int_int16.h new file mode 100644 index 00000000..4f32fe9b --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_int16.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_INT16_H__ +#define __INT_INT16_H__ + +#define s0int16i160(in) sint16s(in) + +#define d0int16i160(in) dint16s(in) + +#define u80int16i160(in) u8int16s(in) + +#define i80int16i160(in) i8int16s(in) + +#define u160int16i160(in) u16int16s(in) + +#define s2int16i162(in,size,out) sint16a(in, size[0]*size[1], out) + +#define d2int16i162(in,size,out) dint16a(in, size[0]*size[1], out) + +#define u82int16i162(in,size,out) u8int16a(in, size[0]*size[1], out) + +#define i82int16i162(in,size,out) i8int16a(in, size[0]*size[1], out) + +#define u162int16i162(in,size,out) u16int16a(in, size[0]*size[1], out) + +#endif /* !__INT_INT8_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_int32.h b/src/c/elementaryFunctions/interfaces/int_int32.h new file mode 100644 index 00000000..5da9bd25 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_int32.h @@ -0,0 +1,46 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_INT32_H__ +#define __INT_INT32_H__ + +#define s0int32i320(in) sint32s(in) + +#define d0int32i320(in) dint32s(in) + +#define u80int32i320(in) u8int32s(in) + +#define i80int32i320(in) i8int32s(in) + +#define u160int32i320(in) u16int32s(in) + +#define i160int32i320(in) i16int32s(in) + +#define u320int32i320(in) u32int32s(in) + +#define s2int32i322(in,size,out) sint32a(in, size[0]*size[1], out) + +#define d2int32i322(in,size,out) dint32a(in, size[0]*size[1], out) + +#define u82int32i322(in,size,out) u8int32a(in, size[0]*size[1], out) + +#define i82int32i322(in,size,out) i8int32a(in, size[0]*size[1], out) + +#define u162int32i322(in,size,out) u16int32a(in, size[0]*size[1], out) + +#define i162int32i322(in,size,out) i16int32a(in, size[0]*size[1], out) + +#define u322int32i322(in,size,out) u32int32a(in, size[0]*size[1], out) + +#endif /* !__INT_INT32_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_int8.h b/src/c/elementaryFunctions/interfaces/int_int8.h new file mode 100644 index 00000000..5628c5ac --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_int8.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_INT8_H__ +#define __INT_INT8_H__ + +#define s0int8i80(in) sint8s(in) + +#define d0int8i80(in) dint8s(in) + +#define u80int8i80(in) u8int8s(in) + +#define u160int8i80(in) u16int8s(in) + +#define i160int8i80(in) i16int8s(in) + +#define s2int8i82(in,size,out) sint8a(in, size[0]*size[1], out) + +#define d2int8i82(in,size,out) dint8a(in, size[0]*size[1], out) + +#define u82int8i82(in,size,out) u8int8a(in, size[0]*size[1], out) + +#define u162int8i82(in,size,out) u16int8a(in, size[0]*size[1], out) + +#define i162int8i82(in,size,out) i16int8a(in, size[0]*size[1], out) + +#endif /* !__INT_INT8_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_iscolumn.h b/src/c/elementaryFunctions/interfaces/int_iscolumn.h new file mode 100644 index 00000000..e1011d72 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_iscolumn.h @@ -0,0 +1,29 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISCOLUMN_H__ +#define __INT_ISCOLUMN_H__ + +#define d2iscolumng0(in,size ) discolumna(in, size[1]) +#define d0iscolumng0(in) discolumns(in) +#define s2iscolumng0(in,size) siscolumna(in, size[1]) +#define s0iscolumng0(in) siscolumns(in) +#define g2iscolumng0(in,size) giscolumna(in, size[1]) +#define g0iscolumng0(in) giscolumns(in) +#define z2iscolumng0(in,size) ziscolumna(in , size[1]) +#define z0iscolumng0(in) ziscolumns(in) +#define u162iscolumng0(in,size) u16iscolumna(in , size[1]) +#define u160iscolumng0(in) u16iscolumns(in) + + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_isequal.h b/src/c/elementaryFunctions/interfaces/int_isequal.h new file mode 100644 index 00000000..d22ab65d --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_isequal.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 __INT_ISEQUAL_H__ +#define __INT_ISEQUAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define d0d0isequalg0(in1,in2) disequals(in1,in2) +#define d2d2isequalg0(in1, s1, in2, s2) disequala(in1, s1[0], s1[1], in2, s2[0], s2[1]) +#define s0s0isequalg0(in1,in2) sisequals(in1,in2) +#define s2s2isequalg0(in1, s1, in2, s2) sisequala(in1, s1[0], s1[1], in2, s2[0], s2[1]) +#define z0z0isequalg0(in1,in2) zisequals(in1,in2) +#define z2z2isequalg0(in1, s1, in2, s2) zisequala(in1, s1[0], s1[1], in2, s2[0], s2[1]) +#define u160u160isequalg0(in1,in2) u16isequals(in1,in2) +#define u162u162isequalg0(in1, s1, in2, s2) u16isequala(in1, s1[0], s1[1], in2, s2[0], s2[1]) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_ISEQUAL_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_isinf.h b/src/c/elementaryFunctions/interfaces/int_isinf.h new file mode 100644 index 00000000..9eefa658 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_isinf.h @@ -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 + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ISINF_H__ +#define __INT_ISINF_H__ + +#define d0isinfg0(in) disinfs(in) +#define s0isinfg0(in) sisinfs(in) + + +#endif /* !__INT_ISINF_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_ismatrix.h b/src/c/elementaryFunctions/interfaces/int_ismatrix.h new file mode 100644 index 00000000..96352d13 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_ismatrix.h @@ -0,0 +1,28 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISMATRIX_H__ +#define __INT_ISMATRIX_H__ + +#define d2ismatrixg0(in, size ) dismatrixa(in) +#define d0ismatrixg0(in) dismatrixs(in) +#define s2ismatrixg0(in , size) sismatrixa(in) +#define s0ismatrixg0(in) sismatrixs(in) +#define g2ismatrixg0(in, size) gismatrixa(in) +#define g0ismatrixg0(in) gismatrixs(in) +#define z2ismatrixg0(in, size) zismatrixa(in) +#define z0ismatrixg0(in) zismatrixs(in) +#define u162ismatrixg0(in, size) u16ismatrixa(in) +#define u160ismatrixg0(in) u16ismatrixs(in) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_isreal.h b/src/c/elementaryFunctions/interfaces/int_isreal.h new file mode 100644 index 00000000..cebbf6db --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_isreal.h @@ -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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISREAL_H__ +#define __INT_ISREAL_H__ + +#define s0isreals0(in) sisreals(in) + +#define d0isreald0(in) disreals(in) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_isrow.h b/src/c/elementaryFunctions/interfaces/int_isrow.h new file mode 100644 index 00000000..9298de9d --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_isrow.h @@ -0,0 +1,29 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISROW_H__ +#define __INT_ISROW_H__ + +#define d2isrowg0(in, size ) disrowa(in, size[0]) +#define d0isrowg0(in) disrows(in) +#define s2isrowg0(in , size) sisrowa(in, size[0]) +#define s0isrowg0(in) sisrows(in) +#define g2isrowg0(in, size) gisrowa(in, size[0]) +#define g0isrowg0(in) gisrows(in) +#define z2isrowg0(in, size) zisrowa(in , size[0]) +#define z0isrowg0(in) zisrows(in) +#define u162isrowg0(in, size) u16isrowa(in , size[0]) +#define u160isrowg0(in) u16isrows(in) + + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_isscalar.h b/src/c/elementaryFunctions/interfaces/int_isscalar.h new file mode 100644 index 00000000..0b25be12 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_isscalar.h @@ -0,0 +1,26 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISSCALAR_H__ +#define __INT_ISSCALAR_H__ + +#define d2isscalarg0(in, size ) disscalara(in, size[0]) +#define d0isscalarg0(in) disscalars(in) +#define s2isscalarg0(in , size) sisscalara(in, size[0]) +#define s0isscalarg0(in) sisscalars(in) +#define g2isscalarg0(in, size) gisscalara(in, size[0]) +#define g0isscalarg0(in) gisscalars(in) +#define z2isscalarg0(in, size) zisscalara(in , size[0]) +#define z0isscalarg0(in) zisscalars(in) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_issquare.h b/src/c/elementaryFunctions/interfaces/int_issquare.h new file mode 100644 index 00000000..05357881 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_issquare.h @@ -0,0 +1,25 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISSQUARE_H__ +#define __INT_ISSQUARE_H__ + +#define d2issquareg0(in, size ) dissquarea(in, size[0], size[1]) +#define d0issquareg0(in) dissquares(in) +#define s2issquareg0(in , size) sissquarea(in, size[0], size[1]) +#define s0issquareg0(in) sissquares(in) +#define g2issquareg0(in, size) gissquarea(in, size[0], size[1]) +#define g0issquareg0(in) gissquares(in) +#define z2issquareg0(in, size) zissquarea(in , size[0], size[1]) +#define z0issquareg0(in) zissquares(in) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_isvector.h b/src/c/elementaryFunctions/interfaces/int_isvector.h new file mode 100644 index 00000000..a4edaea4 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_isvector.h @@ -0,0 +1,26 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_ISVECTOR_H__ +#define __INT_ISVECTOR_H__ + +#define d2isvectorg0(in, size ) disvectora(in, size[0], size[1]) +#define d0isvectorg0(in) disvectors(in) +#define s2isvectorg0(in , size) sisvectora(in, size[0], size[1]) +#define s0isvectorg0(in) sisvectors(in) +#define g2isvectorg0(in, size) gisvectora(in, size[0], size[1]) +#define g0isvectorg0(in) gisvectors(in) +#define z2isvectorg0(in, size) zisvectora(in , size[0], size[1]) +#define z0isvectorg0(in) zisvectors(in) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_lcm.h b/src/c/elementaryFunctions/interfaces/int_lcm.h new file mode 100644 index 00000000..2ef1a081 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_lcm.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + + + +#ifndef __INT_LCM_H__ +#define __INT_LCM_H__ + #ifdef __cplusplus + extern "C" { + #endif + +#define u82lcmu80(in,size) u8lcma(in,size[1]) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /* !__INT_LCM_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_linspace.h b/src/c/elementaryFunctions/interfaces/int_linspace.h new file mode 100644 index 00000000..15ea2696 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_linspace.h @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_LINSPACE_H__ +#define __INT_LINSPACE_H__ + +#define d0d0d0linspaced2(in1,in2,in3,out) dlinspaces(in1,in2,in3,out) + +#define s0s0s0linspaces2(in1,in2,in3,out) slinspaces(in1,in2,in3,out) + +#define d2d2d0linspaced2(in1,size1,in2,size2,in3,out) dlinspacea(in1,size1[0],in2,in3,out) + +#define s2s2s0linspaces2(in1,size1,in2,size2,in3,out) slinspacea(in1,size1[0],in2,in3,out) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_log2.h b/src/c/elementaryFunctions/interfaces/int_log2.h new file mode 100644 index 00000000..370503cd --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_log2.h @@ -0,0 +1,33 @@ +/* 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_LOG2_H__ +#define __INT_LOG2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define d0log2d0(in1) dlog2s(in1) +#define d2log2d2(in1, size1, out) dlog2a(in1,size1[0]*size1[1], out) +#define s0log2s0(in1) slog2s(in1, in2) +#define s2log2s2(in1, size1, out) slog2a(in1,size1[0]*size1[1], out) +#define z0log2z0(in1) zlog2s(in1, in2) +#define z2log2z2(in1, size1, out) zlog2a(in1,size1[0]*size1[1], out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_LOG2_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_logspace.h b/src/c/elementaryFunctions/interfaces/int_logspace.h new file mode 100644 index 00000000..2c244006 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_logspace.h @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_LOGSPACE_H__ +#define __INT_LOGSPACE_H__ + +#define d0d0d0logspaced2(in1,in2,in3,out) dlogspaces(in1,in2,in3,out) + +#define d2d2d0logspaced2(in1,size1,in2,size2,in3,out) dlogspacea(in1,size1[0],in2,in3,out) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_nancumsum.h b/src/c/elementaryFunctions/interfaces/int_nancumsum.h new file mode 100644 index 00000000..c82f6d65 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nancumsum.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_NANCUMSUM_H__ +#define __INT_NANCUMSUM_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2nancumsumd2(in1, size, out) dnancumsuma(in1, size[0]* size[1], out) +#define d2g2nancumsumd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dnancumsumrowa(in1, size1[0], size1[1], out) :dnancumsumcola(in1, size1[0], size1[1], out) + +#define s2nancumsums2(in1, size, out) snancumsuma(in1, size[0]* size[1], out) +#define s2g2nancumsums2(in1, size1, in2, size2, out) (in2[0]== 'r') ? snancumsumrowa(in1, size1[0], size1[1], out) :snancumsumcola(in1, size1[0], size1[1], out) + +#define z2nancumsumz2(in1, size, out) znancumsuma(in1, size[0]* size[1],out) +#define z2g2nancumsumz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? znancumsumrowa(in1, size1[0], size1[1], out) :znancumsumcola(in1, size1[0], size1[1], out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NANCUMSUM_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_nanmax.h b/src/c/elementaryFunctions/interfaces/int_nanmax.h new file mode 100644 index 00000000..6096290f --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nanmax.h @@ -0,0 +1,26 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_NANMAX_H__ +#define __INT_NANMAX_H__ + +#define d2nanmaxd0(in1, size) dnanmaxa(in1,size[0]* size[1]) +#define d2nanmaxd0d2(in1, size, out) dnanmax1a(in1,size[0], size[1], out) +#define d2g2nanmaxd2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmaxrow1a(in1, size1[0], size1[1], out) : dnanmaxcol1a(in1, size1[0] , size1[1], out) +#define d2g2nanmaxd2d2(in1, size1, in2, size2, out1, out2) (in2[0]=='r') ? dnanmaxrowa(in1, size1[0], size1[1], out1, out2) : dnanmaxcola(in1, size1[0] , size1[1], out1, out2) + +#define s2nanmaxs0(in1, size) snanmaxa(in1,size[0]* size[1]) +#define s2nanmaxs0s2(in1, size, out) snanmax1a(in1,size[0], size[1], out) +#define s2g2nanmaxs2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanmaxrow1a(in1, size1[0], size1[1], out) : snanmaxcol1a(in1, size1[0] , size1[1], out) +#define s2g2nanmaxs2s2(in1, size1, in2, size2, out1, out2) (in2[0]=='r') ? snanmaxrowa(in1, size1[0], size1[1], out1, out2) : snanmaxcola(in1, size1[0] , size1[1], out1, out2) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_nanmean.h b/src/c/elementaryFunctions/interfaces/int_nanmean.h new file mode 100644 index 00000000..0195b0d3 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nanmean.h @@ -0,0 +1,32 @@ + /*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_NANMEAN_H__ +#define __INT_NANMEAN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d2nanmeand0(in1, size) dnanmeana(in1,size[0]* size[1]) +#define d2g2nanmeand2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmeanrowa(in1, size1[0], size1[1], out) : dnanmeancola(in1, size1[0] , size1[1], out) + +#define s2nanmeans0(in1, size) snanmeana(in1,size[0]* size[1]) +#define s2g2nanmeans2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanmeanrowa(in1, size1[0], size1[1], out) : snanmeancola(in1, size1[0] , size1[1], out) + +#define z2nanmeanz0(in1, size) znanmeana(in1,size[0]* size[1]) +#define z2g2nanmeanz2(in1, size1, in2, size2, out) (in2[0]=='r') ? znanmeanrowa(in1, size1[0], size1[1], out) : znanmeancola(in1, size1[0] , size1[1], out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NANMEAN_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_nanmin.h b/src/c/elementaryFunctions/interfaces/int_nanmin.h new file mode 100644 index 00000000..e351a240 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nanmin.h @@ -0,0 +1,31 @@ + /*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_NANMIN_H__ +#define __INT_NANMIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d2nanmind0d2(in1, size, pos) dnanmina(in1,size[0], size[1], pos) +#define d2nanmind0(in1, size) dnanminnpa(in1,size[0], size[1]) +#define d0nanmind0d2(in1, pos) dnanmins(in1, pos) +#define d0nanmind0(in1) dnanminnps(in1) + +#define d2g2nanmind2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanminrownpa(in1, size1[0], size1[1], out) : dnanmincolnpa(in1, size1[0] , size1[1], out) +#define d2g2nanmind2d2(in1, size1, in2, size2, out, p) (in2[0]=='r') ? dnanminrowa(in1, size1[0], size1[1], p, out) : dnanmincola(in1, size1[0] , size1[1], out, p) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NANMIN_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_nansum.h b/src/c/elementaryFunctions/interfaces/int_nansum.h new file mode 100644 index 00000000..149d69b8 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nansum.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_NANSUM_H__ +#define __INT_NANSUM_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2nansumd0(in1, size) dnansuma(in1, size[0]* size[1]) +#define d2g2nansumd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dnansumrowa(in1, size1[0], size1[1], out) :dnansumcola(in1, size1[0], size1[1], out) + +#define s2nansums0(in1, size) snansuma(in1, size[0]* size[1]) +#define s2g2nansums2(in1, size1, in2, size2, out) (in2[0]== 'r') ? snansumrowa(in1, size1[0], size1[1], out) :snansumcola(in1, size1[0], size1[1], out) + +#define z2nansumz0(in1, size) znansuma(in1, size[0]* size[1]) +#define z2g2nansumz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? znansumrowa(in1, size1[0], size1[1], out) :znansumcola(in1, size1[0], size1[1], out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MATRIX_H__*/ diff --git a/src/c/elementaryFunctions/interfaces/int_nextpow2.h b/src/c/elementaryFunctions/interfaces/int_nextpow2.h new file mode 100644 index 00000000..6ae4747b --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nextpow2.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + + +#ifndef __INT_NEXTPOW2_H__ +#define __INT_NEXTPOW2_H__ + + +#include "nextpow2.h" + +#define d0nextpow2d0(in,size,out) dnextpow2a(in,size[0]*size[1],out) + +#define d2nextpow2d2(in,size,out) dnextpow2a(in,size[0]*size[1],out) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_nthroot.h b/src/c/elementaryFunctions/interfaces/int_nthroot.h new file mode 100644 index 00000000..aa48fcc9 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nthroot.h @@ -0,0 +1,23 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_NTHROOT_H__ +#define __INT_NTHROOT_H__ + +#define d2d2nthrootd2(in1, size1, in2, size2, out) dnthroota(in1, size1[0], size1[1], in2, size2[0], size2[1], out) +#define d2d0nthrootd2(in1, size1, in2, out) dnthroot1a(in1, size1[0], size1[1], in2, out) +#define d0d0nthrootd0(in1, in2) dnthroots(in1, in2) +#define s2s2nthrootd2(in1, size1, in2, size2, out) snthroota(in1, size1[0], size1[1], in2, size2[0], size2[1], out) +#define s2s0nthrootd2(in1, size1, in2, out) snthroot1a(in1, size1[0], size1[1], in2, out) +#define s0s0nthrootd0(in1, in2) snthroots(in1, in2) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_oct2dec.h b/src/c/elementaryFunctions/interfaces/int_oct2dec.h new file mode 100644 index 00000000..0f5d1f24 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_pmodulo.h b/src/c/elementaryFunctions/interfaces/int_pmodulo.h new file mode 100644 index 00000000..72b12770 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_pmodulo.h @@ -0,0 +1,26 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_PMODULO_H__ +#define __INT_PMODULO_H__ + +#define d0d0pmodulod0(in1, in2) dpmodulos(in1,in2) +#define d2d2pmodulod2(in1, size1, in2, size2, out) dpmoduloa(in1,size1[0]*size1[1],in2, out) + +#define s0s0pmodulos0(in1, in2) spmodulos(in1,in2) +#define s2s2pmodulos2(in1, size1, in2, size2, out) spmoduloa(in1,size1[0]*size1[1],in2, out) + +#define i160i160pmoduloi160(in1, in2) i16pmodulos(in1,in2) +#define i162i162pmoduloi162(in1, size1, in2, size2, out) i16pmoduloa(in1,size1[0]*size1[1],in2, out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_primes.h b/src/c/elementaryFunctions/interfaces/int_primes.h new file mode 100644 index 00000000..d48a6831 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_round.h b/src/c/elementaryFunctions/interfaces/int_round.h index a5da230c..7d013c1e 100644 --- a/src/c/elementaryFunctions/interfaces/int_round.h +++ b/src/c/elementaryFunctions/interfaces/int_round.h @@ -23,6 +23,14 @@ #define z0roundz0(in) zrounds(in) +#define u80roundu80(in) u8rounds(in) + +#define i80roundi80(in) i8rounds(in) + +#define u160roundu160(in) u16rounds(in) + +#define i160roundi160(in) i16rounds(in) + #define s2rounds2(in,size,out) srounda(in, size[0]*size[1], out) #define d2roundd2(in,size,out) drounda(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2roundz2(in,size,out) zrounda(in, size[0]*size[1], out) +#define u82roundu82(in,size,out) u8rounda(in, size[0]*size[1], out) + +#define i82roundi82(in,size,out) i8rounda(in, size[0]*size[1], out) + +#define u162roundu162(in,size,out) u16rounda(in, size[0]*size[1], out) + +#define i162roundi162(in,size,out) i16rounda(in, size[0]*size[1], out) + #endif /* !__INT_ROUND_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_sec.h b/src/c/elementaryFunctions/interfaces/int_sec.h new file mode 100644 index 00000000..b07cdfc9 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_secd.h b/src/c/elementaryFunctions/interfaces/int_secd.h new file mode 100644 index 00000000..9304eb04 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_sech.h b/src/c/elementaryFunctions/interfaces/int_sech.h new file mode 100644 index 00000000..1cd42218 --- /dev/null +++ b/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/src/c/elementaryFunctions/interfaces/int_sin.h b/src/c/elementaryFunctions/interfaces/int_sin.h index 556281a5..4132704a 100644 --- a/src/c/elementaryFunctions/interfaces/int_sin.h +++ b/src/c/elementaryFunctions/interfaces/int_sin.h @@ -23,6 +23,14 @@ #define z0sinz0(in) zsins(in) +#define u80sins0(in) u8sins(in) + +#define i80sins0(in) i8sins(in) + +#define u160sins0(in) u16sins(in) + +#define i160sins0(in) i16sins(in) + #define s2sins2(in,size,out) ssina(in, size[0]*size[1], out) #define d2sind2(in,size,out) dsina(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2sinz2(in,size,out) zsina(in, size[0]*size[1], out) +#define u82sins2(in,size,out) u8sina(in, size[0]*size[1], out) + +#define i82sins2(in,size,out) i8sina(in, size[0]*size[1], out) + +#define u162sins2(in,size,out) u16sina(in, size[0]*size[1], out) + +#define i162sins2(in,size,out) i16sina(in, size[0]*size[1], out) + #endif /* !__INT_SIN_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_sinc.h b/src/c/elementaryFunctions/interfaces/int_sinc.h new file mode 100644 index 00000000..35a519db --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_sinc.h @@ -0,0 +1,19 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SINC_H__ +#define __INT_SINC_H__ + +#define d2sincd2(sample,size,oup) dsinca(sample,size[1],oup) +#define z2sincz2(sample,size,oup) zsinca(sample,size[1],oup) + +#endif /* !__INT_SINC_H__! */ diff --git a/src/c/elementaryFunctions/interfaces/int_sind.h b/src/c/elementaryFunctions/interfaces/int_sind.h new file mode 100644 index 00000000..780a6965 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_sind.h @@ -0,0 +1,23 @@ + /* 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_SIND_H__ +#define __INT_SIND_H__ + +#define d0sindd0(in) dsinds(in) +#define s0sinds0(in) ssinds(in) +#define s0sindd0(in) ssinds(in) +#define d2sindd2(in, size1, out) dsinda(in, size1[0]*size1[1], out) +#define s2sinds2(in, size1, out) ssinda(in, size1[0]*size1[1], out) +#define s2sindd2(in, size1, out) ssinda(in, size1[0]*size1[1], out) + +#endif /* !__INT_SIND_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_sinh.h b/src/c/elementaryFunctions/interfaces/int_sinh.h index e0c930e9..c5682a46 100644 --- a/src/c/elementaryFunctions/interfaces/int_sinh.h +++ b/src/c/elementaryFunctions/interfaces/int_sinh.h @@ -23,6 +23,14 @@ #define z0sinhz0(in) zsinhs(in) +#define u80sinhs0(in) u8sinhs(in) + +#define i80sinhs0(in) i8sinhs(in) + +#define u160sinhs0(in) u16sinhs(in) + +#define i160sinhs0(in) i16sinhs(in) + #define s2sinhs2(in,size,out) ssinha(in, size[0]*size[1], out) #define d2sinhd2(in,size,out) dsinha(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2sinhz2(in,size,out) zsinha(in, size[0]*size[1], out) +#define u82sinhs2(in,size,out) u8sinha(in, size[0]*size[1], out) + +#define i82sinhs2(in,size,out) i8sinha(in, size[0]*size[1], out) + +#define u162sinhs2(in,size,out) u16sinha(in, size[0]*size[1], out) + +#define i162sinhs2(in,size,out) i16sinha(in, size[0]*size[1], out) + #endif /* !__INT_SINH_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_sqrt.h b/src/c/elementaryFunctions/interfaces/int_sqrt.h index 0efbca96..090d9825 100644 --- a/src/c/elementaryFunctions/interfaces/int_sqrt.h +++ b/src/c/elementaryFunctions/interfaces/int_sqrt.h @@ -33,27 +33,32 @@ #define __INT_SQRT_H__ #define s0sqrts0(in) ssqrts(in) -
+ #define s0sqrtc0(in) csqrts(FloatComplex(in,0)) #define d0sqrtd0(in) dsqrts(in) -
+ #define d0sqrtz0(in) zsqrts(DoubleComplex(in,0)) #define c0sqrtc0(in) csqrts(in) -
+ #define z0sqrtz0(in) zsqrts(in) -
+ + + #define s2sqrts2(in,size,out) ssqrta(in, size[0]*size[1], out) #define s2sqrtc2(in,size,out) csqrta(FloatComplexMatrix(in,0), size[0]*size[1], out) #define d2sqrtd2(in,size,out) dsqrta(in, size[0]*size[1], out) -
+ #define d2sqrtz2(in,size,out) zsqrta(DoubleComplexMatrix(in,0), size[0]*size[1], out) #define c2sqrtc2(in,size,out) csqrta(in, size[0]*size[1], out) -
-#define z2sqrtz2(in,size,out) zsqrta(in, size[0]*size[1], out)
+ +#define z2sqrtz2(in,size,out) zsqrta(in, size[0]*size[1], out) + + + #endif /* !__INT_SQRT_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_tan.h b/src/c/elementaryFunctions/interfaces/int_tan.h index c2c3df2e..ddfb4ca1 100644 --- a/src/c/elementaryFunctions/interfaces/int_tan.h +++ b/src/c/elementaryFunctions/interfaces/int_tan.h @@ -23,6 +23,14 @@ #define z0tanz0(in) ztans(in) +#define u80tans0(in) u8tans(in) + +#define i80tans0(in) i8tans(in) + +#define u160tans0(in) u16tans(in) + +#define i160tans0(in) i16tans(in) + #define s2tans2(in,size,out) stana(in, size[0]*size[1], out) #define d2tand2(in,size,out) dtana(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2tanz2(in,size,out) ztana(in, size[0]*size[1], out) +#define u82tans2(in,size,out) u8tana(in, size[0]*size[1], out) + +#define i82tans2(in,size,out) i8tana(in, size[0]*size[1], out) + +#define u162tans2(in,size,out) u16tana(in, size[0]*size[1], out) + +#define i162tans2(in,size,out) i16tana(in, size[0]*size[1], out) + #endif /* !__INT_TAN_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_tand.h b/src/c/elementaryFunctions/interfaces/int_tand.h new file mode 100644 index 00000000..d2fb30ea --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_tand.h @@ -0,0 +1,23 @@ + /* 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_TAND_H__ +#define __INT_TAND_H__ + +#define d0tandd0(in) dtands(in) +#define s0tands0(in) stands(in) +#define s0tandd0(in) stands(in) +#define d2tandd2(in, size1, out) dtanda(in, size1[0]*size1[1], out) +#define s2tands2(in, size1, out) standa(in, size1[0]*size1[1], out) +#define s2tandd2(in, size1, out) standa(in, size1[0]*size1[1], out) + +#endif /* !__INT_TAND_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_tanh.h b/src/c/elementaryFunctions/interfaces/int_tanh.h index 1819d3a1..e60e2c26 100644 --- a/src/c/elementaryFunctions/interfaces/int_tanh.h +++ b/src/c/elementaryFunctions/interfaces/int_tanh.h @@ -23,6 +23,14 @@ #define z0tanhz0(in) ztanhs(in) +#define u80tanhs0(in) u8tanhs(in) + +#define i80tanhs0(in) i8tanhs(in) + +#define u160tanhs0(in) u16tanhs(in) + +#define i160tanhs0(in) i16tanhs(in) + #define s2tanhs2(in,size,out) stanha(in, size[0]*size[1], out) #define d2tanhd2(in,size,out) dtanha(in, size[0]*size[1], out) @@ -31,4 +39,12 @@ #define z2tanhz2(in,size,out) ztanha(in, size[0]*size[1], out) +#define u82tanhs2(in,size,out) u8tanha(in, size[0]*size[1], out) + +#define i82tanhs2(in,size,out) i8tanha(in, size[0]*size[1], out) + +#define u162tanhs2(in,size,out) u16tanha(in, size[0]*size[1], out) + +#define i162tanhs2(in,size,out) i16tanha(in, size[0]*size[1], out) + #endif /* !__INT_TANH_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_uint16.h b/src/c/elementaryFunctions/interfaces/int_uint16.h new file mode 100644 index 00000000..12808776 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_uint16.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_UINT16_H__ +#define __INT_UINT16_H__ + +#define s0uint16u160(in) suint16s(in) + +#define d0uint16u160(in) duint16s(in) + +#define u80uint16u160(in) u8uint16s(in) + +#define i80uint16u160(in) i8uint16s(in) + +#define i160uint16u160(in) i16uint16s(in) + +#define s2uint16u162(in,size,out) suint16a(in, size[0]*size[1], out) + +#define d2uint16u162(in,size,out) duint16a(in, size[0]*size[1], out) + +#define u82uint16u162(in,size,out) u8uint16a(in, size[0]*size[1], out) + +#define i82uint16u162(in,size,out) i8int16a(in, size[0]*size[1], out) + +#define i162uint16u162(in,size,out) i16uint16a(in, size[0]*size[1], out) + +#endif /* !__INT_UINT8_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_uint32.h b/src/c/elementaryFunctions/interfaces/int_uint32.h new file mode 100644 index 00000000..7c9353b3 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_uint32.h @@ -0,0 +1,44 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_UINT32_H__ +#define __INT_UINT32_H__ + +#define s0uint32u320(in) suint32s(in) + +#define d0uint32u320(in) duint32s(in) + +#define u80uint32u320(in) u8uint32s(in) + +#define i80uint32u320(in) i8uint32s(in) + +#define u160uint32u320(in) u16uint32s(in) + +#define i160uint32u320(in) i16uint32s(in) + +#define i320uint32u320(in) i32uint32s(in) + +#define s2uint32u322(in,size,out) suint32a(in, size[0]*size[1], out) + +#define d2uint32u322(in,size,out) duint32a(in, size[0]*size[1], out) + +#define u82uint32u322(in,size,out) u8uint32a(in, size[0]*size[1], out) + +#define i82uint32u322(in,size,out) i8int32a(in, size[0]*size[1], out) + +#define u162uint32u322(in,size,out) u16uint32a(in, size[0]*size[1], out) + +#define i162uint32u322(in,size,out) i16uint32a(in, size[0]*size[1], out) + +#define i322uint32u322(in,size,out) i32uint32a(in, size[0]*size[1], out) + +#endif /* !__INT_UINT32_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_uint8.h b/src/c/elementaryFunctions/interfaces/int_uint8.h new file mode 100644 index 00000000..ac0bc43e --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_uint8.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_UINT8_H__ +#define __INT_UINT8_H__ + +#define s0uint8u80(in) suint8s(in) + +#define d0uint8u80(in) duint8s(in) + +#define i80uint8u80(in) i8uint8s(in) + +#define u160uint8u80(in) u16uint8s(in) + +#define i160uint8u80(in) i16uint8s(in) + +#define s2uint8u82(in,size,out) suint8a(in, size[0]*size[1], out) + +#define d2uint8u82(in,size,out) duint8a(in, size[0]*size[1], out) + +#define i82uint8u82(in,size,out) i8uint8a(in, size[0]*size[1], out) + +#define u162uint8u82(in,size,out) u16uint8a(in, size[0]*size[1], out) + +#define i162uint8u82(in,size,out) i16uint8a(in, size[0]*size[1], out) + +#endif /* !__INT_UINT8_H__ */ diff --git a/src/c/elementaryFunctions/iscolumn/discolumna.c b/src/c/elementaryFunctions/iscolumn/discolumna.c new file mode 100644 index 00000000..8bebfcad --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/discolumna.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" +char discolumna(double* inp, int size1) +{ + char out= 'F' ; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/discolumns.c b/src/c/elementaryFunctions/iscolumn/discolumns.c new file mode 100644 index 00000000..b81074b5 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/discolumns.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" + +char discolumns(double inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/giscolumna.c b/src/c/elementaryFunctions/iscolumn/giscolumna.c new file mode 100644 index 00000000..db6ff431 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/giscolumna.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" +#include "string.h" +char giscolumna(char *inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/giscolumns.c b/src/c/elementaryFunctions/iscolumn/giscolumns.c new file mode 100644 index 00000000..57b93e95 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/giscolumns.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" + +char giscolumns(char inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/siscolumna.c b/src/c/elementaryFunctions/iscolumn/siscolumna.c new file mode 100644 index 00000000..ed4ee5b9 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/siscolumna.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" +char siscolumna(float* inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/siscolumns.c b/src/c/elementaryFunctions/iscolumn/siscolumns.c new file mode 100644 index 00000000..ebb89e11 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/siscolumns.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" + +char siscolumns(float inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/u16iscolumna.c b/src/c/elementaryFunctions/iscolumn/u16iscolumna.c new file mode 100644 index 00000000..ef0821d6 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/u16iscolumna.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" +#include "uint16.h" +char u16iscolumna(uint16* inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/u16iscolumns.c b/src/c/elementaryFunctions/iscolumn/u16iscolumns.c new file mode 100644 index 00000000..7a174642 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/u16iscolumns.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" +#include "uint16.h" + +char u16iscolumns(uint16 inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/ziscolumna.c b/src/c/elementaryFunctions/iscolumn/ziscolumna.c new file mode 100644 index 00000000..a1aca1bf --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/ziscolumna.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "doubleComplex.h" +#include "iscolumn.h" +#include "types.h" + +char ziscolumna(doubleComplex *inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/iscolumn/ziscolumns.c b/src/c/elementaryFunctions/iscolumn/ziscolumns.c new file mode 100644 index 00000000..f1d28508 --- /dev/null +++ b/src/c/elementaryFunctions/iscolumn/ziscolumns.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "iscolumn.h" +#include "types.h" +#include "doubleComplex.h" + +char ziscolumns(doubleComplex inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isequal/disequala.c b/src/c/elementaryFunctions/isequal/disequala.c new file mode 100644 index 00000000..8781ac7b --- /dev/null +++ b/src/c/elementaryFunctions/isequal/disequala.c @@ -0,0 +1,39 @@ +/* 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 <isreal.h> + +char disequala(double* inp1, int size1r, int size1c, double* inp2, int size2r, int size2c) +{ + if ((size1r != size2r) && (size1c != size2c)) + return 'F'; + else + { + int i, f = 0; + for (i = 0; i<size1r*size1c; i++) + { + if (inp1[i] != inp2[i]) + { + f = 1; + break; + } + } + + if (f == 1) + return 'F'; + else + return 'T'; + } +} + diff --git a/src/c/elementaryFunctions/isequal/disequals.c b/src/c/elementaryFunctions/isequal/disequals.c new file mode 100644 index 00000000..319c3308 --- /dev/null +++ b/src/c/elementaryFunctions/isequal/disequals.c @@ -0,0 +1,24 @@ +/* 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 <isreal.h> + +char disequals(double inp1, double inp2) +{ + if (inp1 == inp2) + return 'T'; + else + return 'F'; +} + diff --git a/src/c/elementaryFunctions/isequal/sisequala.c b/src/c/elementaryFunctions/isequal/sisequala.c new file mode 100644 index 00000000..2634efd5 --- /dev/null +++ b/src/c/elementaryFunctions/isequal/sisequala.c @@ -0,0 +1,39 @@ +/* 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 <isreal.h> + +char sisequala(float* inp1, int size1r, int size1c, float* inp2, int size2r, int size2c) +{ + if ((size1r != size2r) && (size1c != size2c)) + return 'F'; + else + { + int i, f = 0; + for (i = 0; i<size1r*size1c; i++) + { + if (inp1[i] != inp2[i]) + { + f = 1; + break; + } + } + + if (f == 1) + return 'F'; + else + return 'T'; + } +} + diff --git a/src/c/elementaryFunctions/isequal/sisequals.c b/src/c/elementaryFunctions/isequal/sisequals.c new file mode 100644 index 00000000..66bef36d --- /dev/null +++ b/src/c/elementaryFunctions/isequal/sisequals.c @@ -0,0 +1,24 @@ +/* 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 <isreal.h> + +char sisequals(float inp1, float inp2) +{ + if (inp1 == inp2) + return 'T'; + else + return 'F'; +} + diff --git a/src/c/elementaryFunctions/isequal/u16isequala.c b/src/c/elementaryFunctions/isequal/u16isequala.c new file mode 100644 index 00000000..62de1e86 --- /dev/null +++ b/src/c/elementaryFunctions/isequal/u16isequala.c @@ -0,0 +1,40 @@ +/* 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 <isreal.h> +#include "uint16.h" + +char u16isequala(uint16* inp1, int size1r, int size1c, uint16* inp2, int size2r, int size2c) +{ + if ((size1r != size2r) && (size1c != size2c)) + return 'F'; + else + { + int i, f = 0; + for (i = 0; i<size1r*size1c; i++) + { + if (inp1[i] != inp2[i]) + { + f = 1; + break; + } + } + + if (f == 1) + return 'F'; + else + return 'T'; + } +} + diff --git a/src/c/elementaryFunctions/isequal/u16isequals.c b/src/c/elementaryFunctions/isequal/u16isequals.c new file mode 100644 index 00000000..4f797d40 --- /dev/null +++ b/src/c/elementaryFunctions/isequal/u16isequals.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 <isreal.h> +#include "uint16.h" + +char u16isequals(uint16 inp1, uint16 inp2) +{ + if (inp1 == inp2) + return 'T'; + else + return 'F'; +} + diff --git a/src/c/elementaryFunctions/isequal/zisequala.c b/src/c/elementaryFunctions/isequal/zisequala.c new file mode 100644 index 00000000..13d241fe --- /dev/null +++ b/src/c/elementaryFunctions/isequal/zisequala.c @@ -0,0 +1,40 @@ +/* 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 <isreal.h> +#include "doubleComplex.h" + +char zisequala(doubleComplex* inp1, int size1r, int size1c, doubleComplex* inp2, int size2r, int size2c) +{ + if ((size1r != size2r) && (size1c != size2c)) + return 'F'; + else + { + int i, f = 0; + for (i = 0; i<size1r*size1c; i++) + { + if (!(zisequals(inp1[i],inp2[i]))) + { + f = 1; + break; + } + } + + if (f == 1) + return 'F'; + else + return 'T'; + } +} + diff --git a/src/c/elementaryFunctions/isequal/zisequals.c b/src/c/elementaryFunctions/isequal/zisequals.c new file mode 100644 index 00000000..6914dc87 --- /dev/null +++ b/src/c/elementaryFunctions/isequal/zisequals.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 <isreal.h> +#include "doubleComplex.h" + +char zisequals(doubleComplex inp1, doubleComplex inp2) +{ + if ((zreals(inp1) == zreals(inp2)) && (zimags(inp1) == zimags(inp2))) + return 'T'; + else + return 'F'; +} + diff --git a/src/c/elementaryFunctions/isinf/disinfs.c b/src/c/elementaryFunctions/isinf/disinfs.c new file mode 100644 index 00000000..1d940051 --- /dev/null +++ b/src/c/elementaryFunctions/isinf/disinfs.c @@ -0,0 +1,24 @@ +/* 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 "isinf.h" + +char disinfs(double x) +{ + char o = 'F'; + if (x == INFINITY || x == - INFINITY) + o = 'T'; + return o; +} diff --git a/src/c/elementaryFunctions/isinf/sisinfs.c b/src/c/elementaryFunctions/isinf/sisinfs.c new file mode 100644 index 00000000..c36c0a5b --- /dev/null +++ b/src/c/elementaryFunctions/isinf/sisinfs.c @@ -0,0 +1,24 @@ +/* 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 "isinf.h" + +char sisinfs(float x) +{ + char o = 'F'; + if (x == INFINITY || x == - INFINITY) + o = 'T'; + return o; +} diff --git a/src/c/elementaryFunctions/ismatrix/dismatrixa.c b/src/c/elementaryFunctions/ismatrix/dismatrixa.c new file mode 100644 index 00000000..4fe7d192 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/dismatrixa.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char dismatrixa(double* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/dismatrixs.c b/src/c/elementaryFunctions/ismatrix/dismatrixs.c new file mode 100644 index 00000000..15edcf22 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/dismatrixs.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char dismatrixs(double in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/gismatrixa.c b/src/c/elementaryFunctions/ismatrix/gismatrixa.c new file mode 100644 index 00000000..f7288145 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/gismatrixa.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char gismatrixa(char* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/gismatrixs.c b/src/c/elementaryFunctions/ismatrix/gismatrixs.c new file mode 100644 index 00000000..61a3062a --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/gismatrixs.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char gismatrixs(char in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/sismatrixa.c b/src/c/elementaryFunctions/ismatrix/sismatrixa.c new file mode 100644 index 00000000..44335b81 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/sismatrixa.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char sismatrixa(float* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/sismatrixs.c b/src/c/elementaryFunctions/ismatrix/sismatrixs.c new file mode 100644 index 00000000..d6c6f233 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/sismatrixs.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char sismatrixs(float in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c b/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c new file mode 100644 index 00000000..c16d54c8 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/u16ismatrixa.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +char u16ismatrixa(uint16* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c b/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c new file mode 100644 index 00000000..64313577 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/u16ismatrixs.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +char u16ismatrixs(uint16 in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/zismatrixa.c b/src/c/elementaryFunctions/ismatrix/zismatrixa.c new file mode 100644 index 00000000..32d72605 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/zismatrixa.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +char zismatrixa(doubleComplex* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/zismatrixs.c b/src/c/elementaryFunctions/ismatrix/zismatrixs.c new file mode 100644 index 00000000..d38592c7 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/zismatrixs.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +char zismatrixs(doubleComplex in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/isreal/disreals.c b/src/c/elementaryFunctions/isreal/disreals.c new file mode 100644 index 00000000..8c7c8201 --- /dev/null +++ b/src/c/elementaryFunctions/isreal/disreals.c @@ -0,0 +1,17 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "isreal.h" + +double disreals(double a){ + return 1; +} diff --git a/src/c/elementaryFunctions/isreal/sisreals.c b/src/c/elementaryFunctions/isreal/sisreals.c new file mode 100644 index 00000000..4b93c02c --- /dev/null +++ b/src/c/elementaryFunctions/isreal/sisreals.c @@ -0,0 +1,17 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "isreal.h" + +float sisreals(float a){ + return 1; +} diff --git a/src/c/elementaryFunctions/isrow/disrowa.c b/src/c/elementaryFunctions/isrow/disrowa.c new file mode 100644 index 00000000..826afca7 --- /dev/null +++ b/src/c/elementaryFunctions/isrow/disrowa.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" +char disrowa(double* inp, int size1) +{ + char out= 'F' ; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/isrow/disrows.c b/src/c/elementaryFunctions/isrow/disrows.c new file mode 100644 index 00000000..e3bdadb5 --- /dev/null +++ b/src/c/elementaryFunctions/isrow/disrows.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" + +char disrows(double inp) +{ + double out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isrow/gisrowa.c b/src/c/elementaryFunctions/isrow/gisrowa.c new file mode 100644 index 00000000..c62350fc --- /dev/null +++ b/src/c/elementaryFunctions/isrow/gisrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" +#include "string.h" +char gisrowa(char *inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/isrow/gisrows.c b/src/c/elementaryFunctions/isrow/gisrows.c new file mode 100644 index 00000000..a4393bdb --- /dev/null +++ b/src/c/elementaryFunctions/isrow/gisrows.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" + +char gisrows(char inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isrow/sisrowa.c b/src/c/elementaryFunctions/isrow/sisrowa.c new file mode 100644 index 00000000..bf9d4c36 --- /dev/null +++ b/src/c/elementaryFunctions/isrow/sisrowa.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" +char sisrowa(float* inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/isrow/sisrows.c b/src/c/elementaryFunctions/isrow/sisrows.c new file mode 100644 index 00000000..331e0a9d --- /dev/null +++ b/src/c/elementaryFunctions/isrow/sisrows.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" + +char sisrows(float inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isrow/u16isrowa.c b/src/c/elementaryFunctions/isrow/u16isrowa.c new file mode 100644 index 00000000..3ddbb0fe --- /dev/null +++ b/src/c/elementaryFunctions/isrow/u16isrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" +#include "uint16.h" +char u16isrowa(uint16* inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/isrow/u16isrows.c b/src/c/elementaryFunctions/isrow/u16isrows.c new file mode 100644 index 00000000..2942dd3b --- /dev/null +++ b/src/c/elementaryFunctions/isrow/u16isrows.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" +#include "uint16.h" + +char u16isrows(uint16 inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isrow/zisrowa.c b/src/c/elementaryFunctions/isrow/zisrowa.c new file mode 100644 index 00000000..312ddf5b --- /dev/null +++ b/src/c/elementaryFunctions/isrow/zisrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "doubleComplex.h" +#include "isrow.h" +#include "types.h" + +char zisrowa(doubleComplex *inp, int size1) +{ + char out='F'; + if(size1==1) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/isrow/zisrows.c b/src/c/elementaryFunctions/isrow/zisrows.c new file mode 100644 index 00000000..96e671ab --- /dev/null +++ b/src/c/elementaryFunctions/isrow/zisrows.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isrow.h" +#include "types.h" +#include "doubleComplex.h" + +char zisrows(doubleComplex inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/disscalara.c b/src/c/elementaryFunctions/isscalar/disscalara.c new file mode 100644 index 00000000..eb70cf6a --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/disscalara.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isscalar.h" +#include "types.h" +char disscalara(double* inp, int size1) +{ + char out= 'F' ; + + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/disscalars.c b/src/c/elementaryFunctions/isscalar/disscalars.c new file mode 100644 index 00000000..fe7ce3e3 --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/disscalars.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isscalar.h" +#include "types.h" + +char disscalars(double inp) +{ + double out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/gisscalara.c b/src/c/elementaryFunctions/isscalar/gisscalara.c new file mode 100644 index 00000000..fdfac778 --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/gisscalara.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isscalar.h" +#include "types.h" +#include "string.h" +char gisscalara(char *inp, int size1) +{ + char out='F'; + + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/gisscalars.c b/src/c/elementaryFunctions/isscalar/gisscalars.c new file mode 100644 index 00000000..5a208959 --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/gisscalars.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isscalar.h" +#include "types.h" + +char giscalars(char inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/sisscalara.c b/src/c/elementaryFunctions/isscalar/sisscalara.c new file mode 100644 index 00000000..59a51653 --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/sisscalara.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isscalar.h" +#include "types.h" +char sisscalara(float* inp, int size1) +{ + char out='F'; + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/sisscalars.c b/src/c/elementaryFunctions/isscalar/sisscalars.c new file mode 100644 index 00000000..6ca7c4b4 --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/sisscalars.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isscalar.h" +#include "types.h" + +char sisscalars(float inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/zisscalara.c b/src/c/elementaryFunctions/isscalar/zisscalara.c new file mode 100644 index 00000000..942bbb54 --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/zisscalara.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "doubleComplex.h" +#include "isscalar.h" +#include "types.h" + +char zisscalara(doubleComplex *inp, int size1) +{ + char out='F'; + + return out; +} diff --git a/src/c/elementaryFunctions/isscalar/zisscalars.c b/src/c/elementaryFunctions/isscalar/zisscalars.c new file mode 100644 index 00000000..2bf8e949 --- /dev/null +++ b/src/c/elementaryFunctions/isscalar/zisscalars.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isscalar.h" +#include "types.h" +#include "doubleComplex.h" + +char zisscalars(doubleComplex inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/issquare/dissquarea.c b/src/c/elementaryFunctions/issquare/dissquarea.c new file mode 100644 index 00000000..840190d0 --- /dev/null +++ b/src/c/elementaryFunctions/issquare/dissquarea.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "issquare.h" +#include "types.h" +char dissquarea(double* inp, int size1, int size2) +{ + char out= 'F' ; + if(size1==size2) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/issquare/dissquares.c b/src/c/elementaryFunctions/issquare/dissquares.c new file mode 100644 index 00000000..ac6d67e1 --- /dev/null +++ b/src/c/elementaryFunctions/issquare/dissquares.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "issquare.h" +#include "types.h" + +char dissquares(double inp) +{ + double out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/issquare/gissquarea.c b/src/c/elementaryFunctions/issquare/gissquarea.c new file mode 100644 index 00000000..73e2b37e --- /dev/null +++ b/src/c/elementaryFunctions/issquare/gissquarea.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "issquare.h" +#include "types.h" +#include "string.h" +char gissquarea(char *inp, int size1, int size2) +{ + char out='F'; + if(size1==size2) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/issquare/gissquares.c b/src/c/elementaryFunctions/issquare/gissquares.c new file mode 100644 index 00000000..572afd19 --- /dev/null +++ b/src/c/elementaryFunctions/issquare/gissquares.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "issquare.h" +#include "types.h" + +char gissquares(char inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/issquare/sissquarea.c b/src/c/elementaryFunctions/issquare/sissquarea.c new file mode 100644 index 00000000..856cb818 --- /dev/null +++ b/src/c/elementaryFunctions/issquare/sissquarea.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "issquare.h" +#include "types.h" +char sissquarea(float* inp, int size1, int size2) +{ + char out='F'; + if(size1==size2) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/issquare/sissquares.c b/src/c/elementaryFunctions/issquare/sissquares.c new file mode 100644 index 00000000..1a6fbf85 --- /dev/null +++ b/src/c/elementaryFunctions/issquare/sissquares.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "issquare.h" +#include "types.h" + +char sissquares(float inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/issquare/zissquarea.c b/src/c/elementaryFunctions/issquare/zissquarea.c new file mode 100644 index 00000000..023b8fc6 --- /dev/null +++ b/src/c/elementaryFunctions/issquare/zissquarea.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "doubleComplex.h" +#include "issquare.h" +#include "types.h" + +char zissquarea(doubleComplex *inp, int size1, int size2) +{ + char out='F'; + if(size1==size2) + { + out = 'T'; + } + return out; +} diff --git a/src/c/elementaryFunctions/issquare/zissquares.c b/src/c/elementaryFunctions/issquare/zissquares.c new file mode 100644 index 00000000..2c1bb566 --- /dev/null +++ b/src/c/elementaryFunctions/issquare/zissquares.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "issquare.h" +#include "types.h" +#include "doubleComplex.h" + +char zissquares(doubleComplex inp) +{ + char out='T'; + + return out; +} diff --git a/src/c/elementaryFunctions/isvector/disvectora.c b/src/c/elementaryFunctions/isvector/disvectora.c new file mode 100644 index 00000000..a96485be --- /dev/null +++ b/src/c/elementaryFunctions/isvector/disvectora.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +char disvectora(double* inp, int row, int col) +{ + if(row ==1 || col==1) + return 'T'; + return 'F'; +} diff --git a/src/c/elementaryFunctions/isvector/disvectors.c b/src/c/elementaryFunctions/isvector/disvectors.c new file mode 100644 index 00000000..703e6673 --- /dev/null +++ b/src/c/elementaryFunctions/isvector/disvectors.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char disvectors(double inp) +{ + double out='F'; + + return out; +} diff --git a/src/c/elementaryFunctions/isvector/gisvectora.c b/src/c/elementaryFunctions/isvector/gisvectora.c new file mode 100644 index 00000000..758fa879 --- /dev/null +++ b/src/c/elementaryFunctions/isvector/gisvectora.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +#include "string.h" +char gisvectora(char *inp, int row, int col) +{ + if(row ==1 || col==1) + return 'T'; + return 'F'; +} diff --git a/src/c/elementaryFunctions/isvector/gisvectors.c b/src/c/elementaryFunctions/isvector/gisvectors.c new file mode 100644 index 00000000..72118603 --- /dev/null +++ b/src/c/elementaryFunctions/isvector/gisvectors.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char gisvectors(char inp) +{ + char out='F'; + + return out; +} diff --git a/src/c/elementaryFunctions/isvector/sisvectora.c b/src/c/elementaryFunctions/isvector/sisvectora.c new file mode 100644 index 00000000..d6a4821b --- /dev/null +++ b/src/c/elementaryFunctions/isvector/sisvectora.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +char sisvectora(float* inp, int row, int col) +{ + if(row ==1 || col==1) + return 'T'; + return 'F'; +} diff --git a/src/c/elementaryFunctions/isvector/sisvectors.c b/src/c/elementaryFunctions/isvector/sisvectors.c new file mode 100644 index 00000000..019bd464 --- /dev/null +++ b/src/c/elementaryFunctions/isvector/sisvectors.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" + +char sisvectors(float inp) +{ + char out='F'; + + return out; +} diff --git a/src/c/elementaryFunctions/isvector/zisvectora.c b/src/c/elementaryFunctions/isvector/zisvectora.c new file mode 100644 index 00000000..0ed64a63 --- /dev/null +++ b/src/c/elementaryFunctions/isvector/zisvectora.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "doubleComplex.h" +#include "isvector.h" +#include "types.h" + +char zisvectora(doubleComplex *inp, int row, int col) +{ + if(row ==1 || col==1) + return 'T'; + return 'F'; +} diff --git a/src/c/elementaryFunctions/isvector/zisvectors.c b/src/c/elementaryFunctions/isvector/zisvectors.c new file mode 100644 index 00000000..bc9e5ce6 --- /dev/null +++ b/src/c/elementaryFunctions/isvector/zisvectors.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "isvector.h" +#include "types.h" +#include "doubleComplex.h" + +char zisvectors(doubleComplex inp) +{ + char out='F'; + + return out; +} diff --git a/src/c/elementaryFunctions/linspace/dlinspacea.c b/src/c/elementaryFunctions/linspace/dlinspacea.c new file mode 100644 index 00000000..e23db2f3 --- /dev/null +++ b/src/c/elementaryFunctions/linspace/dlinspacea.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include <stdlib.h> +#include "linspace.h" + +void dlinspacea(double *low_limit,int _row,double *up_limit,double range_num,double *out) +{ + int i,j,k; + double temp; + double *step_iterate; /* for each row the spacing between two values is different.*/ + step_iterate = (double*) malloc((double)_row*sizeof(double)); + for(i=0;i<_row;i++) + { + + step_iterate[i] = (up_limit[i]-low_limit[i])/(range_num-1); + + } + for(j=0;j < _row;j++) + { + out[j] = low_limit[j]; /* For every row first element is the first value of low_limit array*/ + temp = low_limit[j]; + for(k=1;k < (double)range_num;k++ ) + { + out[(_row*k)+j] = temp + step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/ + temp = out[(_row*k)+j]; + if(k == (double)range_num-1 ) + { + out[(_row*k)+j] = (double)up_limit[j]; /* Last value of output is equal to first value of up_limit array*/ + } + + } + + + } + + + + +} + diff --git a/src/c/elementaryFunctions/linspace/dlinspaces.c b/src/c/elementaryFunctions/linspace/dlinspaces.c new file mode 100644 index 00000000..9ac80271 --- /dev/null +++ b/src/c/elementaryFunctions/linspace/dlinspaces.c @@ -0,0 +1,33 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "linspace.h" +void dlinspaces(double low_limit,double up_limit,double range_num,double *out) +{ + int j; + double temp = low_limit; + float step_iterate = (up_limit-low_limit)/(range_num-1); + out[0] = low_limit; /*First value of output is equal to low_limit value*/ + for(j=1; j<(double)range_num; j++) + { + out[j] = temp + step_iterate; + temp = out[j]; + if(j == (double)range_num-1 ) + { + out[j] = (double)up_limit; /* Last value of output is equal to up_limit value*/ + } + } + + + +} + diff --git a/src/c/elementaryFunctions/linspace/slinspacea.c b/src/c/elementaryFunctions/linspace/slinspacea.c new file mode 100644 index 00000000..38af3942 --- /dev/null +++ b/src/c/elementaryFunctions/linspace/slinspacea.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include <stdlib.h> +#include "linspace.h" + +void slinspacea(float *low_limit,int _row,float *up_limit,float range_num,float *out) +{ + int i,j,k; + float temp; + float *step_iterate; /* for each row the spacing between two values is different.*/ + step_iterate = (float*) malloc((float)_row*sizeof(float)); + for(i=0;i<_row;i++) + { + + step_iterate[i] = (up_limit[i]-low_limit[i])/(range_num-1); + + } + for(j=0;j < _row;j++) + { + out[j] = low_limit[j]; /* For every row first element is the first value of low_limit array*/ + temp = low_limit[j]; + for(k=1;k < (float)range_num;k++ ) + { + out[(_row*k)+j] = temp + step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/ + temp = out[(_row*k)+j]; + if(k == (float)range_num-1 ) + { + out[(_row*k)+j] = (float)up_limit[j]; /* Last value of output is equal to first value of up_limit array*/ + } + + } + + + } + + + + +} + diff --git a/src/c/elementaryFunctions/linspace/slinspaces.c b/src/c/elementaryFunctions/linspace/slinspaces.c new file mode 100644 index 00000000..2404f4de --- /dev/null +++ b/src/c/elementaryFunctions/linspace/slinspaces.c @@ -0,0 +1,33 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "linspace.h" +void slinspaces(float low_limit,float up_limit,float range_num,float *out) +{ + int j; + float temp = low_limit; + float step_iterate = (up_limit-low_limit)/(range_num-1); + out[0] = low_limit; /*First value of output is equal to low_limit value*/ + for(j=1; j<(float)range_num; j++) + { + out[j] = temp + step_iterate; + temp = out[j]; + if(j == (float)range_num-1 ) + { + out[j] = (float)up_limit; /* Last value of output is equal to up_limit value*/ + } + } + + + +} + diff --git a/src/c/elementaryFunctions/log2/dlog2a.c b/src/c/elementaryFunctions/log2/dlog2a.c new file mode 100644 index 00000000..79047dec --- /dev/null +++ b/src/c/elementaryFunctions/log2/dlog2a.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 "log2.h" + +void dlog2a(double* inp,int size, double* out) +{ + for(int i = 0; i<size; i++) + out[i] = dlog2s(inp[i]); +} diff --git a/src/c/elementaryFunctions/log2/dlog2s.c b/src/c/elementaryFunctions/log2/dlog2s.c new file mode 100644 index 00000000..9d2f8ab2 --- /dev/null +++ b/src/c/elementaryFunctions/log2/dlog2s.c @@ -0,0 +1,21 @@ +/* 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 <math.h> +#include "log2.h" + +double dlog2s(double inp) +{ + return log(inp)/log(2); +} + + diff --git a/src/c/elementaryFunctions/log2/slog2a.c b/src/c/elementaryFunctions/log2/slog2a.c new file mode 100644 index 00000000..04723072 --- /dev/null +++ b/src/c/elementaryFunctions/log2/slog2a.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 "log2.h" + +void slog2a(float* inp,int size, float* out) +{ + for(int i = 0; i<size; i++) + out[i] = slog2s(inp[i]); +} diff --git a/src/c/elementaryFunctions/log2/slog2s.c b/src/c/elementaryFunctions/log2/slog2s.c new file mode 100644 index 00000000..d162248a --- /dev/null +++ b/src/c/elementaryFunctions/log2/slog2s.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 "log2.h" + +float slog2s(float inp) +{ + return log(inp)/log(2); +} diff --git a/src/c/elementaryFunctions/log2/zlog2a.c b/src/c/elementaryFunctions/log2/zlog2a.c new file mode 100644 index 00000000..4cd0b33f --- /dev/null +++ b/src/c/elementaryFunctions/log2/zlog2a.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 "log2.h" + +void zlog2a(doubleComplex* inp,int size, doubleComplex* out) +{ + for(int i = 0; i<size; i++) + out[i] = zlog2s(inp[i]); +} diff --git a/src/c/elementaryFunctions/log2/zlog2s.c b/src/c/elementaryFunctions/log2/zlog2s.c new file mode 100644 index 00000000..8447c9e3 --- /dev/null +++ b/src/c/elementaryFunctions/log2/zlog2s.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 <math.h> +#include "log2.h" +#include "log.h" + +doubleComplex zlog2s(doubleComplex inp) +{ + return zlogs(inp)/zlogs(2); +} + + diff --git a/src/c/elementaryFunctions/logspace/dlogspacea.c b/src/c/elementaryFunctions/logspace/dlogspacea.c new file mode 100644 index 00000000..62802f77 --- /dev/null +++ b/src/c/elementaryFunctions/logspace/dlogspacea.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include <math.h> +#include <stdlib.h> +#include "logspace.h" + +void dlogspacea(double *low_limit,int _row,double *up_limit,double range_num,double *out) +{ + int i,j,k; + double temp; + double *step_iterate; /* for each row the spacing between two values is different.*/ + step_iterate = (double*) malloc((double)_row*sizeof(double)); + for(i=0;i<_row;i++) + { + step_iterate[i] = pow(10,((up_limit[i]-low_limit[i])/(range_num-1))); + + + } + for(j=0;j < _row;j++) + { + out[j] = pow(10,low_limit[j]); /* For every row first element is equal to 10 raise to the first value of low_limit array*/ + temp = out[j]; + for(k=1;k < (double)range_num;k++ ) + { + out[(_row*k)+j] = temp*step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/ + temp = out[(_row*k)+j]; + if(k == (double)range_num-1 ) + { + out[(_row*k)+j] = pow(10,((double)up_limit[j])); /* For every row Last value of output is equal to 10 raise to first value of up_limit array*/ + } + + } + + + } + + + + +} + diff --git a/src/c/elementaryFunctions/logspace/dlogspaces.c b/src/c/elementaryFunctions/logspace/dlogspaces.c new file mode 100644 index 00000000..df9c94f0 --- /dev/null +++ b/src/c/elementaryFunctions/logspace/dlogspaces.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "logspace.h" +#include<math.h> +void dlogspaces(double low_limit,double up_limit,double range_num,double *out) +{ + int j; + double temp = pow(10,low_limit); + double step_iterate = pow(10,((up_limit-low_limit)/(range_num-1))); + out[0] = pow(10,low_limit); /*First value of output is equal to low_limit value*/ + for(j=1; j<(double)range_num; j++) + { + out[j] = temp*step_iterate; + temp = out[j]; + if(j == (double)range_num-1 ) + { + out[j] = pow(10,((double)up_limit)); /* Last value of output is equal to up_limit value*/ + } + } + + + +} + diff --git a/src/c/elementaryFunctions/nancumsum/dnancumsuma.c b/src/c/elementaryFunctions/nancumsum/dnancumsuma.c new file mode 100644 index 00000000..135ab4bb --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/dnancumsuma.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void dnancumsuma(double *in, int size, double* out) +{ + double fin=0; + + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(in[i]))) + { + fin= dadds(fin, in[i]); + + } + out[i]= fin; + + } + + +} diff --git a/src/c/elementaryFunctions/nancumsum/dnancumsumcola.c b/src/c/elementaryFunctions/nancumsum/dnancumsumcola.c new file mode 100644 index 00000000..a49b394d --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/dnancumsumcola.c @@ -0,0 +1,43 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void dnancumsumcola(double *in, int row, int col, double* out) +{ + double fin=0; + +for(int i=0; i< row; i++) + { + + for(int j= 0; j< col; j ++) + { + if(!(isnan(in[i+j*row]))) + + { + + fin = dadds(fin, in[i+j*row]); + + + + } + out[i+j*row]= fin; + + } + fin=0; + + } +} diff --git a/src/c/elementaryFunctions/nancumsum/dnancumsumrowa.c b/src/c/elementaryFunctions/nancumsum/dnancumsumrowa.c new file mode 100644 index 00000000..45ce1ca2 --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/dnancumsumrowa.c @@ -0,0 +1,45 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void dnancumsumrowa(double *in, int row, int col, double* out) +{ + + double fin=0; + + +for(int i=0; i< col; i++) + { + + for(int j= 0; j< row; j ++) + { + if(!(isnan(in[j+i*row]))) + + { + + fin = dadds(fin, in[j+i*row]); + + + + } + out[j+i*row]= fin; + + } + fin=0; + + } +} diff --git a/src/c/elementaryFunctions/nancumsum/snancumsuma.c b/src/c/elementaryFunctions/nancumsum/snancumsuma.c new file mode 100644 index 00000000..56d16335 --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/snancumsuma.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void snancumsuma(float *in, int size, float* out) +{ + float fin=0; + + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(in[i]))) + { + fin= sadds(fin, in[i]); + + } + out[i]= fin; + + } + + +} diff --git a/src/c/elementaryFunctions/nancumsum/snancumsumcola.c b/src/c/elementaryFunctions/nancumsum/snancumsumcola.c new file mode 100644 index 00000000..3b96ef01 --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/snancumsumcola.c @@ -0,0 +1,43 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void snancumsumcola(float *in, int row, int col, float* out) +{ + float fin=0; + +for(int i=0; i< row; i++) + { + + for(int j= 0; j< col; j ++) + { + if(!(isnan(in[i+j*row]))) + + { + + fin = sadds(fin, in[i+j*row]); + + + + } + out[i+j*row]= fin; + + } + fin=0; + + } +} diff --git a/src/c/elementaryFunctions/nancumsum/snancumsumrowa.c b/src/c/elementaryFunctions/nancumsum/snancumsumrowa.c new file mode 100644 index 00000000..7eef3869 --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/snancumsumrowa.c @@ -0,0 +1,44 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +void snancumsumrowa(float *in, int row, int col, float* out) +{ + float fin=0; + + +for(int i=0; i< col; i++) + { + + for(int j= 0; j< row; j ++) + { + if(!(isnan(in[j+i*row]))) + + { + + fin = sadds(fin, in[j+i*row]); + + + + } + out[j+i*row]= fin; + + } + fin=0; + + } +} diff --git a/src/c/elementaryFunctions/nancumsum/znancumsuma.c b/src/c/elementaryFunctions/nancumsum/znancumsuma.c new file mode 100644 index 00000000..fd0a1e3e --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/znancumsuma.c @@ -0,0 +1,39 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +#include "addition.h" + +void znancumsuma(doubleComplex *in, int size, doubleComplex* out) +{ + doubleComplex fin=0; + + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(zreals(in[i]))) && !(isnan(zimags(in[i]))) ) + { + fin= zadds(fin, in[i]); + + } + out[i]= fin; + + } + + +} diff --git a/src/c/elementaryFunctions/nancumsum/znancumsumcola.c b/src/c/elementaryFunctions/nancumsum/znancumsumcola.c new file mode 100644 index 00000000..c1ca16b6 --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/znancumsumcola.c @@ -0,0 +1,44 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" +#include "doubleComplex.h" + +void znancumsumcola(doubleComplex* in, int row, int col, doubleComplex* out) +{ + doubleComplex fin= 0; + +for(int i=0; i< row; i++) + { + + for(int j= 0; j< col; j ++) + { + if( !(isnan(zreals(in[i+j*row]))) && !(isnan(zimags(in[i+j*row]))) ) + + { + + fin = zadds(fin, in[i+j*row]); + + + + } + out[i+j*row]= fin; + + } + fin= 0; + + } +} diff --git a/src/c/elementaryFunctions/nancumsum/znancumsumrowa.c b/src/c/elementaryFunctions/nancumsum/znancumsumrowa.c new file mode 100644 index 00000000..be04a4a7 --- /dev/null +++ b/src/c/elementaryFunctions/nancumsum/znancumsumrowa.c @@ -0,0 +1,45 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nancumsum.h" +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" +#include "addition.h" + +void znancumsumrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex fin=0; + + +for(int i=0; i< col; i++) + { + + for(int j= 0; j< row; j ++) + { + if(!(isnan(zreals(in[j+i*row]))) && !(isnan(zimags(in[j+i*row]))) ) + + { + + fin = zadds(fin, in[j+i*row]); + + + + } + out[j+i*row]= fin; + + } + fin=0; + + } +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmax1a.c b/src/c/elementaryFunctions/nanmax/dnanmax1a.c new file mode 100644 index 00000000..a0e7eede --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmax1a.c @@ -0,0 +1,58 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +double dnanmax1a(double* in, int row, int col, double* out) +{ +double high; +int ival=0; +for(int i=0; i<row*col; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< row*col; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + ival=i; + + } + + + } + + + } + +out[0]= ival%row +1; +out[1]= ival/row +1; + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmax2a.c b/src/c/elementaryFunctions/nanmax/dnanmax2a.c new file mode 100644 index 00000000..82ddda6b --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmax2a.c @@ -0,0 +1,53 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +double dnanmax2a(double* in, int size, double* out) +{ +double high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + *out= i+1; + + } + + + } + + + } + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxa.c b/src/c/elementaryFunctions/nanmax/dnanmaxa.c new file mode 100644 index 00000000..4ff4a1a8 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxa.c @@ -0,0 +1,53 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +double dnanmaxa(double* in, int size) +{ +double high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + + } + + + } + + + } + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxcol1a.c b/src/c/elementaryFunctions/nanmax/dnanmaxcol1a.c new file mode 100644 index 00000000..1198dcea --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxcol1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxcol1a(double *in, int row, int col, double* out1) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out1[i]= dnanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxcola.c b/src/c/elementaryFunctions/nanmax/dnanmaxcola.c new file mode 100644 index 00000000..388337e7 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxcola(double *in, int row, int col, double* out1, double* out2) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out1[i]= dnanmax2a( inter, col, &out2[i]); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxrow1a.c b/src/c/elementaryFunctions/nanmax/dnanmaxrow1a.c new file mode 100644 index 00000000..c4a7a4d1 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxrow1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxrow1a(double *in, int row, int col, double* out1) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out1[i]= dnanmaxa( inter, row); + + } + + + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c b/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c new file mode 100644 index 00000000..47d4d386 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxrowa(double *in, int row, int col, double* out1, double* out2) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out1[i]= dnanmax2a( inter, row, &out2[i]); + + } + + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmax1a.c b/src/c/elementaryFunctions/nanmax/snanmax1a.c new file mode 100644 index 00000000..7420c3a3 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmax1a.c @@ -0,0 +1,58 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +float snanmax1a(float* in, int row, int col, float* out) +{ +float high; +int ival=0; +for(int i=0; i<row*col; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< row*col; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + ival=i; + + } + + + } + + + } + +out[0]= ival%row +1; +out[1]= ival/row +1; + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmax2a.c b/src/c/elementaryFunctions/nanmax/snanmax2a.c new file mode 100644 index 00000000..59c282d8 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmax2a.c @@ -0,0 +1,53 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +float snanmax2a(float* in, int size, float* out) +{ +float high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + *out= i+1; + + } + + + } + + + } + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxa.c b/src/c/elementaryFunctions/nanmax/snanmaxa.c new file mode 100644 index 00000000..1eab1ac1 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxa.c @@ -0,0 +1,53 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +float snanmaxa(float* in, int size) +{ +float high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + + } + + + } + + + } + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxcol1a.c b/src/c/elementaryFunctions/nanmax/snanmaxcol1a.c new file mode 100644 index 00000000..a737033b --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxcol1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxcol1a(float *in, int row, int col, float* out1) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out1[i]= snanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxcola.c b/src/c/elementaryFunctions/nanmax/snanmaxcola.c new file mode 100644 index 00000000..2703319a --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxcola(float *in, int row, int col, float* out1, float* out2) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out1[i]= snanmax2a( inter, col, &out2[i]); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxrow1a.c b/src/c/elementaryFunctions/nanmax/snanmaxrow1a.c new file mode 100644 index 00000000..09d062c7 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxrow1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxrow1a(float *in, int row, int col, float* out1) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out1[i]= snanmaxa( inter, row); + + } + + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxrowa.c b/src/c/elementaryFunctions/nanmax/snanmaxrowa.c new file mode 100644 index 00000000..c438ae0f --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxrowa(float *in, int row, int col, float* out1, float* out2) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out1[i]= snanmax2a( inter, row, &out2[i]); + + } + + + +} diff --git a/src/c/elementaryFunctions/nanmean/cnanmeana.c b/src/c/elementaryFunctions/nanmean/cnanmeana.c new file mode 100644 index 00000000..eaca1e79 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/cnanmeana.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + + +floatComplex cnanmeana(floatComplex* in, int size) +{ + floatComplex sum = 0; + double count = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(zreals(in[i]))) && !(isnan(zimags(in[i])))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/cnanmeancola.c b/src/c/elementaryFunctions/nanmean/cnanmeancola.c new file mode 100644 index 00000000..7f643a65 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/cnanmeancola.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void cnanmeancola(floatComplex *in, int row, int col, floatComplex* out) +{ + floatComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= cnanmeana( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/cnanmeanrowa.c b/src/c/elementaryFunctions/nanmean/cnanmeanrowa.c new file mode 100644 index 00000000..05aa7e93 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/cnanmeanrowa.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void cnanmeanrowa(floatComplex *in, int row, int col, floatComplex* out) +{ + floatComplex inter[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= cnanmeana( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/dnanmeana.c b/src/c/elementaryFunctions/nanmean/dnanmeana.c new file mode 100644 index 00000000..40f9ac6f --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/dnanmeana.c @@ -0,0 +1,33 @@ +/* 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 "nanmean.h" + +double dnanmeana(double* in, int size) +{ + double count = 0, sum = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(in[i]))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/dnanmeancola.c b/src/c/elementaryFunctions/nanmean/dnanmeancola.c new file mode 100644 index 00000000..81ed5338 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/dnanmeancola.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void dnanmeancola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dnanmeana( inter, col); + + } + + +} + diff --git a/src/c/elementaryFunctions/nanmean/dnanmeanrowa.c b/src/c/elementaryFunctions/nanmean/dnanmeanrowa.c new file mode 100644 index 00000000..1ac02f5f --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/dnanmeanrowa.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void dnanmeanrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnanmeana( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/snanmeana.c b/src/c/elementaryFunctions/nanmean/snanmeana.c new file mode 100644 index 00000000..aecf6984 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/snanmeana.c @@ -0,0 +1,33 @@ +/* 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 "nanmean.h" + +float snanmeana(float* in, int size) +{ + float count = 0, sum = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(in[i]))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/snanmeancola.c b/src/c/elementaryFunctions/nanmean/snanmeancola.c new file mode 100644 index 00000000..68df77b8 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/snanmeancola.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void snanmeancola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= snanmeana( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/snanmeanrowa.c b/src/c/elementaryFunctions/nanmean/snanmeanrowa.c new file mode 100644 index 00000000..1664aa4e --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/snanmeanrowa.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" + +void snanmeanrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= snanmeana( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/znanmeana.c b/src/c/elementaryFunctions/nanmean/znanmeana.c new file mode 100644 index 00000000..366657a5 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/znanmeana.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + + +doubleComplex znanmeana(doubleComplex* in, int size) +{ + doubleComplex sum = 0; + double count = 0; + + for(int i = 0; i<size; i++) + { + if(!(isnan(zreals(in[i]))) && !(isnan(zimags(in[i])))) + { + count++; + sum += in[i]; + } + } + + return sum/count; +} + diff --git a/src/c/elementaryFunctions/nanmean/znanmeancola.c b/src/c/elementaryFunctions/nanmean/znanmeancola.c new file mode 100644 index 00000000..28743e3f --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/znanmeancola.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void znanmeancola(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= znanmeana( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmean/znanmeanrowa.c b/src/c/elementaryFunctions/nanmean/znanmeanrowa.c new file mode 100644 index 00000000..8d80c779 --- /dev/null +++ b/src/c/elementaryFunctions/nanmean/znanmeanrowa.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmean.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void znanmeanrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= znanmeana( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmin/dnanmina.c b/src/c/elementaryFunctions/nanmin/dnanmina.c new file mode 100644 index 00000000..f2bce003 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmina.c @@ -0,0 +1,53 @@ +/* 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 "nanmin.h" + +double dnanmina(double* in, int row, int col, double* pos) +{ + double low = 0; + int ival = 0, nanflag = 1; + + for(int i = 0; i<row*col; i++) + { + if(!(isnan(in[i]))) + { + low = in[i]; + nanflag = 0; + break; + } + } + + for(int i = 0; i<row*col; i++) + { + if(!(isnan(in[i]))) + { + if(in[i]<low) + { + low = in[i]; + ival = i; + } + } + } + + pos[0] = ival % row + 1; + pos[1] = ival / row + 1; + + if (nanflag == 1) + return 0.0/0.0; + + return low; +} + diff --git a/src/c/elementaryFunctions/nanmin/dnanmincola.c b/src/c/elementaryFunctions/nanmin/dnanmincola.c new file mode 100644 index 00000000..35b94c08 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmincola.c @@ -0,0 +1,33 @@ +/* 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 "nanmin.h" + +void dnanmincola(double *in, int row, int col, double *out, double *p) +{ + double inter[col]; + double position[col]; + + for(int i=0; i < row; i++) + { + for(int j=0; j < col; i++) + { + inter[j]= in[i+ (j*row)]; + } + + out[i]= dnanmina(inter, 1, col, position); + + } +} diff --git a/src/c/elementaryFunctions/nanmin/dnanmincolnpa.c b/src/c/elementaryFunctions/nanmin/dnanmincolnpa.c new file mode 100644 index 00000000..3d1623c2 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmincolnpa.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmin.h" + +void dnanmincolnpa(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dnanminnpa( inter, 1, col); + + } + + +} + diff --git a/src/c/elementaryFunctions/nanmin/dnanminnpa.c b/src/c/elementaryFunctions/nanmin/dnanminnpa.c new file mode 100644 index 00000000..6456ebe9 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanminnpa.c @@ -0,0 +1,51 @@ +/* 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 "nanmin.h" + +double dnanminnpa(double* in, int row, int col) +{ + double low = 0; + int nanflag = 1; + + + for(int i = 0; i<row*col; i++) + { + if(!(isnan(in[i]))) + { + low = in[i]; + nanflag = 0; + break; + } + } + + for(int i = 0; i<row*col; i++) + { + if(!(isnan(in[i]))) + { + if(in[i]<low) + { + low = in[i]; + + } + } + } + + if (nanflag == 1) + return 0.0/0.0; + + return low; +} + diff --git a/src/c/elementaryFunctions/nanmin/dnanminnps.c b/src/c/elementaryFunctions/nanmin/dnanminnps.c new file mode 100644 index 00000000..9a33d2fe --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanminnps.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 "nanmin.h" + +double dnanminnps(double in) +{ + if(isnan(in)) + return 0; + + return in; +} + diff --git a/src/c/elementaryFunctions/nanmin/dnanminrowa.c b/src/c/elementaryFunctions/nanmin/dnanminrowa.c new file mode 100644 index 00000000..0909fc2c --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanminrowa.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmin.h" + +void dnanminrowa(double *in, int row, int col, double *out, double *p) +{ + double inter[row], *position; + + + + for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnanmina( inter, row, 1, position); + } + //p = position; + +} diff --git a/src/c/elementaryFunctions/nanmin/dnanminrownpa.c b/src/c/elementaryFunctions/nanmin/dnanminrownpa.c new file mode 100644 index 00000000..fc46a0a4 --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanminrownpa.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmin.h" + +void dnanminrownpa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnanminnpa( inter, row, 1); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmin/dnanmins.c b/src/c/elementaryFunctions/nanmin/dnanmins.c new file mode 100644 index 00000000..86764a2a --- /dev/null +++ b/src/c/elementaryFunctions/nanmin/dnanmins.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmin.h" + +double dnanmins(double in, double* pos) +{ + pos[0] = 1; + pos[1] = 1; + + if(isnan(in)) + { + pos[0] = 0; + pos[1] = 0; + return 0; + } + + return in; +} + diff --git a/src/c/elementaryFunctions/nansum/dnansuma.c b/src/c/elementaryFunctions/nansum/dnansuma.c new file mode 100644 index 00000000..adc4a02b --- /dev/null +++ b/src/c/elementaryFunctions/nansum/dnansuma.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +double dnansuma(double *in, int size) +{ + double fin=0; + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(in[i]))) + { + fin= dadds(fin, in[i]); + + } + + + } + + return fin; +} diff --git a/src/c/elementaryFunctions/nansum/dnansumcola.c b/src/c/elementaryFunctions/nansum/dnansumcola.c new file mode 100644 index 00000000..eb406387 --- /dev/null +++ b/src/c/elementaryFunctions/nansum/dnansumcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" + +void dnansumcola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dnansuma( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nansum/dnansumrowa.c b/src/c/elementaryFunctions/nansum/dnansumrowa.c new file mode 100644 index 00000000..e8a7cfb3 --- /dev/null +++ b/src/c/elementaryFunctions/nansum/dnansumrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" + +void dnansumrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnansuma( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nansum/snansuma.c b/src/c/elementaryFunctions/nansum/snansuma.c new file mode 100644 index 00000000..8c1cebbb --- /dev/null +++ b/src/c/elementaryFunctions/nansum/snansuma.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" +#include "addition.h" + +float snansuma(float *in, int size) +{ + float fin=0; + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(in[i]))) + { + fin= sadds(fin, in[i]); + + } + + + } + + return fin; +} diff --git a/src/c/elementaryFunctions/nansum/snansumcola.c b/src/c/elementaryFunctions/nansum/snansumcola.c new file mode 100644 index 00000000..d83e6f0d --- /dev/null +++ b/src/c/elementaryFunctions/nansum/snansumcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" + +void snansumcola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= snansuma( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nansum/snansumrowa.c b/src/c/elementaryFunctions/nansum/snansumrowa.c new file mode 100644 index 00000000..5442694d --- /dev/null +++ b/src/c/elementaryFunctions/nansum/snansumrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" + +void snansumrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= snansuma( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nansum/znansuma.c b/src/c/elementaryFunctions/nansum/znansuma.c new file mode 100644 index 00000000..cb839f02 --- /dev/null +++ b/src/c/elementaryFunctions/nansum/znansuma.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "doubleComplex.h" +#include "addition.h" + +doubleComplex znansuma(doubleComplex *in, int size) +{ + doubleComplex fin=0; + + + for (int i = 0; i < size; ++i) + + { + if(!(isnan(zreals(in[i]))) && !(isnan(zimags(in[i])))) + { + fin= zadds(fin, in[i]); + + } + + + } + + return fin; +} diff --git a/src/c/elementaryFunctions/nansum/znansumcola.c b/src/c/elementaryFunctions/nansum/znansumcola.c new file mode 100644 index 00000000..2543c49e --- /dev/null +++ b/src/c/elementaryFunctions/nansum/znansumcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znansumcola(doubleComplex *in, int row, int col, doubleComplex * out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= znansuma( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nansum/znansumrowa.c b/src/c/elementaryFunctions/nansum/znansumrowa.c new file mode 100644 index 00000000..39535c9f --- /dev/null +++ b/src/c/elementaryFunctions/nansum/znansumrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nansum.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znansumrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= znansuma( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nextpow2/dnextpow2a.c b/src/c/elementaryFunctions/nextpow2/dnextpow2a.c new file mode 100644 index 00000000..46f7eb80 --- /dev/null +++ b/src/c/elementaryFunctions/nextpow2/dnextpow2a.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Ukasha Noor + Email: toolbox@scilab.in +*/ + +#include "nextpow2.h" +#include <math.h> + +void dnextpow2a(double *in,int size,double *out) +{ + int i,j,s; + double k; + i=2; + for(s=0;s<size;s++) + { + j=-1; + do{ + j++; + k=pow(i,j); + }while(in[s]>k); + out[s]=j; + } +} diff --git a/src/c/elementaryFunctions/nthroot/dnthroot1a.c b/src/c/elementaryFunctions/nthroot/dnthroot1a.c new file mode 100644 index 00000000..7c65169a --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/dnthroot1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" +void dnthroot1a(double* inp1, int irows, int icols, double inp2, double* out) +{ + + + for(int i=0; i< irows*icols; i++) + { + out[i]= dnthroots(inp1[i], inp2); + + } + +} diff --git a/src/c/elementaryFunctions/nthroot/dnthroota.c b/src/c/elementaryFunctions/nthroot/dnthroota.c new file mode 100644 index 00000000..6f33b21e --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/dnthroota.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" +void dnthroota(double* inp1, int irows, int icols, double* inp2, int crows, int ccols, double* out) +{ + + if(irows==crows && icols==ccols) + { + for(int i=0; i< irows*icols; i++) + { + + out[i]= dnthroots(inp1[i], inp2[i]); + + } + + + + } + + + +} diff --git a/src/c/elementaryFunctions/nthroot/dnthroots.c b/src/c/elementaryFunctions/nthroot/dnthroots.c new file mode 100644 index 00000000..99beaa13 --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/dnthroots.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" + +double dnthroots(double inp1, double inp2) +{ + + return pow(inp1, (1/inp2)); +} diff --git a/src/c/elementaryFunctions/nthroot/snthroot1a.c b/src/c/elementaryFunctions/nthroot/snthroot1a.c new file mode 100644 index 00000000..60fae3d6 --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/snthroot1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" +void snthroot1a(float* inp1, int irows, int icols, float inp2, double* out) +{ + + + for(int i=0; i< irows*icols; i++) + { + out[i]= dnthroots(inp1[i], inp2); + + } + +} diff --git a/src/c/elementaryFunctions/nthroot/snthroota.c b/src/c/elementaryFunctions/nthroot/snthroota.c new file mode 100644 index 00000000..4a04c1d6 --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/snthroota.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" +void snthroota(float* inp1, int irows, int icols, float* inp2, int crows, int ccols, double* out) +{ + + if(irows==crows && icols==ccols) + { + for(int i=0; i< irows*icols; i++) + { + + out[i]= dnthroots(inp1[i], inp2[i]); + + } + + + + } + + + +} diff --git a/src/c/elementaryFunctions/nthroot/snthroots.c b/src/c/elementaryFunctions/nthroot/snthroots.c new file mode 100644 index 00000000..ad83dacc --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/snthroots.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" + +double snthroots(float inp1, float inp2) +{ + + return pow(inp1, (1/inp2)); +} diff --git a/src/c/elementaryFunctions/nthroot/u16nthroot1a.c b/src/c/elementaryFunctions/nthroot/u16nthroot1a.c new file mode 100644 index 00000000..4cb654c9 --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/u16nthroot1a.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" +#include "uint16.h" +void snthroot1a(uint16* inp1, int irows, int icols, uint16 inp2, double* out) +{ + + + for(int i=0; i< irows*icols; i++) + { + out[i]= dnthroots(inp1[i], inp2); + + } + +} diff --git a/src/c/elementaryFunctions/nthroot/u16nthroota.c b/src/c/elementaryFunctions/nthroot/u16nthroota.c new file mode 100644 index 00000000..5d178a17 --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/u16nthroota.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" +#include "uint16.h" +void dnthroota(uint16* inp1, int irows, int icols, uint16* inp2, int crows, int ccols, double* out) +{ + + if(irows==crows && icols==ccols) + { + for(int i=0; i< irows*icols; i++) + { + + out[i]= dnthroots(inp1[i], inp2[i]); + + } + + + + } + + + +} diff --git a/src/c/elementaryFunctions/nthroot/u16nthroots.c b/src/c/elementaryFunctions/nthroot/u16nthroots.c new file mode 100644 index 00000000..618d29f6 --- /dev/null +++ b/src/c/elementaryFunctions/nthroot/u16nthroots.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nthroot.h" +#include "types.h" +#include "uint16.h" + +double dnthroots(uint16 inp1, uint16 inp2) +{ + + return pow(inp1, (1/inp2)); +} diff --git a/src/c/elementaryFunctions/pmodulo/dpmoduloa.c b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c new file mode 100644 index 00000000..0817987a --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" +void dpmoduloa(double* inp1, int size, double* inp2, double* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= dpmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/dpmodulos.c b/src/c/elementaryFunctions/pmodulo/dpmodulos.c new file mode 100644 index 00000000..61441777 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/dpmodulos.c @@ -0,0 +1,54 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" + +double dpmodulos(double inp1, double inp2) +{ + if( inp1>0 && inp2>0) + + { + return fmod(inp1,inp2); + + } + + + if( inp1>0 && inp2<0) + + { + + return fmod(inp1,inp2); + + } + + + if(inp1<0 && inp2>0) + + { + + return ((fmod(inp1,inp2))+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((fmod(inp1,inp2))-(inp2)); + + } + +} diff --git a/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c new file mode 100644 index 00000000..bb76d7ff --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "int16.h" +#include "pmodulo.h" +#include "types.h" +void i16pmoduloa(int16* inp1, int size, int16* inp2, int16* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= i16pmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/i16pmodulos.c b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c new file mode 100644 index 00000000..f7f86c5b --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c @@ -0,0 +1,55 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "int16.h" +#include "pmodulo.h" +#include "types.h" + +int16 i16pmodulos(int16 inp1, int16 inp2) +{ + if( inp1>0 && inp2>0) + + { + return inp1%inp2; + + } + + + if( inp1>0 && inp2<0) + + { + + return inp1%inp2; + + } + + + if(inp1<0 && inp2>0) + + { + + return ((inp1%inp2)+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((inp1%inp2)-(inp2)); + + } + +} diff --git a/src/c/elementaryFunctions/pmodulo/spmoduloa.c b/src/c/elementaryFunctions/pmodulo/spmoduloa.c new file mode 100644 index 00000000..87b2a2fb --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/spmoduloa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" +void spmoduloa(float* inp1, int size, float* inp2, float* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= spmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/spmodulos.c b/src/c/elementaryFunctions/pmodulo/spmodulos.c new file mode 100644 index 00000000..9ab6bc49 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/spmodulos.c @@ -0,0 +1,54 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" + +float spmodulos(float inp1, float inp2) +{ + if( inp1>0 && inp2>0) + + { + return fmod(inp1,inp2); + + } + + + if( inp1>0 && inp2<0) + + { + + return fmod(inp1,inp2); + + } + + + if(inp1<0 && inp2>0) + + { + + return ((fmod(inp1,inp2))+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((fmod(inp1,inp2))-(inp2)); + + } + +} diff --git a/src/c/elementaryFunctions/pow/dpows.c b/src/c/elementaryFunctions/pow/dpows.c index c291bf71..cce89196 100644 --- a/src/c/elementaryFunctions/pow/dpows.c +++ b/src/c/elementaryFunctions/pow/dpows.c @@ -13,6 +13,7 @@ #include <math.h> #include "pow.h" -double dpows(double x, double p) { +double dpows(double x, double p) +{ return pow(x, p); } diff --git a/src/c/elementaryFunctions/pow/i16powa.c b/src/c/elementaryFunctions/pow/i16powa.c new file mode 100644 index 00000000..eecce15f --- /dev/null +++ b/src/c/elementaryFunctions/pow/i16powa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pow.h" + +void i16powa(int16* x, int size, int16* power, int16 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i16pows(x[i], power[i]); + } +} diff --git a/src/c/elementaryFunctions/pow/i16pows.c b/src/c/elementaryFunctions/pow/i16pows.c new file mode 100644 index 00000000..63f92d92 --- /dev/null +++ b/src/c/elementaryFunctions/pow/i16pows.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "pow.h" + +int16 i16pows(int16 x, int16 p) { + return pow(x, p); +} diff --git a/src/c/elementaryFunctions/pow/i8powa.c b/src/c/elementaryFunctions/pow/i8powa.c new file mode 100644 index 00000000..bf948223 --- /dev/null +++ b/src/c/elementaryFunctions/pow/i8powa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pow.h" + +void i8powa(int8* x, int size, int8* power, int8 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i8pows(x[i], power[i]); + } +} diff --git a/src/c/elementaryFunctions/pow/i8pows.c b/src/c/elementaryFunctions/pow/i8pows.c new file mode 100644 index 00000000..125ef8c2 --- /dev/null +++ b/src/c/elementaryFunctions/pow/i8pows.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "pow.h" + +int8 i8pows(int8 x, int8 p) { + return pow(x, p); +} diff --git a/src/c/elementaryFunctions/pow/u16powa.c b/src/c/elementaryFunctions/pow/u16powa.c new file mode 100644 index 00000000..df34972d --- /dev/null +++ b/src/c/elementaryFunctions/pow/u16powa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pow.h" + +void u16powa(uint16* x, int size, uint16* power, uint16 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u16pows(x[i], power[i]); + } +} diff --git a/src/c/elementaryFunctions/pow/u16pows.c b/src/c/elementaryFunctions/pow/u16pows.c new file mode 100644 index 00000000..49dd654c --- /dev/null +++ b/src/c/elementaryFunctions/pow/u16pows.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "pow.h" + +uint16 u16pows(uint16 x, uint16 p) { + return pow(x, p); +} diff --git a/src/c/elementaryFunctions/pow/u8powa.c b/src/c/elementaryFunctions/pow/u8powa.c new file mode 100644 index 00000000..90bcc642 --- /dev/null +++ b/src/c/elementaryFunctions/pow/u8powa.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pow.h" + +void u8powa(uint8* x, int size, uint8* power, uint8 *out) { + /* + Computes Scilab x.^power + Computes power element by element + x and power must have same size + */ + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u8pows(x[i], power[i]); + } +} diff --git a/src/c/elementaryFunctions/pow/u8pows.c b/src/c/elementaryFunctions/pow/u8pows.c new file mode 100644 index 00000000..cfcd4c69 --- /dev/null +++ b/src/c/elementaryFunctions/pow/u8pows.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "pow.h" + +uint8 u8pows(uint8 x, uint8 p) +{ + return pow(x, p); +} diff --git a/src/c/elementaryFunctions/pow/zpows.c b/src/c/elementaryFunctions/pow/zpows.c index 1a7059b2..4fe771ab 100644 --- a/src/c/elementaryFunctions/pow/zpows.c +++ b/src/c/elementaryFunctions/pow/zpows.c @@ -14,7 +14,7 @@ #include "log.h" #include "exp.h" -doubleComplex zpows(doubleComplex z, doubleComplex power) { +doubleComplex zpows(doubleComplex z, doubleComplex power) { /*Cas z=0 */ if ( (zreals(z)==0) && (zimags(z)==0) ){ /* Cas 0^0 */ diff --git a/src/c/elementaryFunctions/radix_conversions/base2dec/dbase2decs.c b/src/c/elementaryFunctions/radix_conversions/base2dec/dbase2decs.c new file mode 100644 index 00000000..a92fc76f --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/base2dec/dbase2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/base2dec/gbase2decs.c b/src/c/elementaryFunctions/radix_conversions/base2dec/gbase2decs.c new file mode 100644 index 00000000..811a4116 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/base2dec/gbase2decs.c @@ -0,0 +1,166 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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 * (int)pow((double)base, size)); + size--; + } + return o; + } diff --git a/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c new file mode 100644 index 00000000..96fccc5f --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c new file mode 100644 index 00000000..ff363c37 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c new file mode 100644 index 00000000..8511df92 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c new file mode 100644 index 00000000..9aa3be9b --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c new file mode 100644 index 00000000..c923ffb0 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c new file mode 100644 index 00000000..abd3b894 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c new file mode 100644 index 00000000..b6b75d71 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c new file mode 100644 index 00000000..cb45a201 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c new file mode 100644 index 00000000..10461cad --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c b/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c new file mode 100644 index 00000000..0a0f5c40 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2basea.c b/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2basea.c new file mode 100644 index 00000000..4de34f00 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2basea.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2bases.c b/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2bases.c new file mode 100644 index 00000000..dae7bdcc --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2base/ddec2bases.c @@ -0,0 +1,71 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2basea.c b/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2basea.c new file mode 100644 index 00000000..dc4d8590 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2basea.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2bases.c b/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2bases.c new file mode 100644 index 00000000..a627c052 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2base/sdec2bases.c @@ -0,0 +1,45 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bina.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bina.c new file mode 100644 index 00000000..c69b7823 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bina.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bins.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bins.c new file mode 100644 index 00000000..f5db16c8 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/ddec2bins.c @@ -0,0 +1,50 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bina.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bina.c new file mode 100644 index 00000000..93d1fdda --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bina.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c new file mode 100644 index 00000000..5df0fe8d --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c @@ -0,0 +1,43 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bina.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bina.c new file mode 100644 index 00000000..90062f9c --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bina.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bins.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bins.c new file mode 100644 index 00000000..ea689857 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/i8dec2bins.c @@ -0,0 +1,43 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bina.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bina.c new file mode 100644 index 00000000..165485e0 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bina.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bins.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bins.c new file mode 100644 index 00000000..ea998897 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/u16dec2bins.c @@ -0,0 +1,43 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bina.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bina.c new file mode 100644 index 00000000..4ebdc634 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bina.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bins.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bins.c new file mode 100644 index 00000000..af56d92f --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/u8dec2bins.c @@ -0,0 +1,43 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexa.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexa.c new file mode 100644 index 00000000..f2fda27a --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexs.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexs.c new file mode 100644 index 00000000..bcbb2667 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/ddec2hexs.c @@ -0,0 +1,50 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexa.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexa.c new file mode 100644 index 00000000..e00eec42 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexs.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexs.c new file mode 100644 index 00000000..f4a15ee2 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/i16dec2hexs.c @@ -0,0 +1,49 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexa.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexa.c new file mode 100644 index 00000000..be659d47 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexs.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexs.c new file mode 100644 index 00000000..290335f9 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/i8dec2hexs.c @@ -0,0 +1,50 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexa.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexa.c new file mode 100644 index 00000000..abfe5aa1 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c new file mode 100644 index 00000000..b7c3c98a --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c @@ -0,0 +1,49 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexa.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexa.c new file mode 100644 index 00000000..8fe0526a --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexs.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexs.c new file mode 100644 index 00000000..acf236e6 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/u8dec2hexs.c @@ -0,0 +1,49 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c new file mode 100644 index 00000000..f6cbcfef --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c new file mode 100644 index 00000000..702f1862 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c new file mode 100644 index 00000000..fec152c8 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c new file mode 100644 index 00000000..340958fa --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c new file mode 100644 index 00000000..0c96f01b --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c new file mode 100644 index 00000000..0a35f94f --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c new file mode 100644 index 00000000..7a3e60e4 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c new file mode 100644 index 00000000..99936b4b --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c new file mode 100644 index 00000000..1a4e0267 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c new file mode 100644 index 00000000..fbfc1048 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c @@ -0,0 +1,38 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/hex2dec/dhex2decs.c b/src/c/elementaryFunctions/radix_conversions/hex2dec/dhex2decs.c new file mode 100644 index 00000000..42975737 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/hex2dec/dhex2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/hex2dec/ghex2decs.c b/src/c/elementaryFunctions/radix_conversions/hex2dec/ghex2decs.c new file mode 100644 index 00000000..eb42a7a7 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/hex2dec/ghex2decs.c @@ -0,0 +1,87 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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 * (int)pow((double)16, size)); + size--; + } + return o; + } diff --git a/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c new file mode 100644 index 00000000..e3619eb3 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c new file mode 100644 index 00000000..b126c619 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c new file mode 100644 index 00000000..9db3e2e1 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c new file mode 100644 index 00000000..928c3a2a --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c new file mode 100644 index 00000000..de57a0ea --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c new file mode 100644 index 00000000..b95a0426 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c new file mode 100644 index 00000000..7778ee96 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c new file mode 100644 index 00000000..4b30443e --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c new file mode 100644 index 00000000..d1880203 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.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: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c b/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c new file mode 100644 index 00000000..f804f7fd --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#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/src/c/elementaryFunctions/round/i16rounda.c b/src/c/elementaryFunctions/round/i16rounda.c new file mode 100644 index 00000000..26ed262a --- /dev/null +++ b/src/c/elementaryFunctions/round/i16rounda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +void i16rounda(int16* x, int size, int16* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=i16rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/i16rounds.c b/src/c/elementaryFunctions/round/i16rounds.c new file mode 100644 index 00000000..68bd7a4c --- /dev/null +++ b/src/c/elementaryFunctions/round/i16rounds.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +int16 i16rounds(int16 x) { + int result; + + if(x>=0) result = (int16)((float)x+0.5); + else result = (int16)((float)x-0.5); + + return (int16)result; +} diff --git a/src/c/elementaryFunctions/round/i8rounda.c b/src/c/elementaryFunctions/round/i8rounda.c new file mode 100644 index 00000000..bb0b0c90 --- /dev/null +++ b/src/c/elementaryFunctions/round/i8rounda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +void i8rounda(int8* x, int size, int8* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=i8rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/i8rounds.c b/src/c/elementaryFunctions/round/i8rounds.c new file mode 100644 index 00000000..bb737241 --- /dev/null +++ b/src/c/elementaryFunctions/round/i8rounds.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +int8 i8rounds(int8 x) { + int result; + + if(x>=0) result = (int8)((float)x+0.5); + else result = (int8)((float)x-0.5); + + return (int8)result; +} diff --git a/src/c/elementaryFunctions/round/u16rounda.c b/src/c/elementaryFunctions/round/u16rounda.c new file mode 100644 index 00000000..1b0b1edc --- /dev/null +++ b/src/c/elementaryFunctions/round/u16rounda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +void u16rounda(uint16* x, int size, uint16* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=u16rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/u16rounds.c b/src/c/elementaryFunctions/round/u16rounds.c new file mode 100644 index 00000000..f8a4ad49 --- /dev/null +++ b/src/c/elementaryFunctions/round/u16rounds.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +uint16 u16rounds(uint16 x) { + int result; + + if(x>=0) result = (uint16)((float)x+0.5); + else result = (uint16)((float)x-0.5); + + return (uint16)result; +} diff --git a/src/c/elementaryFunctions/round/u8rounda.c b/src/c/elementaryFunctions/round/u8rounda.c new file mode 100644 index 00000000..b58a6d20 --- /dev/null +++ b/src/c/elementaryFunctions/round/u8rounda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +void u8rounda(uint8* x, int size, uint8* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=u8rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/u8rounds.c b/src/c/elementaryFunctions/round/u8rounds.c new file mode 100644 index 00000000..e27cc2ca --- /dev/null +++ b/src/c/elementaryFunctions/round/u8rounds.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "round.h" + +uint8 u8rounds(uint8 x) { + int result; + + if(x>=0) result = (uint8)((float)x+0.5); + else result = (uint8)((float)x-0.5); + + return (uint8)result; +} diff --git a/src/c/elementaryFunctions/sin/i16sina.c b/src/c/elementaryFunctions/sin/i16sina.c new file mode 100644 index 00000000..4e9a3b06 --- /dev/null +++ b/src/c/elementaryFunctions/sin/i16sina.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sin.h" + +void i16sina(int16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16sins(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sin/i16sins.c b/src/c/elementaryFunctions/sin/i16sins.c new file mode 100644 index 00000000..6fcbd26f --- /dev/null +++ b/src/c/elementaryFunctions/sin/i16sins.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sin.h" + +float i16sins(int16 x) { + return (sin((double)x)); +} diff --git a/src/c/elementaryFunctions/sin/i8sina.c b/src/c/elementaryFunctions/sin/i8sina.c new file mode 100644 index 00000000..2457388f --- /dev/null +++ b/src/c/elementaryFunctions/sin/i8sina.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sin.h" + +void i8sina(int8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8sins(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sin/i8sins.c b/src/c/elementaryFunctions/sin/i8sins.c new file mode 100644 index 00000000..23823566 --- /dev/null +++ b/src/c/elementaryFunctions/sin/i8sins.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sin.h" + +float i8sins(int8 x) { + return (sin((double)x)); +} diff --git a/src/c/elementaryFunctions/sin/u16sina.c b/src/c/elementaryFunctions/sin/u16sina.c new file mode 100644 index 00000000..03054c20 --- /dev/null +++ b/src/c/elementaryFunctions/sin/u16sina.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sin.h" + +void u16sina(uint16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16sins(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sin/u16sins.c b/src/c/elementaryFunctions/sin/u16sins.c new file mode 100644 index 00000000..651b8e1a --- /dev/null +++ b/src/c/elementaryFunctions/sin/u16sins.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sin.h" + +float u16sins(uint16 x) { + return (sin((double)x)); +} diff --git a/src/c/elementaryFunctions/sin/u8sina.c b/src/c/elementaryFunctions/sin/u8sina.c new file mode 100644 index 00000000..271d6451 --- /dev/null +++ b/src/c/elementaryFunctions/sin/u8sina.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sin.h" + +void u8sina(uint8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8sins(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sin/u8sins.c b/src/c/elementaryFunctions/sin/u8sins.c new file mode 100644 index 00000000..f7c982f2 --- /dev/null +++ b/src/c/elementaryFunctions/sin/u8sins.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sin.h" + +float u8sins(uint8 x) { + return (sin((double)x)); +} diff --git a/src/c/elementaryFunctions/sind/dsinda.c b/src/c/elementaryFunctions/sind/dsinda.c new file mode 100644 index 00000000..c13fa0c7 --- /dev/null +++ b/src/c/elementaryFunctions/sind/dsinda.c @@ -0,0 +1,20 @@ +/* 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 "sind.h" + +void dsinda(double* x, int size, double* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = dsinds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sind/dsinds.c b/src/c/elementaryFunctions/sind/dsinds.c new file mode 100644 index 00000000..f7dc54f1 --- /dev/null +++ b/src/c/elementaryFunctions/sind/dsinds.c @@ -0,0 +1,18 @@ +/* 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 <math.h> +#include "sind.h" +#define PI 3.1415927 + +double dsinds(double x) { + return sin(x*PI/180); +} diff --git a/src/c/elementaryFunctions/sind/ssinda.c b/src/c/elementaryFunctions/sind/ssinda.c new file mode 100644 index 00000000..baefd68d --- /dev/null +++ b/src/c/elementaryFunctions/sind/ssinda.c @@ -0,0 +1,19 @@ +/* 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 "sind.h" + +void ssinda(float* x, int size, double* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = ssinds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sind/ssinds.c b/src/c/elementaryFunctions/sind/ssinds.c new file mode 100644 index 00000000..9d5bf0e7 --- /dev/null +++ b/src/c/elementaryFunctions/sind/ssinds.c @@ -0,0 +1,19 @@ +/* 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 <math.h> +#include "sind.h" +#include "sin.h" +#define PI 3.1415927 + +float ssinds(float x) { + return ssins(x*PI/180); +} diff --git a/src/c/elementaryFunctions/sinh/i16sinha.c b/src/c/elementaryFunctions/sinh/i16sinha.c new file mode 100644 index 00000000..71ad70b2 --- /dev/null +++ b/src/c/elementaryFunctions/sinh/i16sinha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sinh.h" + +void i16sinha(int16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16sinhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sinh/i16sinhs.c b/src/c/elementaryFunctions/sinh/i16sinhs.c new file mode 100644 index 00000000..a7ab3d51 --- /dev/null +++ b/src/c/elementaryFunctions/sinh/i16sinhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sinh.h" + +float i16sinhs(int16 x) { + return (sinh((double)x)); +} diff --git a/src/c/elementaryFunctions/sinh/i8sinha.c b/src/c/elementaryFunctions/sinh/i8sinha.c new file mode 100644 index 00000000..50025748 --- /dev/null +++ b/src/c/elementaryFunctions/sinh/i8sinha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sinh.h" + +void i8sinha(int8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8sinhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sinh/i8sinhs.c b/src/c/elementaryFunctions/sinh/i8sinhs.c new file mode 100644 index 00000000..ddc052aa --- /dev/null +++ b/src/c/elementaryFunctions/sinh/i8sinhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sinh.h" + +float i8sinhs(int8 x) { + return (sinh((double)x)); +} diff --git a/src/c/elementaryFunctions/sinh/u16sinha.c b/src/c/elementaryFunctions/sinh/u16sinha.c new file mode 100644 index 00000000..279ed488 --- /dev/null +++ b/src/c/elementaryFunctions/sinh/u16sinha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sinh.h" + +void u16sinha(uint16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16sinhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sinh/u16sinhs.c b/src/c/elementaryFunctions/sinh/u16sinhs.c new file mode 100644 index 00000000..5f828cd7 --- /dev/null +++ b/src/c/elementaryFunctions/sinh/u16sinhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sinh.h" + +float u16sinhs(uint16 x) { + return (sinh((double)x)); +} diff --git a/src/c/elementaryFunctions/sinh/u8sinha.c b/src/c/elementaryFunctions/sinh/u8sinha.c new file mode 100644 index 00000000..66a51e81 --- /dev/null +++ b/src/c/elementaryFunctions/sinh/u8sinha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sinh.h" + +void u8sinha(uint8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8sinhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/sinh/u8sinhs.c b/src/c/elementaryFunctions/sinh/u8sinhs.c new file mode 100644 index 00000000..9f49d7b6 --- /dev/null +++ b/src/c/elementaryFunctions/sinh/u8sinhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "sinh.h" + +float u8sinhs(uint8 x) { + return (sinh((double)x)); +} diff --git a/src/c/elementaryFunctions/sqrt/dsqrta.c b/src/c/elementaryFunctions/sqrt/dsqrta.c index a948f35b..b87800f4 100644 --- a/src/c/elementaryFunctions/sqrt/dsqrta.c +++ b/src/c/elementaryFunctions/sqrt/dsqrta.c @@ -12,7 +12,7 @@ #include "sqrt.h" -void dsqrta(double* in, int size, double* out) { +void dsqrta(double* in, int size, double* out) { int i = 0; for (i = 0 ; i < size ; ++i) { out[i] = dsqrts(in[i]); diff --git a/src/c/elementaryFunctions/sqrt/dsqrts.c b/src/c/elementaryFunctions/sqrt/dsqrts.c index 350cbbd0..8e664495 100644 --- a/src/c/elementaryFunctions/sqrt/dsqrts.c +++ b/src/c/elementaryFunctions/sqrt/dsqrts.c @@ -13,6 +13,6 @@ #include <math.h> #include "sqrt.h" -double dsqrts(double in){ +double dsqrts(double in){ return sqrt(in); } diff --git a/src/c/elementaryFunctions/tan/i16tana.c b/src/c/elementaryFunctions/tan/i16tana.c new file mode 100644 index 00000000..cbbe237b --- /dev/null +++ b/src/c/elementaryFunctions/tan/i16tana.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tan.h" + +void i16tana(int16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16tans(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tan/i16tans.c b/src/c/elementaryFunctions/tan/i16tans.c new file mode 100644 index 00000000..b7cc7bb7 --- /dev/null +++ b/src/c/elementaryFunctions/tan/i16tans.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tan.h" + +float i16tans(int16 x) { + return (tanf(x)); +} diff --git a/src/c/elementaryFunctions/tan/i8tana.c b/src/c/elementaryFunctions/tan/i8tana.c new file mode 100644 index 00000000..4daeb471 --- /dev/null +++ b/src/c/elementaryFunctions/tan/i8tana.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tan.h" + +void i8tana(int8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8tans(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tan/i8tans.c b/src/c/elementaryFunctions/tan/i8tans.c new file mode 100644 index 00000000..0dc9f9a5 --- /dev/null +++ b/src/c/elementaryFunctions/tan/i8tans.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tan.h" + +float i8tans(int8 x) { + return (tanf(x)); +} diff --git a/src/c/elementaryFunctions/tan/u16tana.c b/src/c/elementaryFunctions/tan/u16tana.c new file mode 100644 index 00000000..12df0ee9 --- /dev/null +++ b/src/c/elementaryFunctions/tan/u16tana.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tan.h" + +void u16tana(uint16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16tans(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tan/u16tans.c b/src/c/elementaryFunctions/tan/u16tans.c new file mode 100644 index 00000000..f184a674 --- /dev/null +++ b/src/c/elementaryFunctions/tan/u16tans.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tan.h" + +float u16tans(uint16 x) { + return (tanf(x)); +} diff --git a/src/c/elementaryFunctions/tan/u8tana.c b/src/c/elementaryFunctions/tan/u8tana.c new file mode 100644 index 00000000..d541b20f --- /dev/null +++ b/src/c/elementaryFunctions/tan/u8tana.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tan.h" + +void u8tana(uint8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8tans(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tan/u8tans.c b/src/c/elementaryFunctions/tan/u8tans.c new file mode 100644 index 00000000..74b5fb9d --- /dev/null +++ b/src/c/elementaryFunctions/tan/u8tans.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tan.h" + +float u8tans(uint8 x) { + return (tanf(x)); +} diff --git a/src/c/elementaryFunctions/tand/dtanda.c b/src/c/elementaryFunctions/tand/dtanda.c new file mode 100644 index 00000000..e5d56a87 --- /dev/null +++ b/src/c/elementaryFunctions/tand/dtanda.c @@ -0,0 +1,19 @@ +/* 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 "tand.h" + +void dtanda(double* x, int size, double* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = dtands(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tand/dtands.c b/src/c/elementaryFunctions/tand/dtands.c new file mode 100644 index 00000000..6fda5b7d --- /dev/null +++ b/src/c/elementaryFunctions/tand/dtands.c @@ -0,0 +1,18 @@ +/* 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 <math.h> +#include "tand.h" +#define PI 3.1415927 + +double dtands(double x) { + return tan(x*PI/180); +} diff --git a/src/c/elementaryFunctions/tand/standa.c b/src/c/elementaryFunctions/tand/standa.c new file mode 100644 index 00000000..e37f5a05 --- /dev/null +++ b/src/c/elementaryFunctions/tand/standa.c @@ -0,0 +1,19 @@ +/* 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 "tand.h" + +void standa(float* x, int size, double* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = stands(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tand/stands.c b/src/c/elementaryFunctions/tand/stands.c new file mode 100644 index 00000000..4d667015 --- /dev/null +++ b/src/c/elementaryFunctions/tand/stands.c @@ -0,0 +1,19 @@ +/* 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 <math.h> +#include "tand.h" +#include "tan.h" +#define PI 3.1415927 + +float stands(float x) { + return stans(x*PI/180); +} diff --git a/src/c/elementaryFunctions/tanh/ctanhs.c b/src/c/elementaryFunctions/tanh/ctanhs.c index 5111dbd7..24c1fa68 100644 --- a/src/c/elementaryFunctions/tanh/ctanhs.c +++ b/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); diff --git a/src/c/elementaryFunctions/tanh/i16tanha.c b/src/c/elementaryFunctions/tanh/i16tanha.c new file mode 100644 index 00000000..3a4e37cd --- /dev/null +++ b/src/c/elementaryFunctions/tanh/i16tanha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tanh.h" + +void i16tanha(int16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i16tanhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tanh/i16tanhs.c b/src/c/elementaryFunctions/tanh/i16tanhs.c new file mode 100644 index 00000000..7d8b1843 --- /dev/null +++ b/src/c/elementaryFunctions/tanh/i16tanhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tanh.h" + +float i16tanhs(int16 x) { + return (tanhf(x)); +} diff --git a/src/c/elementaryFunctions/tanh/i8tanha.c b/src/c/elementaryFunctions/tanh/i8tanha.c new file mode 100644 index 00000000..dca31761 --- /dev/null +++ b/src/c/elementaryFunctions/tanh/i8tanha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tanh.h" + +void i8tanha(int8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = i8tanhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tanh/i8tanhs.c b/src/c/elementaryFunctions/tanh/i8tanhs.c new file mode 100644 index 00000000..6351e5c8 --- /dev/null +++ b/src/c/elementaryFunctions/tanh/i8tanhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tanh.h" + +float i8tanhs(int8 x) { + return (tanhf(x)); +} diff --git a/src/c/elementaryFunctions/tanh/u16tanha.c b/src/c/elementaryFunctions/tanh/u16tanha.c new file mode 100644 index 00000000..61db747b --- /dev/null +++ b/src/c/elementaryFunctions/tanh/u16tanha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tanh.h" + +void u16tanha(uint16* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u16tanhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tanh/u16tanhs.c b/src/c/elementaryFunctions/tanh/u16tanhs.c new file mode 100644 index 00000000..17909e7c --- /dev/null +++ b/src/c/elementaryFunctions/tanh/u16tanhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tanh.h" + +float u16tanhs(uint16 x) { + return (tanhf(x)); +} diff --git a/src/c/elementaryFunctions/tanh/u8tanha.c b/src/c/elementaryFunctions/tanh/u8tanha.c new file mode 100644 index 00000000..9ca20eeb --- /dev/null +++ b/src/c/elementaryFunctions/tanh/u8tanha.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "tanh.h" + +void u8tanha(uint8* x, int size, float* y) { + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = u8tanhs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/tanh/u8tanhs.c b/src/c/elementaryFunctions/tanh/u8tanhs.c new file mode 100644 index 00000000..c6179f9d --- /dev/null +++ b/src/c/elementaryFunctions/tanh/u8tanhs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <math.h> +#include "tanh.h" + +float u8tanhs(uint8 x) { + return (tanhf(x)); +} diff --git a/src/c/elementaryFunctions/type/gtype b/src/c/elementaryFunctions/type/gtype new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/c/elementaryFunctions/type/gtype diff --git a/src/c/elementaryFunctions/uint16/duint16a.c b/src/c/elementaryFunctions/uint16/duint16a.c new file mode 100644 index 00000000..af9e2f57 --- /dev/null +++ b/src/c/elementaryFunctions/uint16/duint16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint16.h" + +void duint16a(double* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = duint16s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint16/duint16s.c b/src/c/elementaryFunctions/uint16/duint16s.c new file mode 100644 index 00000000..79bd75a3 --- /dev/null +++ b/src/c/elementaryFunctions/uint16/duint16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint16.h" + +uint16 duint16s(double x) { + return (uint16) x; +} diff --git a/src/c/elementaryFunctions/uint16/i16uint16a.c b/src/c/elementaryFunctions/uint16/i16uint16a.c new file mode 100644 index 00000000..64a598d2 --- /dev/null +++ b/src/c/elementaryFunctions/uint16/i16uint16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint16.h" + +void i16uint16a(int16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16uint16s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint16/i16uint16s.c b/src/c/elementaryFunctions/uint16/i16uint16s.c new file mode 100644 index 00000000..01d46ac1 --- /dev/null +++ b/src/c/elementaryFunctions/uint16/i16uint16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint16.h" + +uint16 i16uint16s(int16 x) { + return (uint16) x; +} diff --git a/src/c/elementaryFunctions/uint16/i8uint16a.c b/src/c/elementaryFunctions/uint16/i8uint16a.c new file mode 100644 index 00000000..3cab61fa --- /dev/null +++ b/src/c/elementaryFunctions/uint16/i8uint16a.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "uint16.h" + +void i8uint16a(int8* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8uint16s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint16/i8uint16s.c b/src/c/elementaryFunctions/uint16/i8uint16s.c new file mode 100644 index 00000000..5527838e --- /dev/null +++ b/src/c/elementaryFunctions/uint16/i8uint16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint16.h" + +uint16 i8uint16s(int8 x) { + return (uint16) x; +} diff --git a/src/c/elementaryFunctions/uint16/suint16a.c b/src/c/elementaryFunctions/uint16/suint16a.c new file mode 100644 index 00000000..e048922f --- /dev/null +++ b/src/c/elementaryFunctions/uint16/suint16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint16.h" + +void suint16a(float* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = suint16s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint16/suint16s.c b/src/c/elementaryFunctions/uint16/suint16s.c new file mode 100644 index 00000000..8d277d19 --- /dev/null +++ b/src/c/elementaryFunctions/uint16/suint16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint16.h" + +uint16 suint16s(float x) { + return (uint16) x; +} diff --git a/src/c/elementaryFunctions/uint16/u8uint16a.c b/src/c/elementaryFunctions/uint16/u8uint16a.c new file mode 100644 index 00000000..b5ca533f --- /dev/null +++ b/src/c/elementaryFunctions/uint16/u8uint16a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint16.h" + +void u8uint16a(uint8* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8uint16s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint16/u8uint16s.c b/src/c/elementaryFunctions/uint16/u8uint16s.c new file mode 100644 index 00000000..9da480f8 --- /dev/null +++ b/src/c/elementaryFunctions/uint16/u8uint16s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint16.h" + +uint16 u8uint16s(uint8 x) { + return (uint16) x; +} diff --git a/src/c/elementaryFunctions/uint32/duint32a.c b/src/c/elementaryFunctions/uint32/duint32a.c new file mode 100644 index 00000000..7cd0ea3e --- /dev/null +++ b/src/c/elementaryFunctions/uint32/duint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint32.h" + +void duint32a(double* x, int size, uint32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = duint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint32/duint32s.c b/src/c/elementaryFunctions/uint32/duint32s.c new file mode 100644 index 00000000..f507305a --- /dev/null +++ b/src/c/elementaryFunctions/uint32/duint32s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint32.h" + +uint32 duint32s(double x) { + return (uint32) x; +} diff --git a/src/c/elementaryFunctions/uint32/i16uint32a.c b/src/c/elementaryFunctions/uint32/i16uint32a.c new file mode 100644 index 00000000..84d0fa02 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/i16uint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint32.h" + +void i16uint32a(int16* x, int size, uint32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16uint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint32/i16uint32s.c b/src/c/elementaryFunctions/uint32/i16uint32s.c new file mode 100644 index 00000000..7d9ccef7 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/i16uint32s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint32.h" + +uint32 i16uint32s(int16 x) { + return (uint32) x; +} diff --git a/src/c/elementaryFunctions/uint32/i32uint32a.c b/src/c/elementaryFunctions/uint32/i32uint32a.c new file mode 100644 index 00000000..415711ed --- /dev/null +++ b/src/c/elementaryFunctions/uint32/i32uint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint32.h" + +void i32uint32a(int32* x, int size, uint32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i32uint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint32/i32uint32s.c b/src/c/elementaryFunctions/uint32/i32uint32s.c new file mode 100644 index 00000000..63442f24 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/i32uint32s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint32.h" + +uint32 i32uint32s(int32 x) { + return (uint32) x; +} diff --git a/src/c/elementaryFunctions/uint32/i8uint32a.c b/src/c/elementaryFunctions/uint32/i8uint32a.c new file mode 100644 index 00000000..0dca1b5b --- /dev/null +++ b/src/c/elementaryFunctions/uint32/i8uint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint32.h" + +void i8uint32a(int8* x, int size, uint32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8uint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint32/i8uint32s.c b/src/c/elementaryFunctions/uint32/i8uint32s.c new file mode 100644 index 00000000..46c0ecb5 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/i8uint32s.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint32.h" + +uint32 i8uint32s(int8 x) { + return (uint32) x; +} diff --git a/src/c/elementaryFunctions/uint32/suint32a.c b/src/c/elementaryFunctions/uint32/suint32a.c new file mode 100644 index 00000000..2478c021 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/suint32a.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint32.h" + +void suint32a(float* x, int size, uint32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = suint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint32/suint32s.c b/src/c/elementaryFunctions/uint32/suint32s.c new file mode 100644 index 00000000..3578b428 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/suint32s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint32.h" + +uint32 suint32s(float x) { + return (uint32) x; +} diff --git a/src/c/elementaryFunctions/uint32/u16uint32a.c b/src/c/elementaryFunctions/uint32/u16uint32a.c new file mode 100644 index 00000000..177bae24 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/u16uint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint32.h" + +void u16uint32a(uint16* x, int size, uint32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16uint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint32/u16uint32s.c b/src/c/elementaryFunctions/uint32/u16uint32s.c new file mode 100644 index 00000000..df258b26 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/u16uint32s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint32.h" + +uint32 u16uint32s(uint16 x) { + return (uint32) x; +} diff --git a/src/c/elementaryFunctions/uint32/u8uint32a.c b/src/c/elementaryFunctions/uint32/u8uint32a.c new file mode 100644 index 00000000..a89541b1 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/u8uint32a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint32.h" + +void u8uint32a(uint8* x, int size, uint32* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8uint32s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint32/u8uint32s.c b/src/c/elementaryFunctions/uint32/u8uint32s.c new file mode 100644 index 00000000..ac48fe27 --- /dev/null +++ b/src/c/elementaryFunctions/uint32/u8uint32s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint32.h" + +uint32 u8uint32s(uint8 x) { + return (uint32) x; +} diff --git a/src/c/elementaryFunctions/uint8/duint8a.c b/src/c/elementaryFunctions/uint8/duint8a.c new file mode 100644 index 00000000..02d63058 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/duint8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint8.h" + +void duint8a(double* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = duint8s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint8/duint8s.c b/src/c/elementaryFunctions/uint8/duint8s.c new file mode 100644 index 00000000..d7a7524f --- /dev/null +++ b/src/c/elementaryFunctions/uint8/duint8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint8.h" + +uint8 duint8s(double x) { + return (uint8) x; +} diff --git a/src/c/elementaryFunctions/uint8/i16uint8a.c b/src/c/elementaryFunctions/uint8/i16uint8a.c new file mode 100644 index 00000000..49e31d12 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/i16uint8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint8.h" + +void i16uint8a(int16* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16uint8s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint8/i16uint8s.c b/src/c/elementaryFunctions/uint8/i16uint8s.c new file mode 100644 index 00000000..695d7882 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/i16uint8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint8.h" + +uint8 i16uint8s(int16 x) { + return (uint8) x; +} diff --git a/src/c/elementaryFunctions/uint8/i8uint8a.c b/src/c/elementaryFunctions/uint8/i8uint8a.c new file mode 100644 index 00000000..89574e83 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/i8uint8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint8.h" + +void i8uint8a(int8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8uint8s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint8/i8uint8s.c b/src/c/elementaryFunctions/uint8/i8uint8s.c new file mode 100644 index 00000000..4c83c4e4 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/i8uint8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint8.h" + +uint8 i8uint8s(int8 x) { + return (uint8) x; +} diff --git a/src/c/elementaryFunctions/uint8/suint8a.c b/src/c/elementaryFunctions/uint8/suint8a.c new file mode 100644 index 00000000..2e1a5ac8 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/suint8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint8.h" + +void suint8a(float* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = suint8s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint8/suint8s.c b/src/c/elementaryFunctions/uint8/suint8s.c new file mode 100644 index 00000000..ce38c1d0 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/suint8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint8.h" + +uint8 suint8s(float x) { + return (uint8) x; +} diff --git a/src/c/elementaryFunctions/uint8/u16uint8a.c b/src/c/elementaryFunctions/uint8/u16uint8a.c new file mode 100644 index 00000000..0c4246ec --- /dev/null +++ b/src/c/elementaryFunctions/uint8/u16uint8a.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "uint8.h" + +void u16uint8a(uint16* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16uint8s(x[i]); +} diff --git a/src/c/elementaryFunctions/uint8/u16uint8s.c b/src/c/elementaryFunctions/uint8/u16uint8s.c new file mode 100644 index 00000000..32d5b718 --- /dev/null +++ b/src/c/elementaryFunctions/uint8/u16uint8s.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "uint8.h" + +uint8 u16uint8s(uint16 x) { + return (uint8) x; +} diff --git a/src/c/graphics/transforms/includes/scaling.h b/src/c/graphics/transforms/includes/scaling.h new file mode 100644 index 00000000..35d9f24e --- /dev/null +++ b/src/c/graphics/transforms/includes/scaling.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 __SCALING_H__ +#define __SCALING_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "uint8.h" +#include "uint16.h" +#include "int16.h" +#include "factorial.h" +#include "ones.h" +#include "matrixMultiplication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dscalinga (double* inp1, int row, int col, double inp2, double* inp3, int size3, double* out); +void sscalinga (float* inp1, int row, int col, double inp2, float* inp3, int size3, float* out); +void zscalinga (doubleComplex* inp1, int row, int col, doubleComplex inp2, doubleComplex* inp3, int size3, doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__SCALING_H__*/ diff --git a/src/c/graphics/transforms/interfaces/int_scaling.h b/src/c/graphics/transforms/interfaces/int_scaling.h new file mode 100644 index 00000000..61cb5ab8 --- /dev/null +++ b/src/c/graphics/transforms/interfaces/int_scaling.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 __INT_SCALING_H__ +#define __INT_SCALING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define d2d0d2scalingd2(in1, size1, in2, in3, size2, out) dscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out) +#define s2s0s2scalings2(in1, size1, in2, in3, size2, out) sscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out) +#define s2d0s2scalings2(in1, size1, in2, in3, size2, out) sscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out) +#define z2z0z2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out) +#define z2d0d2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out) +#define z2z0d2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out) +#define z2d0z2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_SCALING_H__*/ diff --git a/src/c/graphics/transforms/scaling/dscalinga.c b/src/c/graphics/transforms/scaling/dscalinga.c new file mode 100644 index 00000000..24d45733 --- /dev/null +++ b/src/c/graphics/transforms/scaling/dscalinga.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Brijesh Gupta C R + Email: toolbox@scilab.in +*/ +#include <stdio.h> +#include <math.h> +#include "scaling.h" +#include "ones.h" +#include "matrixMultiplication.h" + +void dscalinga (double* inp1, int row, int col, double inp2, double* inp3, int size3, double* out) +{ + double temp[row*col], one[col], prod[row*col], diff[row*col]; + + for(int i = 0; i < row*col; i++) + temp[i] = inp1[i]; + + donesa(one, 1, col); + + dmulma(inp3, 2, 1, one, 1, col, prod); + + for(int i = 0; i < row*col; i++) + diff[i] = inp1[i] - prod[i]; + + for(int i = 0; i < row*col; i++) + out[i] = (inp2 * diff[i]) + prod[i]; +} diff --git a/src/c/graphics/transforms/scaling/sscalinga.c b/src/c/graphics/transforms/scaling/sscalinga.c new file mode 100644 index 00000000..1adfcf3e --- /dev/null +++ b/src/c/graphics/transforms/scaling/sscalinga.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Brijesh Gupta C R + Email: toolbox@scilab.in +*/ +#include <stdio.h> +#include <math.h> +#include "scaling.h" +#include "ones.h" +#include "matrixMultiplication.h" + +void sscalinga (float* inp1, int row, int col, double inp2, float* inp3, int size3, float* out) +{ + float temp[row*col], one[col], prod[row*col], diff[row*col]; + + for(int i = 0; i < row*col; i++) + temp[i] = inp1[i]; + + sonesa(one, 1, col); + + smulma(inp3, 2, 1, one, 1, col, prod); + + for(int i = 0; i < row*col; i++) + diff[i] = inp1[i] - prod[i]; + + for(int i = 0; i < row*col; i++) + out[i] = (inp2 * diff[i]) + prod[i]; +} diff --git a/src/c/graphics/transforms/scaling/zscalinga.c b/src/c/graphics/transforms/scaling/zscalinga.c new file mode 100644 index 00000000..fb71a77e --- /dev/null +++ b/src/c/graphics/transforms/scaling/zscalinga.c @@ -0,0 +1,38 @@ +/* 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 "scaling.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "doubleComplex.h" +#include "subtraction.h" +#include "addition.h" +#include "multiplication.h" + +void zscalinga (doubleComplex* inp1, int row, int col, doubleComplex inp2, doubleComplex* inp3, int size3, doubleComplex* out) +{ + doubleComplex temp[row*col], one[col], prod[row*col], diff[row*col]; + + for(int i = 0; i < row*col; i++) + temp[i] = inp1[i]; + + zonesa(one, 1, col); + + zmulma(inp3, 2, 1, one, 1, col, prod); + + for(int i = 0; i < row*col; i++) + diff[i] = zdiffs(inp1[i], prod[i]); + + for(int i = 0; i < row*col; i++) + out[i] = zadds(zmuls(inp2, diff[i]), prod[i]); +} diff --git a/src/c/hardware/avr/adc/u8AVRADCSetups.c b/src/c/hardware/avr/adc/u8AVRADCSetups.c new file mode 100644 index 00000000..66f491b2 --- /dev/null +++ b/src/c/hardware/avr/adc/u8AVRADCSetups.c @@ -0,0 +1,43 @@ +// Function to initialise ADC of AVR +// +// Calling Sequence +// AVRSetupADC(uint8 prescaler, uint8 adc_ref) +// +// Parameters +// prescaler: prescaler to be used for generating ADC clock (0-7) +// adc_ref : reference voltage to be used for ADC conversion +// 0 -> Voltage on VREF pin +// 1 -> Voltage on AVCC pin +// 2 -> Internal 2.56 reference voltage +// +// Description +// This function initialises ADc of AVR with given parameters. 'prescaler' is +// needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz +// and it given as (MCU clock/2^prescaler). Select appropriate prescaler depending +// on MCU clock. 'adc_ref' selects one of the available reference voltage sources +// available +// Examples +// AVRADCSetup(128,0) +// +// Authors +// Siddhesh Wani +// Ashish Kamble + +#include "AVRPeripheralADC.h" + + +uint8 u8AVRADCSetups(uint8 prescaler, uint8 adc_ref) +{ +/*Set the prescaler value*/ + ADCSRA |= (prescaler & 0x07); + + /*Set the adc reference voltage*/ + ADMUX |= ((adc_ref & 0x03) << 6); + + /*Enable ADC hardware. Set ADEN bit*/ +ADCSRA |= (1<<7); + +return 0; +} + + diff --git a/src/c/hardware/avr/adc/u8AVRReadADCs.c b/src/c/hardware/avr/adc/u8AVRReadADCs.c new file mode 100644 index 00000000..302f8c82 --- /dev/null +++ b/src/c/hardware/avr/adc/u8AVRReadADCs.c @@ -0,0 +1,82 @@ +// 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 +// Email: toolbox@scilab.in + +// Function to get voltage on analog pin on AVR +// +// Calling Sequence +// u8AVRReadADCs(channel) +// +// Parameters +// channel : Select which channel is to be read. Values from 0-7 select one +// of the pins ADC0-ADC7. For other possible channel values refer +// datasheet +// Returns-> +// result : Digital value for the voltage present on channel selected +// +// Description +// This function returns digital value for present on adc pins. 'channel' +// selects which of the ADC0-ADC7 is to be used for reading analog value. +// Apart from reading just ADC0-ADC7 other it can also read differential +// voltages between some pins. For channel values for those options, please +// refer datasheet. +// +// Examples +// adc_result = u8AVRReadADC(0) //Read ADC0 +// +// Authors +// Siddhesh Wani +// Ashish Kamble + + +#include "AVRPeripheralADC.h" + +uint8 u8AVRReadADCs(uint8 channel) +{ + +uint8 i; + + ADCH=0x00; + + i=channel&0x07; + ADMUX=i|0x60; //i|0x40 for 10 bits + ADCSRA|=1<<ADSC; + + while(ADCSRA & (1<<ADSC)); // wait for conv. to complete + uint8 temp=ADCH; //unsigned int temp=ADC; for 10 bits + + return temp; + +} + + + + + + + + + + +/*Set ADC conversion channel*/ +// ADMUX |= (channel & 0x1F); + + /*Start ADC conversion. Set 'ADSC' bit*/ +// ADCSRA |= (1<<6); + + /*Wait for conversion to complete. Check 'ADIF' bit*/ +// while(!(ADCSRA & (1<<4))); + + /*Clear ADIF flag*/ +// ADCSRA |= (1<<4); + + /*ADC conversion result is stored in ADCH/L registers*/ +// return (ADC); + + diff --git a/src/c/hardware/avr/default_files/Makefile b/src/c/hardware/avr/default_files/Makefile new file mode 100644 index 00000000..c388196b --- /dev/null +++ b/src/c/hardware/avr/default_files/Makefile @@ -0,0 +1,387 @@ + +# make all = Make software and program +# make clean = Clean out built project files. +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! + +# Microcontroller Type +MCU = atmega16 + +# Target file name (without extension). +TARGET = main + +# Programming hardware: +AVRDUDE_PROGRAMMER = usbasp + +AVRDUDE_PORT = /dev/usb + +############# Don't need to change below here for most purposes (Elliot) + +# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +CSRCDIR = src/c +HSRCDIR = includes +ISRCDIR = interfaces +SCI2CDIR = . +# List C source files here. (C dependencies are automatically generated.) +SRC = $(wildcard $(CSRCDIR)/*.c) main.c + +# If there is more than one source file, append them above, or modify and +# uncomment the following: +#SRC += foo.c bar.c + +# You can also wrap lines by appending a backslash to the end of the line: +#SRC += baz.c \ +#xyzzy.c + + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = includes interfaces +EXTRALIBDIRS = . + + +# Optional compiler flags. +# -g: generate debugging information (for GDB, or for COFF conversion) +# -O*: optimization level +# -f...: tuning, see gcc manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create assembler listing +#CFLAGS = -g -O$(OPT) \ +#-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ +#-Wall -Wstrict-prototypes \ +#-Wa,-adhlns=$(<:.c=.lst) \ +#$(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS = -g -Wall $(patsubst %,-I%,$(EXTRAINCDIRS)) $(patsubst %,-L%,$(EXTRALIBDIRS)) + +# Set a "language standard" compiler flag. +# Unremark just one line below to set the language standard to use. +# gnu99 = C99 + GNU extensions. See GCC manual for more information. +#CFLAGS += -std=c89 +#CFLAGS += -std=gnu89 +#CFLAGS += -std=c99 +#CFLAGS += -std=gnu99 + + + +# Optional assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs + + + +# Optional linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref + + + +# Additional libraries + +# Minimalistic printf version +#LDFLAGS += -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires -lm below) +#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt + +# -lm = math library +LDFLAGS += -lc +LDFLAGS += -lm + +# Programming support using avrdude. Settings and variables. + + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + +AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER) + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE += -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_FLAGS += -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> +# to submit bug reports. +#AVRDUDE_FLAGS += -v -v + +#Run while cable attached or don't +AVRDUDE_FLAGS += -E reset #keep chip disabled while cable attached +#AVRDUDE_FLAGS += -E noreset + +#AVRDUDE_WRITE_FLASH = -U lfuse:w:0x04:m #run with 8 Mhz clock + +#AVRDUDE_WRITE_FLASH = -U lfuse:w:0x21:m #run with 1 Mhz clock #default clock mode + +#AVRDUDE_WRITE_FLASH = -U lfuse:w:0x01:m #run with 1 Mhz clock no start up time + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = /usr/lib/avr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = $(DIRAVR)/include +DIRLIB = $(DIRAVR)/lib + + +# Define programs and commands. +SHELL = sh + +CC = avr-gcc + +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar + +# Programming support using avrdude. +AVRDUDE = avrdude + + +REMOVE = rm -f +COPY = cp + +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + +#LOCAL_LIB +LOCAL_LIB = main.a + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + +# Default target: make program! +all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ + $(TARGET).lss $(TARGET).sym sizeafter finished end +# $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + + + +# Display compiler version information. +gccversion : + @$(CC) --version + + + + +# Convert ELF to COFF for use in debugging / simulating in +# AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ + --change-section-address .data-0x800000 \ + --change-section-address .bss-0x800000 \ + --change-section-address .noinit-0x800000 \ + --change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + avr-nm -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: %.a + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(LOCAL_LIB) -o $@ $(LDFLAGS) + +$(LOCAL_LIB): $(OBJ) + $(AR) rcs $@ $(OBJ) + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) *~ + +# Automatically generate C source code dependencies. +# (Code originally taken from the GNU make user manual and modified +# (See README.txt Credits).) +# +# Note that this will work with sh (bash) and sed that is shipped with WinAVR +# (see the SHELL variable defined above). +# This may not work with other shells or other seds. +# +%.d: %.c + set -e; $(CC) -MM $(ALL_CFLAGS) $< \ + | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ + [ -s $@ ] || rm -f $@ + + +# Remove the '-' if you want to see the dependency files generated. +-include $(SRC:.c=.d) + + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ + clean clean_list program diff --git a/src/c/hardware/avr/gpio/u8AVRDigitalIns.c b/src/c/hardware/avr/gpio/u8AVRDigitalIns.c new file mode 100644 index 00000000..a2517b98 --- /dev/null +++ b/src/c/hardware/avr/gpio/u8AVRDigitalIns.c @@ -0,0 +1,63 @@ +// 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 +// Email: toolbox@scilab.in + +// Function to get current state (high\low) of a digital pin on AVR +// +// Calling Sequence +// u8AVRDigitalIns(port,pin) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// pin : pin of port (mentioned above) to be used +// Returns-> +// state : state of the pin (0 for low and 1 for high) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port is to +// be read. Function returns current state of the pin '1' (high) or '0' (low). +// +// +// Examples +// state = u8AVRDigitalIns(1,0) +// +// Authors +// Siddhesh Wani +// + + +#include "AVRPeripheralGPIO.h" + +uint8 u8AVRDigitalIns(uint8 port,uint8 pin) +{ + unsigned int state = 0; + if(port == PORT_A) + { + state = bit_is_clear(PINA,pin); + return !state; + } + if(port == PORT_B) + { + state = bit_is_clear(PINB,pin); + return !state; + } + if(port == PORT_C) + { + state = bit_is_clear(PINC,pin); + return !state; + } + if(port == PORT_D) + { + state = bit_is_clear(PIND,pin); + return !state; + } + +} diff --git a/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c b/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c new file mode 100644 index 00000000..8998fc91 --- /dev/null +++ b/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c @@ -0,0 +1,78 @@ +// 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 +// Email: toolbox@scilab.in + +// Function to change state (high\low) of a digital output pin on AVR +// +// Calling Sequence +// u8AVRDigitalOuts(port,pin,state) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// pin : pin of port (mentioned above) to be used +// state : state to be outputed on pin (0 for low and 1 for high) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port as +// digital output. Also, desired output state must be specified as +// '1' (high) or '0' (low). +// +// Examples +// u8AVRDigitalOuts(1,0,1) +// +// Authors +// Siddhesh Wani +// Ashish Kamble + + +#include "AVRPeripheralGPIO.h" + +void u8AVRDigitalOuts(uint8 port,uint8 pin,uint8 state) +{ + if(state == LOW) + {/*Make output pin high*/ + if(port == PORT_A) + { + PORTA = PORTA & ~(1<<pin); + } + if(port == PORT_B) + { + PORTB = PORTB & ~(1<<pin); + } + if(port == PORT_C) + { + PORTC = PORTC & ~(1<<pin); + } + if(port == PORT_D) + { + PORTD = PORTD & ~(1<<pin); + } + } + else + {/*Make output pin high*/ + if(port == PORT_A) + { + PORTA = PORTA | (1<<pin); + } + if(port == PORT_B) + { + PORTB = PORTB | (1<<pin); + } + if(port == PORT_C) + { + PORTC = PORTC | (1<<pin); + } + if(port == PORT_D) + { + PORTD = PORTD | (1<<pin); + } + } +} diff --git a/src/c/hardware/avr/gpio/u8AVRDigitalPortSetups.c b/src/c/hardware/avr/gpio/u8AVRDigitalPortSetups.c new file mode 100644 index 00000000..54ec7312 --- /dev/null +++ b/src/c/hardware/avr/gpio/u8AVRDigitalPortSetups.c @@ -0,0 +1,81 @@ +// 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 +// Email: toolbox@scilab.in + +// Function to decide direction of a digital pin on AVR +// +// Calling Sequence +// AVRDigitalPortSetup(port,direction) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// direction : direction to be set for pin (0 for input, 1 for output) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs/inputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port to be +// used as digital output/input. Also, desired direction must be specified as +// 'INPUT' or 'OUTPUT'. +// +// Examples +// AVRDigitalPortSetup(1,0); //this function will PortA as input Port +// +// Authors +// Siddhesh Wani +// Ashish Kamble + + +#include "AVRPeripheralGPIO.h" + +uint8 u8AVRDigitalPortSetups(uint8 port,uint8 direction) +{ + if(direction == INPUT) + { + /*Set port as input*/ + if(port == PORT_A) + { + DDRA = 0x00; + } + if(port == PORT_B) + { + DDRB = 0x00; + } + if(port == PORT_C) + { + DDRC = 0x00; + } + if(port == PORT_D) + { + DDRD = 0x00; + } + } + else + { + /*Set port as output*/ + if(port == PORT_A) + { + DDRA = 0xFF; + } + if(port == PORT_B) + { + DDRB = 0xFF; + } + if(port == PORT_C) + { + DDRC = 0xFF; + } + if(port == PORT_D) + { + DDRD = 0xFF; + } + } + return 0; +} + diff --git a/src/c/hardware/avr/gpio/u8AVRDigitalSetups.c b/src/c/hardware/avr/gpio/u8AVRDigitalSetups.c new file mode 100644 index 00000000..e28c468c --- /dev/null +++ b/src/c/hardware/avr/gpio/u8AVRDigitalSetups.c @@ -0,0 +1,70 @@ +// Function to decide direction of a digital pin on AVR +// +// Calling Sequence +// AVRDigitalSetup(port,pin,direction) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// pin : pin of port (mentioned above) to be used +// direction : direction to be set for pin (0 for input, 1 for output) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs/inputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port to be +// used as digital output/input. Also, desired direction must be specified as +// 'INPUT' or 'OUTPUT'. +// +// Examples +// AVRDigitalSetup(1,0,1) +// +// Authors +// Siddhesh Wani +// + +#include "AVRPeripheralGPIO.h" + + +void u8AVRDigitalSetups(uint8 port,uint8 pin,uint8 direction) +{ + + if (direction == INPUT) + {/*Set pin as input*/ + if(port == PORT_A) + { + DDRA = DDRA & ~(1<<pin); + } + if(port == PORT_B) + { + DDRB = DDRB & ~(1<<pin); + } + if(port == PORT_C) + { + DDRC = DDRC & ~(1<<pin); + } + if(port == PORT_D) + { + DDRD = DDRD & ~(1<<pin); + } + } + else + {/*Set pin as output*/ + if(port == PORT_A) + { + DDRA = DDRA | (1<<pin); + } + if(port == PORT_B) + { + DDRB = DDRB | (1<<pin); + } + if(port == PORT_C) + { + DDRC = DDRC | (1<<pin); + } + if(port == PORT_D) + { + DDRD = DDRD | (1<<pin); + } + } +} + diff --git a/src/c/hardware/avr/includes/AVRPeripheralADC.h b/src/c/hardware/avr/includes/AVRPeripheralADC.h new file mode 100644 index 00000000..2a27e37d --- /dev/null +++ b/src/c/hardware/avr/includes/AVRPeripheralADC.h @@ -0,0 +1,27 @@ +//This file defines constants corresponding to gpios and digital input functions. +// +// Authors +// Siddhesh Wani +// + +#ifndef __AVRPERIPHERALADC_H__ +#define __AVRPERIPHERALADC_H__ + +#include <avr/io.h> +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//Function prototypes +uint8 u8AVRADCSetups(uint8 prescaler, uint8 adc_ref); + +uint8 u8AVRReadADCs(uint8 channel); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALGPIO_H__ */ diff --git a/src/c/hardware/avr/includes/AVRPeripheralGPIO.h b/src/c/hardware/avr/includes/AVRPeripheralGPIO.h new file mode 100644 index 00000000..9a8d2d65 --- /dev/null +++ b/src/c/hardware/avr/includes/AVRPeripheralGPIO.h @@ -0,0 +1,54 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __AVRPERIPHERALGPIO_H__ +#define __AVRPERIPHERALGPIO_H__ + +#include <avr/io.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +#include <avr/io.h> +#include "types.h" + +//Port definitions +#define PORT_A 1 +#define PORT_B 2 +#define PORT_C 3 +#define PORT_D 4 + +//Direction definitions +#define INPUT 0 +#define OUTPUT 1 + +//Pin state definitions +#define LOW 0 +#define HIGH 1 + +//Function prototypes +void u8AVRDigitalSetups(uint8 port,uint8 pin,uint8 direction); + +uint8 u8AVRDigitalIns(uint8 port,uint8 pin); + +void u8AVRDigitalOuts(uint8 port,uint8 pin,uint8 state); + +uint8 u8AVRDigitalPortSetups(uint8 port,uint8 direction); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALGPIO_H__ */ diff --git a/src/c/hardware/avr/includes/AVRPeripheralPWM.h b/src/c/hardware/avr/includes/AVRPeripheralPWM.h new file mode 100644 index 00000000..2107a5a4 --- /dev/null +++ b/src/c/hardware/avr/includes/AVRPeripheralPWM.h @@ -0,0 +1,34 @@ +//This file defines functions prototypes related to PWM. +// +// Authors +// Ashish Kamble +// + +#ifndef __AVRPERIPHERALPWM_H__ +#define __AVRPERIPHERALPWM_H__ + +#include <avr/io.h> +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//Function prototypes +uint8 u8AVRPWM0Setups(uint8 waveform_mode, uint8 output_mode); + +uint8 u8AVRPWM2Setups(uint8 waveform_mode, uint8 output_mode); + +uint8 u8AVRPWM1Setups(uint8 waveform_mode, uint8 output_mode, uint8 output_pin); + +uint8 u8AVRPWM0SetDutys(uint8 duty); + +uint8 u8AVRPWM2SetDutys(uint8 duty); + +uint8 u8AVRPWM1SetDutys(uint8 output_pin, uint16 duty, uint16 Top_Value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALPWM_H__ */ diff --git a/src/c/hardware/avr/includes/AVRPeripheralTimer.h b/src/c/hardware/avr/includes/AVRPeripheralTimer.h new file mode 100644 index 00000000..ab087692 --- /dev/null +++ b/src/c/hardware/avr/includes/AVRPeripheralTimer.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 +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __AVRPERIPHERALTIMER_H__ +#define __AVRPERIPHERALTIMER_H__ + +#include <avr/io.h> +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//Function prototypes + +uint16 u8AVRGetTimerValues(uint16 timer); + +uint8 u8AVRTimerSetups(uint8 timer, uint16 prescaler,uint8 clock_source); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALTIMER_H__ */ diff --git a/src/c/hardware/avr/includes/AVRPeripheralUART.h b/src/c/hardware/avr/includes/AVRPeripheralUART.h new file mode 100644 index 00000000..09db3b03 --- /dev/null +++ b/src/c/hardware/avr/includes/AVRPeripheralUART.h @@ -0,0 +1,59 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __AVRPERIPHERALUART_H__ +#define __AVRPERIPHERALUART_H__ + +#include <avr/io.h> +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +//Function prototypes +uint8 u8AVRUARTSetups(uint8 mode, uint32 baudrate, uint8 stopbits, uint8 parity); + +uint8 u8AVRUARTTransmits(uint8 data); + +uint8 gAVRUARTTransmits(char* msg,int size); + +uint8 u16AVRUARTTransmits(uint16 data); + +uint8 i16AVRUARTTransmits(int16 data); + +uint8 i8AVRUARTTransmits(int8 data); + +//uint8 sAVRUARTTransmits(float data); + +uint8 u8AVRUARTTransmita(uint8 *x,int size); + +//uint8 gAVRUARTTransmita(uint8 *x,int size); + +uint8 u16AVRUARTTransmita(uint16 *x,int size); + +uint8 i16AVRUARTTransmita(int16 *x,int size); + +uint8 i8AVRUARTTransmita(int8 *x,int size); + +uint8 u8AVRUSARTReceiveCharu8(); + +uint8 dAVRUARTTransmits(double data); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRUART_H__ */ + + diff --git a/src/c/hardware/avr/includes/AVRUtil.h b/src/c/hardware/avr/includes/AVRUtil.h new file mode 100644 index 00000000..55789bef --- /dev/null +++ b/src/c/hardware/avr/includes/AVRUtil.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 +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani +// Email: toolbox@scilab.in + +#ifndef __AVRUTIL_H__ +#define __AVRUTIL_H__ + +#include <avr/io.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "util/delay.h" + +uint8 u16AVRSleeps (uint16 delay); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRUTIL_H__ */ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h new file mode 100644 index 00000000..5d3a48e5 --- /dev/null +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.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 +// Organization: FOSSEE, IIT Bombay +// Aithor: Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __INT_AVRPERIPHERALADC_H__ +#define __INT_AVRPERIPHERALADC_H__ + +#include <avr/io.h> +#include "AVRPeripheralADC.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define AVRADCSetup(in1,in2) u8AVRADCSetups((uint8) in1,\ + (uint8) in2); + +#define AVRReadADC(in1) u8AVRReadADCs((uint8) in1); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALADC_H__ */ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h new file mode 100644 index 00000000..3fcbb8f5 --- /dev/null +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h @@ -0,0 +1,40 @@ + +// 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: Siddhesh Wani, Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __INT_AVRPERIPHERALGPIO_H__ +#define __INT_AVRPERIPHERALGPIO_H__ + +#include <avr/io.h> +#include "AVRPeripheralGPIO.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define AVRDigitalSetup(in1,in2,in3) u8AVRDigitalSetups((uint8) in1,\ + (uint8) in2, (uint8) in3); + +#define AVRDigitalIn(in1,in2) u8AVRDigitalIns((uint8) in1, (uint8) in2); + +#define AVRDigitalOut(in1,in2,in3) u8AVRDigitalOuts((uint8) in1,\ + (uint8) in2, (uint8) in3); + +#define AVRDigitalPortSetup(in1,in2) u8AVRDigitalPortSetups((uint8) in1,\ + (uint8) in2); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALGPIO_H__ */ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h new file mode 100644 index 00000000..5c5950bc --- /dev/null +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h @@ -0,0 +1,39 @@ +// 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: Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __INT_AVRPERIPHERALPWM_H__ +#define __INT_AVRPERIPHERALPWM_H__ + +#include <avr/io.h> +#include "AVRPeripheralPWM.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define AVRPWM0Setup(in1,in2) u8AVRPWM0Setups((uint8) in1, (uint8) in2); + +#define AVRPWM2Setup(in1,in2) u8AVRPWM2Setups((uint8) in1, (uint8) in2); + +#define AVRPWM1Setup(in1,in2,in3) u8AVRPWM1Setups((uint8) in1, (uint8) in2, (uint8) in3); + +#define AVRPWM0SetDuty(in1) u8AVRPWM0SetDutys((uint8) in1); + +#define AVRPWM2SetDuty(in1) u8AVRPWM2SetDutys((uint8) in1); + +#define AVRPWM1SetDuty(in1,in2,in3) u8AVRPWM1SetDutys((uint8) in1,(uint16) in2,(uint16) in3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALADC_H__ */ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h new file mode 100644 index 00000000..3ec6a7ec --- /dev/null +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.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 +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani, Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __INT_AVRPERIPHERALTIMER_H__ +#define __INT_AVRPERIPHERALTIMER_H__ + +#include <avr/io.h> +#include "AVRPeripheralTimer.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define AVRGetTimerValue(in1) u8AVRGetTimerValues((uint16) in1); + +#define AVRTimerSetup(in1,in2,in3) u8AVRTimerSetups((uint8) in1, (uint16) in2, (uint8) in3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALADC_H__ */ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralUART.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralUART.h new file mode 100644 index 00000000..81b4af68 --- /dev/null +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralUART.h @@ -0,0 +1,57 @@ +// 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 +// Authors: Siddhesh Wani, Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __INT_AVRPERIPHERALUART_H__ +#define __INT_AVRPERIPHERALUART_H__ + +#include <avr/io.h> +#include "AVRPeripheralUART.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define AVRUARTSetup(in1,in2,in3,in4) u8AVRUARTSetups((uint8) in1,(uint32) in2,(uint8) in3,(uint8) in4); + +#define u80AVRUARTTransmitu80(in1) u8AVRUARTTransmits((uint8) in1); + +#define g2AVRUARTTransmitu80(in1,in2) gAVRUARTTransmits((char*) in1,in2[0]*in2[1]); + +#define u160AVRUARTTransmitu80(in1) u16AVRUARTTransmits((uint16) in1); + +#define i160AVRUARTTransmitu80(in1) i16AVRUARTTransmits((int16) in1); + +#define i80AVRUARTTransmitu80(in1) i8AVRUARTTransmits((int8) in1); + +#define u82AVRUARTTransmitu80(in1,in2) u8AVRUARTTransmita((uint8) in1,in2[0]*in2[1]); + +#define d0AVRUARTTransmitu80(in1) dAVRUARTTransmits((double) in1); + +//#define g2AVRUARTTransmitu80(in1,in2) gAVRUARTTransmita((char*) in1,in2[0]*in2[1]); + +#define u162AVRUARTTransmitu80(in1,in2) u16AVRUARTTransmita((uint16) in1,in2[0]*in2[1]); + +#define i162AVRUARTTransmitu80(in1,in2) i16AVRUARTTransmita((int16) in1,in2[0]*in2[1]); + +#define i82AVRUARTTransmitu80(in1,in2) i8AVRUARTTransmita((int8) in1,in2[0]*in2[1]); + +#define u80AVRUSARTReceiveCharu80() u8AVRUSARTReceiveCharu8(); + +//#define s0AVRUARTTransmitu80(in1) sAVRUARTTransmits((float) in1); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALUART_H__ */ diff --git a/src/c/hardware/avr/interfaces/int_AVRUtil.h b/src/c/hardware/avr/interfaces/int_AVRUtil.h new file mode 100644 index 00000000..51cbce58 --- /dev/null +++ b/src/c/hardware/avr/interfaces/int_AVRUtil.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 +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani +// Email: toolbox@scilab.in + + +#ifndef __INT_AVRUTIL_H__ +#define __INT_AVRUTIL_H__ + +#include <avr/io.h> +#include "AVRUtil.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//#define d0sleepu80(in1) u16AVRSleeps ((uint16) in1); + +#define AVRSleep(in1) u16AVRSleeps ((uint16) in1); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALGPIO_H__ */ diff --git a/src/c/hardware/avr/pwm/u8AVRPWM0SetDutys.c b/src/c/hardware/avr/pwm/u8AVRPWM0SetDutys.c new file mode 100644 index 00000000..106a872e --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM0SetDutys.c @@ -0,0 +1,24 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Set Duty cycle of PWM Output generated by Timer0 at OC0 pin. + + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM0SetDutys(uint8 duty) +{ + uint8 duty_value = 0; + duty_value = (((uint16)(duty * 0xff))/100); + OCR0 = duty_value; + return 0; +} + diff --git a/src/c/hardware/avr/pwm/u8AVRPWM0Setups.c b/src/c/hardware/avr/pwm/u8AVRPWM0Setups.c new file mode 100644 index 00000000..131ee68b --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM0Setups.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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup PWM output for OC0 pin. + + +#include "AVRPeripheralPWM.h" + + +uint8 u8AVRPWM0Setups(uint8 waveform_mode, uint8 output_mode) +{ + switch(waveform_mode) + { + case 0: + TCCR0 |= (1<<WGM00); + break; + + case 1: + TCCR0 |= (1<<WGM00)|(1<<WGM01); + break; + + case 2: + TCCR0 |= (1<<WGM01); + break; + } + switch(output_mode) + { + case 0: + TCCR0 |= (1<<COM01); + break; + + case 1: + TCCR0 |= (1<<COM00)|(1<<COM01); + break; + + case 2: + TCCR0 |= (1<<COM00); + break; + } + return 0; +} + diff --git a/src/c/hardware/avr/pwm/u8AVRPWM1SetDutys.c b/src/c/hardware/avr/pwm/u8AVRPWM1SetDutys.c new file mode 100644 index 00000000..47aad1c8 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM1SetDutys.c @@ -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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Set Duty cycle and Top Value of PWM Output generated by Timer1 at OC1A or OC1B pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM1SetDutys(uint8 output_pin, uint16 duty, uint16 Top_Value) +{ + uint16 duty_value = 0; + ICR1 = Top_Value; + if(output_pin==0) + { + duty_value = (((uint16)(duty * Top_Value))/100); + OCR1A = duty_value; + } + else if(output_pin==1) + { + duty_value = (((uint16)(duty * Top_Value))/100); + OCR1B = duty_value; + } + return 0; +} diff --git a/src/c/hardware/avr/pwm/u8AVRPWM1Setups.c b/src/c/hardware/avr/pwm/u8AVRPWM1Setups.c new file mode 100644 index 00000000..b3f2d8f4 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM1Setups.c @@ -0,0 +1,69 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup PWM output for OC1A or OC1B pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM1Setups(uint8 waveform_mode, uint8 output_mode, uint8 output_pin) +{ + switch(waveform_mode) + { + case 0: + TCCR1A |= (1<<WGM11); + TCCR1B |= (1<<WGM13); + break; + + case 1: + TCCR1A |= (1<<WGM11); + TCCR1B |= (1<<WGM12)|(1<<WGM13); + break; + + case 2: + TCCR1B |= (1<<WGM12)|(1<<WGM13); + break; + } + if(output_pin==0) + { + switch(output_mode) + { + case 0: + TCCR1A |= (1<<COM1A1); + break; + + case 1: + TCCR1A |= (1<<COM1A0)|(1<<COM1A1); + break; + + case 2: + TCCR1A |= (1<<COM1A0); + break; + } + } + else if(output_pin==1) + { + switch(output_mode==0) + { + case 0: + TCCR1A |= (1<<COM1B1); + break; + + case 1: + TCCR1A |= (1<<COM1B0)|(1<<COM1B1); + break; + + case 2: + TCCR1A |= (1<<COM1B0); + break; + } + } + return 0; +} diff --git a/src/c/hardware/avr/pwm/u8AVRPWM2SetDutys.c b/src/c/hardware/avr/pwm/u8AVRPWM2SetDutys.c new file mode 100644 index 00000000..e0b53186 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM2SetDutys.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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Set Duty cycle of PWM Output generated by Timer2 at OC2 pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM2SetDutys(uint8 duty) +{ + uint8 duty_value = 0; + duty_value = (uint8)(((uint16)(duty * 0xff))/100); + OCR2 = duty_value; + return 0; +} diff --git a/src/c/hardware/avr/pwm/u8AVRPWM2Setups.c b/src/c/hardware/avr/pwm/u8AVRPWM2Setups.c new file mode 100644 index 00000000..f5f87672 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM2Setups.c @@ -0,0 +1,47 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup PWM output for OC2 pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM2Setups(uint8 waveform_mode, uint8 output_mode) +{ + switch(waveform_mode) + { + case 0: + TCCR2 |= (1<<WGM20); + break; + + case 1: + TCCR2 |= (1<<WGM20)|(1<<WGM21); + break; + + case 2: + TCCR2 |= (1<<WGM21); + break; + } + switch(output_mode) + { + case 0: + TCCR2 |= (1<<COM21); + break; + + case 1: + TCCR2 |= (1<<COM20)|(1<<COM21); + break; + + case 2: + TCCR2 |= (1<<COM20); + break; + } + return 0; +} diff --git a/src/c/hardware/avr/timer/u16AVRGetTimerValues.c b/src/c/hardware/avr/timer/u16AVRGetTimerValues.c new file mode 100644 index 00000000..8ef16e8d --- /dev/null +++ b/src/c/hardware/avr/timer/u16AVRGetTimerValues.c @@ -0,0 +1,51 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function selects the clock source and timer with prescaler. + + +#include "AVRPeripheralTimer.h" +#include <avr/interrupt.h> + + +uint16 u8AVRGetTimerValues(uint16 timer) +{ + uint16_t x; + switch(timer) + { + case 0: + { + x = TCNT0; + break; + } + + case 1: + { + unsigned char sreg; + unsigned int val; + sreg = SREG; + cli(); + val = TCNT1; + SREG = sreg; + sei(); + x = val; + break; + } + + case 2: + { + x = TCNT2; + break; + } + } +return x; +} + diff --git a/src/c/hardware/avr/timer/u8AVRGetTimerValues.c b/src/c/hardware/avr/timer/u8AVRGetTimerValues.c new file mode 100644 index 00000000..e08bb3a6 --- /dev/null +++ b/src/c/hardware/avr/timer/u8AVRGetTimerValues.c @@ -0,0 +1,63 @@ +// 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 +// Email: toolbox@scilab.in + + +// Function to get timer count +// +// Calling Sequence +// u8AVRGetTimerValues(timer) +// +// Parameters +// timer: timer whose current count is to be returned (0,1,2) +// ***Refer datasheet for more description about timer +// +// Description +// This function returns the count of timer specified +// +// +// Authors +// Ashish Kamble +// + + +#include "AVRPeripheralTimer.h" +#include <avr/interrupt.h> + + +uint16 u8AVRGetTimerValues(uint16 timer) +{ uint16_t x; + switch(timer) + { + case 0: + { + x = TCNT0; + break; + } + case 1: + { + unsigned char sreg; + unsigned int val; + sreg = SREG; + cli(); + val = TCNT1; + SREG = sreg; + sei(); + x = val; + break; + } + case 2: + { + x = TCNT2; + break; + } + } +return x; +} + diff --git a/src/c/hardware/avr/timer/u8AVRTimerSetups.c b/src/c/hardware/avr/timer/u8AVRTimerSetups.c new file mode 100644 index 00000000..6ee8d2af --- /dev/null +++ b/src/c/hardware/avr/timer/u8AVRTimerSetups.c @@ -0,0 +1,110 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function selects the clock source and timer with prescaler. + +#include "AVRPeripheralTimer.h" + +uint8 u8AVRTimerSetups(uint8 timer,uint16 prescaler,uint8 clock_source) +{ + + if(clock_source==0) + { + if(timer==0) + { + switch(prescaler) + { + case 1: TCCR0 |= (1<<CS00); + TCNT0 = 0x00; + case 8: TCCR0 |= (1<<CS01); + TCNT0 = 0x00; + case 64: TCCR0 |= (1<<CS00)|(1<<CS01); + TCNT0 = 0x00; + case 256: TCCR0 |= (1<<CS02); + TCNT0 = 0x00; + case 1024: TCCR0 |= (1<<CS00)|(1<<CS02); + TCNT0 = 0x00; + } + } + else if(timer==2) + { + switch(prescaler) + { + case 1: TCCR2 |= (1<<CS20); + TCNT2 = 0x00; + case 8: TCCR2 |= (1<<CS21); + TCNT2 = 0x00; + case 64: TCCR2 |= (1<<CS20)|(1<<CS21); + TCNT2 = 0x00; + case 256: TCCR2 |= (1<<CS22); + TCNT2 = 0x00; + case 1024: TCCR2 |= (1<<CS20)|(1<<CS22); + TCNT2 = 0x00; + } + } + else if(timer==1) + { + switch(prescaler) + { + case 1: TCCR1B |= (1<<CS10); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 8: TCCR1B |= (1<<CS11); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 64: TCCR1B |= (1<<CS10)|(1<<CS11); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 256: TCCR1B |= (1<<CS12); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 1024: TCCR1B |= (1<<CS10)|(1<<CS12); + TCNT1H = 0x00; + TCNT1L = 0x00; + } + } + } + else if(clock_source==1) + { + if(timer==0) + { + TCCR0 |= (1<<CS00)|(1<<CS01)|(1<<CS02); + TCNT0 = 0x00; + } + else if(timer==2) + { + TCCR2 |= (1<<CS20)|(1<<CS21)|(1<<CS22); + TCNT2 = 0x00; + } + else if(timer==1) + { + TCCR1B |= (1<<CS10)|(1<<CS11)|(1<<CS12); + TCNT1H = 0x00; + TCNT1L = 0x00; + } + } + return 0; +} + + + + + + + + + + + + + + + diff --git a/src/c/hardware/avr/uart/dAVRUARTTransmits.c b/src/c/hardware/avr/uart/dAVRUARTTransmits.c new file mode 100644 index 00000000..ec63c4de --- /dev/null +++ b/src/c/hardware/avr/uart/dAVRUARTTransmits.c @@ -0,0 +1,88 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Not Tested// +#include "AVRPeripheralUART.h" +#include<math.h> + + +uint8 dAVRUARTTransmits(double data) +{ + //Extract integer part + long int intpart = (long int)data; + //Extract double part + //double floatpart = data - (double)intpart; + char* str; + int i = 0; + while(intpart) + { + str[i] = (intpart%10) + '0'; + intpart = intpart/10; + i++; + } + str[i]='\0'; + /* + int j = 0; + int k = i-1; + char temp; + while(j<k) + { + temp = str[j]; + str[j] = str[k]; + str[k] = temp; + j++; + k--; + } +*/ + + + /* + char* strfloat; + floatpart = floatpart*1000000000; + int l = 0; + while(floatpart) + { + strfloat[l] = ((unsigned int)floatpart%10) + '0'; + floatpart = floatpart/10; + l++; + } + while(*strfloat!='\0') + { + str[i+1] = strfloat[l-1]; + i++; + l--; + } + */ + + while(*str!='\0') + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = *str; // Put data into buffer, sends the data + str++; + } + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + + + + + + + + + + + + diff --git a/src/c/hardware/avr/uart/dAVRUARTTransmitu8.c b/src/c/hardware/avr/uart/dAVRUARTTransmitu8.c new file mode 100644 index 00000000..8978cc00 --- /dev/null +++ b/src/c/hardware/avr/uart/dAVRUARTTransmitu8.c @@ -0,0 +1,21 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Char. + + +#include "AVRPeripheralUART.h" + +uint8 dAVRUARTTransmitu8(uint8 data) +{ + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = data; // Put data into buffer, sends the data +} diff --git a/src/c/hardware/avr/uart/gAVRUARTTransmita.c b/src/c/hardware/avr/uart/gAVRUARTTransmita.c new file mode 100644 index 00000000..fea9319d --- /dev/null +++ b/src/c/hardware/avr/uart/gAVRUARTTransmita.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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit String. + + +#include "AVRPeripheralUART.h" + + +uint8 gAVRUARTTransmita(uint8 *x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + gAVRUARTTransmits(x[i]); + } + return 0; +} diff --git a/src/c/hardware/avr/uart/gAVRUARTTransmits.c b/src/c/hardware/avr/uart/gAVRUARTTransmits.c new file mode 100644 index 00000000..502f2727 --- /dev/null +++ b/src/c/hardware/avr/uart/gAVRUARTTransmits.c @@ -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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit String. + + +#include "AVRPeripheralUART.h" + + +uint8 gAVRUARTTransmits(char* msg,int size) +{ + while(*msg!='\0') + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = *msg; // Put data into buffer, sends the data + msg++; + } +while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} diff --git a/src/c/hardware/avr/uart/gAVRUARTTransmitu8.c b/src/c/hardware/avr/uart/gAVRUARTTransmitu8.c new file mode 100644 index 00000000..f3384068 --- /dev/null +++ b/src/c/hardware/avr/uart/gAVRUARTTransmitu8.c @@ -0,0 +1,24 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit String. + + +#include "AVRPeripheralUART.h" + +uint8 gAVRUARTTransmitu8(uint8 *msg) +{ + while(*msg!='\0') + { + AVRUARTTransmitChar(*msg); + msg++; + } +} diff --git a/src/c/hardware/avr/uart/i16AVRUARTTransmita.c b/src/c/hardware/avr/uart/i16AVRUARTTransmita.c new file mode 100644 index 00000000..8d0fcd47 --- /dev/null +++ b/src/c/hardware/avr/uart/i16AVRUARTTransmita.c @@ -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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i16AVRUARTTransmita(int16 *x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + i16AVRUARTTransmits(x[i]); + } + return 0; +} + + diff --git a/src/c/hardware/avr/uart/i16AVRUARTTransmits.c b/src/c/hardware/avr/uart/i16AVRUARTTransmits.c new file mode 100644 index 00000000..4d907762 --- /dev/null +++ b/src/c/hardware/avr/uart/i16AVRUARTTransmits.c @@ -0,0 +1,73 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + + +uint8 i16AVRUARTTransmits(int16 data) +{ + uint8 temp1; + uint8 temp2; + uint8 temp3; + uint8 temp4; + uint8 temp5; + if(data<0) + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (45); // Put data into buffer, sends the data + } + data = abs(data); + temp1 = data/10000; + if(temp1==0); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp1); // Put data into buffer, sends the data + } + data = data % 10000; + temp2 = data/1000; + if((temp1==0)&(temp2==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp2); // Put data into buffer, sends the data + } + data = data % 1000; + temp3 = data/100; + if((temp1==0)&(temp2==0)&(temp3==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp3); // Put data into buffer, sends the data + } + data = data % 100; + temp4 = data/10; + if((temp1==0)&(temp2==0)&(temp3==0)&(temp4==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp4); // Put data into buffer, sends the data + } + temp5 = data % 10; + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp5); // Put data into buffer, sends the data + + + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + diff --git a/src/c/hardware/avr/uart/i16AVRUARTTransmitu8.c b/src/c/hardware/avr/uart/i16AVRUARTTransmitu8.c new file mode 100644 index 00000000..99638c77 --- /dev/null +++ b/src/c/hardware/avr/uart/i16AVRUARTTransmitu8.c @@ -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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i16AVRUARTTransmitu8(int16 data) +{ + uint16 temp1; + uint16 temp2; + temp1 = abs(data)/100; + if(data<0) + AVRUARTTransmitChar(45); + AVRUARTTransmitChar(48+temp1); + temp1 = abs(data) - temp1*100; + temp2 = temp1; + temp1 = temp1/10; + AVRUARTTransmitChar(48+temp1); + temp2 = temp2 - temp1*10; + AVRUARTTransmitChar(48+temp2); +} diff --git a/src/c/hardware/avr/uart/i8AVRUARTTransmita.c b/src/c/hardware/avr/uart/i8AVRUARTTransmita.c new file mode 100644 index 00000000..10345738 --- /dev/null +++ b/src/c/hardware/avr/uart/i8AVRUARTTransmita.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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i8AVRUARTTransmita(int8 *x,int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + i8AVRUARTTransmits(x[i]); + } + return 0; +} diff --git a/src/c/hardware/avr/uart/i8AVRUARTTransmits.c b/src/c/hardware/avr/uart/i8AVRUARTTransmits.c new file mode 100644 index 00000000..6b8c20fb --- /dev/null +++ b/src/c/hardware/avr/uart/i8AVRUARTTransmits.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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i8AVRUARTTransmits(int8 data) +{ + uint8 temp1; + temp1 = abs(data); + if(data<0) + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (45); // Put data into buffer, sends the data + u8AVRUARTTransmits(temp1); + return 0; +} diff --git a/src/c/hardware/avr/uart/u16AVRUARTTransmita.c b/src/c/hardware/avr/uart/u16AVRUARTTransmita.c new file mode 100644 index 00000000..8b8e6301 --- /dev/null +++ b/src/c/hardware/avr/uart/u16AVRUARTTransmita.c @@ -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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Unsigned Integer Values. + +#include "AVRPeripheralUART.h" + +uint8 u16AVRUARTTransmita(uint16 *x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + u16AVRUARTTransmits(x[i]); + } + return 0; +} + + + + diff --git a/src/c/hardware/avr/uart/u16AVRUARTTransmits.c b/src/c/hardware/avr/uart/u16AVRUARTTransmits.c new file mode 100644 index 00000000..3cfb4a27 --- /dev/null +++ b/src/c/hardware/avr/uart/u16AVRUARTTransmits.c @@ -0,0 +1,87 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Unsigned Integer Values. + +#include "AVRPeripheralUART.h" + +uint8 u16AVRUARTTransmits(uint16 data) +{ + uint8 temp1; + uint8 temp2; + uint8 temp3; + uint8 temp4; + uint8 temp5; + temp1 = data/10000; + if(temp1==0); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp1); // Put data into buffer, sends the data + } + data = data % 10000; + temp2 = data/1000; + if((temp1==0)&(temp2==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp2); // Put data into buffer, sends the data + } + data = data % 1000; + temp3 = data/100; + if((temp1==0)&(temp2==0)&(temp3==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp3); // Put data into buffer, sends the data + } + data = data % 100; + temp4 = data/10; + if((temp1==0)&(temp2==0)&(temp3==0)&(temp4==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp4); // Put data into buffer, sends the data + } + temp5 = data % 10; + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp5); // Put data into buffer, sends the data + + + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/c/hardware/avr/uart/u16AVRUARTTransmitu8.c b/src/c/hardware/avr/uart/u16AVRUARTTransmitu8.c new file mode 100644 index 00000000..a68a5aa9 --- /dev/null +++ b/src/c/hardware/avr/uart/u16AVRUARTTransmitu8.c @@ -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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Unsigned Integer Values. + +#include "AVRPeripheralUART.h" + +uint8 u16AVRUARTTransmitu8(uint16 data) +{ + uint8 temp1; + uint8 temp2; + uint8 temp3; + uint8 temp4; + temp1 = data/10000; + dAVRUARTTransmitu8(48+temp1); + temp1 = data - temp1*10000; + temp2 = temp1; + temp1 = temp1/1000; + dAVRUARTTransmitu8(48+temp1); + temp1 = temp2 - temp1*1000; + temp3 = temp1; + temp1 = temp1/100; + dAVRUARTTransmitu8(48+temp1); + temp1 = temp3 - temp1*100; + temp4 = temp1; + temp1 = temp1/10; + dAVRUARTTransmitu8(48+temp1); + temp1 = temp4 - temp1*10; + dAVRUARTTransmitu8(48+temp1); +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTReceiveCharu8.c b/src/c/hardware/avr/uart/u8AVRUARTReceiveCharu8.c new file mode 100644 index 00000000..df0a55b7 --- /dev/null +++ b/src/c/hardware/avr/uart/u8AVRUARTReceiveCharu8.c @@ -0,0 +1,20 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Receive Char. + +#include "AVRPeripheralUART.h" + +uint8 u8AVRUSARTReceiveCharu8() +{ + while ( !(UCSRA & (1<<RXC)) ) ; // Wait for data to be received + return UDR; // Get and return received data from buffer +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTSetups.c b/src/c/hardware/avr/uart/u8AVRUARTSetups.c new file mode 100644 index 00000000..085ac6e3 --- /dev/null +++ b/src/c/hardware/avr/uart/u8AVRUARTSetups.c @@ -0,0 +1,143 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup Serial communication for ATmega16. + + +#include "AVRPeripheralUART.h" + +uint8 u8AVRUARTSetups(uint8 mode, uint32 baudrate, uint8 stopbits, uint8 parity) +{ +//Enable UART and USART + UCSRC |= (1<<URSEL); + UCSRB |= (1<<TXEN)|(1<<RXEN); + + switch (mode) //According to mode set bits UMSEL and U2X +{ + case 0: //Normal mode + UCSRC &= ~(1<<UMSEL); //Clear bit 6 UMSEL and U2X=0 + UCSRA &= ~(1<<U2X); + UCSRC &= ~(1<<UCPOL); // Clock polarity bit + break; + + case 1: //Double speed mode + UCSRC &= ~(1<<UMSEL); //Clear bit 6 UMSEL and U2X=1 + UCSRA |= (1<<U2X); + UCSRC &= ~(1<<UCPOL); //Clock polarity bit + break; + + case 2: //Synchronous mode + UCSRC |= (1<<UMSEL); //Set bit 6 UMSEL and set clock polarity + UCSRC |= (1<<UCPOL); + break; +} + +//Set stop bits +if(stopbits == 0) +{ + UCSRC &= ~(1<<USBS); // 1 stopbit +} +else UCSRC |= (1<<USBS); //2 stopbits + +//Set parity bit settings +switch(parity) +{ + case 0: // Parity disabled + UCSRC &= ~(1<<UPM1); //UPM1:0=0 + UCSRC &= ~(1<<UPM0); + break; + + case 1: // Even parity + UCSRC |= (1<<UPM1); //UPM1:0 = 2 + UCSRC &= ~(1<<UPM0); + break; + + case 2: // Odd parity + UCSRC |= (1<<UPM1); //UPM1:1 = 3 + UCSRC |= (1<<UPM0); + break; +} + +//Set baudrate +UCSRC &= ~(1<<URSEL); +switch(baudrate) +{ + case 2400: + UBRRL = 0xA0; + UBRRH = 0x01; + break; + + case 4800: + UBRRL = 0xCF; + UBRRH = 0x00; + break; + + case 9600: + UBRRL = 0x67; + UBRRH = 0x00; + break; + + case 14400: + UBRRL = 0x44; + UBRRH = 0x00; + break; + + case 19200: + UBRRL = 0x33; + UBRRH = 0x00; + break; + + case 28800: + UBRRL = 0x22; + UBRRH = 0x00; + break; + + case 38400: + UBRRL = 0x19; + UBRRH = 0x00; + break; + + case 57600: + UBRRL = 0x10; + UBRRH = 0x00; + break; + + case 768000: + UBRRL = 0x0C; + UBRRH = 0x00; + break; + + case 115200: + UBRRL = 0x08; + UBRRH = 0x00; + break; + + case 230400: + UBRRL = 0x03; + UBRRH = 0x00; + break; + + case 250000: + UBRRL = 0x03; + UBRRH = 0x00; + break; + + case 1000000: + UBRRL = 0x00; + UBRRH = 0x00; + break; +} + +//Set data format +UCSRC|= (1<<URSEL)|(1<<UCSZ0)|(1<<UCSZ1); + + return 0; +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTTransmita.c b/src/c/hardware/avr/uart/u8AVRUARTTransmita.c new file mode 100644 index 00000000..14e2a0ea --- /dev/null +++ b/src/c/hardware/avr/uart/u8AVRUARTTransmita.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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Char. + + +#include "AVRPeripheralUART.h" + + +uint8 u8AVRUARTTransmita(uint8* x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + u8AVRUARTTransmits(x[i]); + } + return 0; +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTTransmits.c b/src/c/hardware/avr/uart/u8AVRUARTTransmits.c new file mode 100644 index 00000000..e7e5c716 --- /dev/null +++ b/src/c/hardware/avr/uart/u8AVRUARTTransmits.c @@ -0,0 +1,60 @@ +/* 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: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Char. + + +#include "AVRPeripheralUART.h" + +uint8 u8AVRUARTTransmits(uint8 data) +{ + uint8 temp1; + uint8 temp2; + temp1 = data; + data = data/100; + if(data==0); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+data); // Put data into buffer, sends the data + } + temp1 = temp1 - data*100; + temp2 = temp1; + temp1 = temp1/10; + if((data==0)&(temp1==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp1); // Put data into buffer, sends the data + } + temp2 = temp2 - temp1*10; + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp2); // Put data into buffer, sends the data + + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + + + + + + + + + + + + + diff --git a/src/c/hardware/avr/util/u16AVRSleeps.c b/src/c/hardware/avr/util/u16AVRSleeps.c new file mode 100644 index 00000000..9fbd512d --- /dev/null +++ b/src/c/hardware/avr/util/u16AVRSleeps.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: Siddhesh Wani + Email: toolbox@scilab.in +*/ +//Function to introduce specific delay in milliseconds + +#include "AVRUtil.h" + +uint8 u16AVRSleeps (uint16 delay) +{ + _delay_ms(delay); + + return 0; +} diff --git a/src/c/hardware/rasberrypi/Digital/RPI_digitalReadByte.c b/src/c/hardware/rasberrypi/Digital/RPI_digitalReadByte.c new file mode 100644 index 00000000..70fb6858 --- /dev/null +++ b/src/c/hardware/rasberrypi/Digital/RPI_digitalReadByte.c @@ -0,0 +1,21 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralDigital.h" + +/* Function to read the state of the first eight gpio pins */ + +uint8 RPI_digitalReadByte(){ + uint8 state=0; + state=digitalReadByte(); + return (state); +} diff --git a/src/c/hardware/rasberrypi/Digital/u8RPI_digitalReads.c b/src/c/hardware/rasberrypi/Digital/u8RPI_digitalReads.c new file mode 100644 index 00000000..05594066 --- /dev/null +++ b/src/c/hardware/rasberrypi/Digital/u8RPI_digitalReads.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralDigital.h" + +/* Function to read the state of a gpio pin */ + +uint8 u8RPI_digitalReads(uint8 pin){ + uint8 state=0; + state=digitalRead(pin); + return (state); +} diff --git a/src/c/hardware/rasberrypi/Digital/u8RPI_digitalWriteBytes.c b/src/c/hardware/rasberrypi/Digital/u8RPI_digitalWriteBytes.c new file mode 100644 index 00000000..6d0e4cdd --- /dev/null +++ b/src/c/hardware/rasberrypi/Digital/u8RPI_digitalWriteBytes.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralDigital.h" + +/* Function to change the output state of the first eight gpio pins */ + +void u8RPI_digitalWriteBytes(uint8 value){ + digitalWriteByte(value); +} diff --git a/src/c/hardware/rasberrypi/Digital/u8RPI_digitalWrites.c b/src/c/hardware/rasberrypi/Digital/u8RPI_digitalWrites.c new file mode 100644 index 00000000..02dce554 --- /dev/null +++ b/src/c/hardware/rasberrypi/Digital/u8RPI_digitalWrites.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralDigital.h" + +/* Function to change the output state of the gpio pin */ + +void u8RPI_digitalWrites(uint8 pin, uint8 state){ + if (state == 0) /*low output*/ + digitalWrite(pin,0); + else if (state == 1) /*high output*/ + digitalWrite(pin,1); +} diff --git a/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReadReg16s.c b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReadReg16s.c new file mode 100644 index 00000000..5d04f4b0 --- /dev/null +++ b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReadReg16s.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralI2C.h" + +int8 u16RPI_I2CReadReg16s(uint16 fd,uint16 reg){ + int8 out; + out=wiringPiI2CReadReg16(fd,reg); + return (out); +} diff --git a/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReadReg8s.c b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReadReg8s.c new file mode 100644 index 00000000..2f4f1f74 --- /dev/null +++ b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReadReg8s.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralI2C.h" + +int8 u16RPI_I2CReadReg8s(uint16 fd,uint16 reg){ + int8 out; + out=wiringPiI2CReadReg8(fd,reg); + return (out); +} diff --git a/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReads.c b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReads.c new file mode 100644 index 00000000..49c36737 --- /dev/null +++ b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CReads.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralI2C.h" + +int8 u16RPI_I2CReads(uint16 fd){ + int8 out; + out=wiringPiI2CRead(fd); + return (out); +} diff --git a/src/c/hardware/rasberrypi/I2C/u16RPI_I2CSetups.c b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CSetups.c new file mode 100644 index 00000000..f533a1f2 --- /dev/null +++ b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CSetups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralI2C.h" + +int8 u16RPI_I2CSetups(uint8 arrd){ + int8 out; + out=wiringPiI2CSetup(arrd); + return (out); +} diff --git a/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWriteReg16s.c b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWriteReg16s.c new file mode 100644 index 00000000..b30c106f --- /dev/null +++ b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWriteReg16s.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralI2C.h" + +int8 u16RPI_I2CWriteReg16s(uint16 fd,uint16 data,uint16 reg){ + int8 out; + out=wiringPiI2CWriteReg16(fd,data,reg); + return (out); +} diff --git a/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWriteReg8s.c b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWriteReg8s.c new file mode 100644 index 00000000..d2ebf3d9 --- /dev/null +++ b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWriteReg8s.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralI2C.h" + +int8 u16RPI_I2CWriteReg8s(uint16 fd,uint16 data,uint16 reg){ + int8 out; + out=wiringPiI2CWriteReg8(fd,data,reg); + return (out); +} diff --git a/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWrites.c b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWrites.c new file mode 100644 index 00000000..133ed659 --- /dev/null +++ b/src/c/hardware/rasberrypi/I2C/u16RPI_I2CWrites.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralI2C.h" + +int8 u16RPI_I2CWrites(uint16 fd,uint16 data){ + int8 out; + wiringPiI2CWrite(fd,data); + return (out); +} diff --git a/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c b/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c new file mode 100644 index 00000000..ab15b8de --- /dev/null +++ b/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.c @@ -0,0 +1,44 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralInterrupt.h" +#include "RPI_wfi.h" +#include <sys/time.h> +#include <math.h> +#include <stdlib.h> + +int8 u8RPI_waitForInterrupts(uint8 pin,int16 time){ + __RPI_wfi=0; + if (wiringPiISR(pin,3,&RPI_wfi)<0){ + return -1; + } + if (time==-1){ + while (__RPI_wfi==0){;} + return 1; + } + else{ + struct timeval time1,time2; + int nDigits; + double t1,t2; + gettimeofday(&time1, NULL); + nDigits=floor(log10(abs(time1.tv_usec)))+1; + t1=time1.tv_sec+time1.tv_usec/nDigits; + t2=t1; + while (__RPI_wfi==0 && t2-t1<time){ + gettimeofday(&time2,NULL); + nDigits=floor(log10(abs(time2.tv_usec)))+1; + t2=time2.tv_sec+time2.tv_usec/nDigits; + } + if (__RPI_wfi==0){return 0;} + else{return 1;} + } +} diff --git a/src/c/hardware/rasberrypi/Misc/RPI_boardRev.c b/src/c/hardware/rasberrypi/Misc/RPI_boardRev.c new file mode 100644 index 00000000..c8ecf705 --- /dev/null +++ b/src/c/hardware/rasberrypi/Misc/RPI_boardRev.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMisc.h" + +uint8 RPI_boardRev(){ + uint8 out; + out=piBoardRev(); + return out; +} diff --git a/src/c/hardware/rasberrypi/Misc/u16RPI_sn3218Setups.c b/src/c/hardware/rasberrypi/Misc/u16RPI_sn3218Setups.c new file mode 100644 index 00000000..ab229907 --- /dev/null +++ b/src/c/hardware/rasberrypi/Misc/u16RPI_sn3218Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMisc.h" + +int8 u16RPI_sn3218Setups(uint16 pinBase){ + int8 out; + out=sn3218Setup(pinBase); + return (out); +} diff --git a/src/c/hardware/rasberrypi/Misc/u8RPI_padDrives.c b/src/c/hardware/rasberrypi/Misc/u8RPI_padDrives.c new file mode 100644 index 00000000..ce13e08a --- /dev/null +++ b/src/c/hardware/rasberrypi/Misc/u8RPI_padDrives.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMisc.h" + +void u8RPI_padDrives(uint8 group,uint8 strength){ + setPadDrive(group,strength); +} diff --git a/src/c/hardware/rasberrypi/Serial/gRPI_serialOpena.c b/src/c/hardware/rasberrypi/Serial/gRPI_serialOpena.c new file mode 100644 index 00000000..31543afe --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/gRPI_serialOpena.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +int8 gRPI_serialOpena(char* device,int size,uint32 baud){ + int8 fd; + fd = serialOpen(device,baud); + return fd; +} diff --git a/src/c/hardware/rasberrypi/Serial/u8RPI_serialCloses.c b/src/c/hardware/rasberrypi/Serial/u8RPI_serialCloses.c new file mode 100644 index 00000000..d20aa541 --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/u8RPI_serialCloses.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +void u8RPI_serialCloses(uint8 fd){ + serialClose(fd); +} diff --git a/src/c/hardware/rasberrypi/Serial/u8RPI_serialDataAvails.c b/src/c/hardware/rasberrypi/Serial/u8RPI_serialDataAvails.c new file mode 100644 index 00000000..cf256070 --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/u8RPI_serialDataAvails.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +uint8 u8RPI_serialDataAvails(uint8 fd){ + uint8 out; + out=serialDataAvail(fd); + return(out); +} diff --git a/src/c/hardware/rasberrypi/Serial/u8RPI_serialFlushs.c b/src/c/hardware/rasberrypi/Serial/u8RPI_serialFlushs.c new file mode 100644 index 00000000..4d150637 --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/u8RPI_serialFlushs.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +void u8RPI_serialFlushs(uint8 fd){ + serialFlush(fd); +} diff --git a/src/c/hardware/rasberrypi/Serial/u8RPI_serialGetchars.c b/src/c/hardware/rasberrypi/Serial/u8RPI_serialGetchars.c new file mode 100644 index 00000000..c1dabfd1 --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/u8RPI_serialGetchars.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +void u8RPI_serialGetchars(uint8 fd,char* out){ + out=serialGetchar(fd); +} diff --git a/src/c/hardware/rasberrypi/Serial/u8RPI_serialPrintfs.c b/src/c/hardware/rasberrypi/Serial/u8RPI_serialPrintfs.c new file mode 100644 index 00000000..d1672003 --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/u8RPI_serialPrintfs.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +void u8RPI_serialPrintfs(uint8 fd,char* msg,int size){ + serialPrintf(fd,msg); +} diff --git a/src/c/hardware/rasberrypi/Serial/u8RPI_serialPutchars.c b/src/c/hardware/rasberrypi/Serial/u8RPI_serialPutchars.c new file mode 100644 index 00000000..3309317e --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/u8RPI_serialPutchars.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +void u8RPI_serialPutchars(uint8 fd,uint8 character){ + serialPutchar(fd,character); +} diff --git a/src/c/hardware/rasberrypi/Serial/u8RPI_serialPutss.c b/src/c/hardware/rasberrypi/Serial/u8RPI_serialPutss.c new file mode 100644 index 00000000..581e15ac --- /dev/null +++ b/src/c/hardware/rasberrypi/Serial/u8RPI_serialPutss.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSerial.h" + +void u8RPI_serialPutss(uint8 fd,char* character,int size){ + serialPuts(fd,character); +} diff --git a/src/c/hardware/rasberrypi/Setup/gRPI_pinNumberinga.c b/src/c/hardware/rasberrypi/Setup/gRPI_pinNumberinga.c new file mode 100644 index 00000000..4170f4c1 --- /dev/null +++ b/src/c/hardware/rasberrypi/Setup/gRPI_pinNumberinga.c @@ -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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSetup.h" +#include "stdio.h" + +int8 gRPI_pinNumberinga(char* seq,int size){ + uint8 out; + if (seq[0]=='w'){ + out=wiringPiSetup(); + } + else if (seq[0]=='G'){ + out=wiringPiSetupGpio(); + } + else if (seq[0]=='P'){ + out=wiringPiSetupPhys(); + } + return (out); +} diff --git a/src/c/hardware/rasberrypi/Setup/u8RPI_getAlts.c b/src/c/hardware/rasberrypi/Setup/u8RPI_getAlts.c new file mode 100644 index 00000000..0a5c4764 --- /dev/null +++ b/src/c/hardware/rasberrypi/Setup/u8RPI_getAlts.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSetup.h" + +uint8 u8RPI_getAlts(uint8 pin){ + uint8 out; + out=getAlt(pin); + return (out); +} diff --git a/src/c/hardware/rasberrypi/Setup/u8RPI_pinModeAlts.c b/src/c/hardware/rasberrypi/Setup/u8RPI_pinModeAlts.c new file mode 100644 index 00000000..153b88ee --- /dev/null +++ b/src/c/hardware/rasberrypi/Setup/u8RPI_pinModeAlts.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSetup.h" + +void u8RPI_pinModeAlts(uint8 pin,uint8 mode){ + pinModeAlt(pin,mode); +} diff --git a/src/c/hardware/rasberrypi/Setup/u8RPI_pinModes.c b/src/c/hardware/rasberrypi/Setup/u8RPI_pinModes.c new file mode 100644 index 00000000..76601f8d --- /dev/null +++ b/src/c/hardware/rasberrypi/Setup/u8RPI_pinModes.c @@ -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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include "types.h" +#include "RPIPeripheralSetup.h" + +void u8RPI_pinModes(uint8 pin,char* mode,int size){ + if (mode[0]=='i'){ + pinMode(pin,INPUT); + } + else if (mode[0]=='o'){ + pinMode(pin,OUTPUT); + } + else if (mode[0]=='p'){ + pinMode(pin,PWM_OUTPUT); + } + else if (mode[0]=='c'){ + pinMode(pin,GPIO_CLOCK); + } + +} diff --git a/src/c/hardware/rasberrypi/Setup/u8RPI_pullControls.c b/src/c/hardware/rasberrypi/Setup/u8RPI_pullControls.c new file mode 100644 index 00000000..4e95aac5 --- /dev/null +++ b/src/c/hardware/rasberrypi/Setup/u8RPI_pullControls.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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSetup.h" + +void u8RPI_pullControls(uint8 pin,char* mode,int size){ + if (mode[0]=='d'){ + pullUpDnControl(pin,1); + } + else if (mode[0]=='u'){ + pullUpDnControl(pin,2); + } + else if (mode[0]=='o'){ + pullUpDnControl(pin,0); + } +} diff --git a/src/c/hardware/rasberrypi/Shift/u16RPI_sr595Setups.c b/src/c/hardware/rasberrypi/Shift/u16RPI_sr595Setups.c new file mode 100644 index 00000000..3f0a6493 --- /dev/null +++ b/src/c/hardware/rasberrypi/Shift/u16RPI_sr595Setups.c @@ -0,0 +1,20 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralShift.h" + +int8 u16RPI_sr595Setups(uint16 pinBase,uint8 nPins,uint8 dP,uint8 cP,uint8 lP) +{ + int8 out; + out=sr595Setup(pinBase,nPins,dP,cP,lP); + return (out); +} diff --git a/src/c/hardware/rasberrypi/Shift/u8RPI_shiftIns.c b/src/c/hardware/rasberrypi/Shift/u8RPI_shiftIns.c new file mode 100644 index 00000000..6a264b6a --- /dev/null +++ b/src/c/hardware/rasberrypi/Shift/u8RPI_shiftIns.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralShift.h" + +uint8 u8RPI_shiftIns(uint8 dpin,uint8 cpin,uint8 order){ + uint8 out; + out=shiftIn(dpin,cpin,order); + return out; +} diff --git a/src/c/hardware/rasberrypi/Shift/u8RPI_shiftOuts.c b/src/c/hardware/rasberrypi/Shift/u8RPI_shiftOuts.c new file mode 100644 index 00000000..5d24c2b9 --- /dev/null +++ b/src/c/hardware/rasberrypi/Shift/u8RPI_shiftOuts.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralShift.h" + +void u8RPI_shiftOuts(uint8 dpin,uint8 cpin,uint8 order,uint8 val){ + shiftOut(dpin,cpin,order,val); +} diff --git a/src/c/hardware/rasberrypi/Timing/RPI_micros.c b/src/c/hardware/rasberrypi/Timing/RPI_micros.c new file mode 100644 index 00000000..a7a84503 --- /dev/null +++ b/src/c/hardware/rasberrypi/Timing/RPI_micros.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralTiming.h" + +/* Function to get time in microsecond since first setup function called */ + +uint32 RPI_micros(){ + uint32 out; + out=micros(); + return (out); +} diff --git a/src/c/hardware/rasberrypi/Timing/RPI_millis.c b/src/c/hardware/rasberrypi/Timing/RPI_millis.c new file mode 100644 index 00000000..b383f2a9 --- /dev/null +++ b/src/c/hardware/rasberrypi/Timing/RPI_millis.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralTiming.h" + +/* Function to get time in millisecond since first setup function called */ + +uint32 RPI_millis(){ + uint32 out; + out=millis(); + return (out); +} diff --git a/src/c/hardware/rasberrypi/Timing/u32RPI_delayMicros.c b/src/c/hardware/rasberrypi/Timing/u32RPI_delayMicros.c new file mode 100644 index 00000000..1ffdda7e --- /dev/null +++ b/src/c/hardware/rasberrypi/Timing/u32RPI_delayMicros.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralTiming.h" + +/* Function to insert some delay in code execution. */ + +void u32RPI_delayMicros(uint32 time){ + delayMicroseconds(time); +} diff --git a/src/c/hardware/rasberrypi/Timing/u32RPI_delays.c b/src/c/hardware/rasberrypi/Timing/u32RPI_delays.c new file mode 100644 index 00000000..7802d6bf --- /dev/null +++ b/src/c/hardware/rasberrypi/Timing/u32RPI_delays.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralTiming.h" + +/* Function to insert some delay in code execution. */ + +void u32RPI_delays(uint32 time){ + delay(time); +} diff --git a/src/c/hardware/rasberrypi/gertBoard/RPI_gertboardSPISetup.c b/src/c/hardware/rasberrypi/gertBoard/RPI_gertboardSPISetup.c new file mode 100644 index 00000000..5724ebb4 --- /dev/null +++ b/src/c/hardware/rasberrypi/gertBoard/RPI_gertboardSPISetup.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralGertboard.h" + +int8 RPI_gertboardSPISetup(){ + int8 out; + out=gertboardSPISetup(); + return (out); +} diff --git a/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogReads.c b/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogReads.c new file mode 100644 index 00000000..433bed29 --- /dev/null +++ b/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogReads.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralGertboard.h" + +uint16 u16RPI_gertboardAnalogReads(uint16 pin){ + uint16 out; + out=gertboardAnalogRead(pin); + return (out); +} diff --git a/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogSetups.c b/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogSetups.c new file mode 100644 index 00000000..a19aa6d0 --- /dev/null +++ b/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogSetups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralGertboard.h" + +int8 u16RPI_gertboardAnalogSetups(uint16 pinBase){ + int8 out; + out=gertboardAnalogSetup(pinBase); + return (out); +} diff --git a/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogWrites.c b/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogWrites.c new file mode 100644 index 00000000..2c8aa338 --- /dev/null +++ b/src/c/hardware/rasberrypi/gertBoard/u16RPI_gertboardAnalogWrites.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralGertboard.h" + +void u16RPI_gertboardAnalogWrites(uint16 pin,uint16 value){ + gertboardAnalogWrite(pin,value); +} diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h new file mode 100644 index 00000000..22d470a2 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* This file declares functions and constants related to GPIO pins*/ + +#ifndef __RPIPERIPHERALGPIO_H__ +#define __RPIPERIPHERALGPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" + +uint8 u8RPI_digitalReads(uint8 pin); +uint8 RPI_digitalReadByte(); +void u8RPI_digitalWrites(uint8 pin, uint8 state); +void u8RPI_digitalWriteBytes(uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALGPIO_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralGertboard.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralGertboard.h new file mode 100644 index 00000000..3594d0a1 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralGertboard.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __RPIPERIPHERALGERTBOARD_H__ +#define __RPIPERIPHERALGERTBOARD_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "gertboard.h" + +int8 RPI_gertboardSPISetup(); +uint16 u16RPI_gertboardAnalogReads(uint16 pin); +int8 u16RPI_gertboardAnalogSetups(uint16 pinBase); +void u16RPI_gertboardAnalogWrites(uint16 pin,uint16 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALGERTBOARD_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralI2C.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralI2C.h new file mode 100644 index 00000000..6c8dfe14 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralI2C.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* This file declares functions and constants related to rasberrypi*/ + +#ifndef __RPIPERIPHERALI2C_H__ +#define __RPIPERIPHERALI2C_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "wiringPiI2C.h" + +int8 u16RPI_I2CSetups(uint8 arrd); +int8 u16RPI_I2CReads(uint16 fd); +int8 u16RPI_I2CReadReg8s(uint16 fd,uint16 reg); +int8 u16RPI_I2CReadReg16s(uint16 fd,uint16 reg); +int8 u16RPI_I2CWrites(uint16 fd,uint16 data); +int8 u16RPI_I2CWriteReg8s(uint16 fd,uint16 reg,uint16 data); +int8 u16RPI_I2CWriteReg16s(uint16 fd,uint16 reg,uint16 data); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALI2C_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralInterrupt.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralInterrupt.h new file mode 100644 index 00000000..d9fc30f3 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralInterrupt.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALINTERRUPT_H__ +#define __RPIPERIPHERALINTERRUPT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" + +int8 u8RPI_waitForInterrupts(uint8 pin,int16 time); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALINTERRUPT_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD.h new file mode 100644 index 00000000..654a31a3 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD.h @@ -0,0 +1,39 @@ + /* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALLCD_H__ +#define __RPIPERIPHERALLCD_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "lcd.h" + +void u8RPI_lcdCharDefs(uint8 fd,uint8 index,uint8 d0,uint8 d1,uint8 d2,uint8 d3, uint8 d4,uint8 d5,uint8 d6,uint8 d7); +void u8RPI_lcdClears(uint8 fd); +void u8RPI_lcdCursorBlinks(uint8 fd,uint8 state); +void u8RPI_lcdCursors(uint8 fd,uint8 state); +void u8RPI_lcdDisplays(uint8 fd,uint8 state); +void u8RPI_lcdHomes(uint8 fd); +int8 u8RPI_lcdInits(uint8 rows,uint8 cols,uint8 bits,uint8 rs,uint8 strb,uint8 d0,uint8 d1,uint8 d2,uint8 d3,uint8 d4,uint8 d5,uint8 d6,uint8 d7); +void u8RPI_lcdPositions(uint8 fd,uint8 row,uint8 col); +void u8RPI_lcdPutchars(uint8 fd,uint8 character); +void u8RPI_lcdSendCommands(uint8 fd,uint8 cmd); +void u8RPI_lcdPutss(uint8 fd,char* msg,int size); +void u8RPI_lcdPrintfs(uint8 fd,char* data,int size); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALLCD_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h new file mode 100644 index 00000000..93bdf279 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h @@ -0,0 +1,47 @@ + /* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALLCD128x64_H__ +#define __RPIPERIPHERALLCD128x64_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "lcd128x64.h" + +int8 RPI_lcd128x64setup(void); +void u8RPI_lcd128x64clears(uint8 colour); +void u8RPI_lcd128x64Orientations(uint8 orientation); + +void u8RPI_lcd128x64setOrigins(uint8 x, uint8 y); + +void u8RPI_lcd128x64points(uint8 x, uint8 y, uint8 colour); +void u8RPI_lcd128x64lineTos(uint8 x, uint8 y, uint8 colour); + +void u8RPI_lcd128x64lines(uint8 x0, uint8 y0, uint8 x1, uint8 y1, uint8 colour); +void u8RPI_lcd128x64circles(uint8 x, uint8 y, uint8 r, uint8 colour, uint8 filled); +void u8RPI_lcd128x64putchars(uint8 x, uint8 y, uint8 c, uint8 bgCol, uint8 fgCol); +void u8RPI_lcd128x64putss(uint8 x, uint8 y, char *str,int size, uint8 bgCol, uint8 fgCol); + +void u8RPI_lcd128x64rectangles(uint8 x1, uint8 y1, uint8 x2, uint8 y2, uint8 colour, uint8 filled); +void u8RPI_lcd128x64ellipses(uint8 cx, uint8 cy, uint8 xRadius, uint8 yRadius, uint8 colour, uint8 filled); + +//void u8RPI_lcd128x64orientCoordinatess(uint8 *x, uint8 *y); +//void u8RPI_lcd128x64getScreenSizes(uint8 *x, uint8 *y); +//void RPI_lcd128x64update(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALLCD128x64_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralMcp.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralMcp.h new file mode 100644 index 00000000..5304f14b --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralMcp.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALMCP_H__ +#define __RPIPERIPHERALMCP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "mcp23016.h" +#include "mcp23017.h" +#include "mcp23008.h" +#include "mcp23s17.h" +#include "mcp23s08.h" + +uint8 u16RPI_mcp23008Setups(uint16 pinBase,uint8 addr); +uint8 u16RPI_mcp23016Setups(uint16 pinBase,uint8 addr); +uint8 u16RPI_mcp23017Setups(uint16 pinBase,uint8 addr); +uint8 u16RPI_mcp23s08Setups(uint16 pinBase,uint8 spiport,uint8 devId); +uint8 u16RPI_mcp23s17Setups(uint16 pinBase,uint8 spiport,uint8 devId); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALMCP_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralMisc.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralMisc.h new file mode 100644 index 00000000..0ef5acc1 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralMisc.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __RPIPERIPHERALMISC_H__ +#define __RPIPERIPHERALMISC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "sn3218.h" + +uint8 RPI_boardRev(); +void u8RPI_padDrives(uint8 group,uint8 strength); +int8 u16RPI_sn3218Setups(uint16 pinBase); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALMISC_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h new file mode 100644 index 00000000..f1d3024e --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALPWM_H__ +#define __RPIPERIPHERALPWM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" + +void u8RPI_pwmWrites(uint8 pin,uint16 value); +void u32RPI_pwmRanges(uint32 value); +void gRPI_pwmModea(char* mode,int size); +void u16RPI_pwmClocks(uint16 divisor); +void u8RPI_pwmToneWrites(uint8 pin,uint16 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALPWM_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralPcf.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralPcf.h new file mode 100644 index 00000000..55459332 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralPcf.h @@ -0,0 +1,30 @@ + /* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALPCF_H__ +#define __RPIPERIPHERALPCF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "pcf8574.h" +#include "pcf8591.h" + +uint8 u16RPI_pcf8574Setups(uint16 pinBase,uint8 addr); +uint8 u16RPI_pcf8591Setups(uint16 pinBase,uint8 addr); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALPCF_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralPiGlow.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralPiGlow.h new file mode 100644 index 00000000..d2dcd13c --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralPiGlow.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALPIGLOW_H__ +#define __RPIPERIPHERALPIGLOW_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "piGlow.h" + +void u8RPI_piGlowSetups(uint8 clear); +void u8RPI_piGlow1s(uint8 leg,uint8 ring,uint8 intensity); +void u8RPI_piGlowLegs(uint8 leg,uint8 intensity); +void u8RPI_piGlowRings(uint8 ring,uint8 intensity); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALPIGLOW_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralPinMap.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralPinMap.h new file mode 100644 index 00000000..39c2379d --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralPinMap.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALPINMAP_H__ +#define __RPIPERIPHERALPINMAP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" + +int8 u8RPI_physToGpios(uint8 pin); +int8 u8RPI_wpiToGpios(uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALPINMAP_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h new file mode 100644 index 00000000..67284bd0 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALSERIAL_H__ +#define __RPIPERIPHERALSERIAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "wiringSerial.h" + +int8 gRPI_serialOpena(char* device,int size,uint32 baud); +void u8RPI_serialCloses(uint8 fd); +uint8 u8RPI_serialDataAvails(uint8 fd); +void u8RPI_serialFlushs(uint8 fd); +void u8RPI_serialGetchars(uint8 fd,char* out); +void u8RPI_serialPrintfs(uint8 fd,char* msg,int size); +void u8RPI_serialPutchars(uint8 fd,uint8 character); +void u8RPI_serialPutss(uint8 fd,char* character,int size); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALSERIAL_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralSetup.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralSetup.h new file mode 100644 index 00000000..373f0648 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralSetup.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* This file declares functions and constants related to Setup*/ + +#ifndef __RPIPERIPHERALSETUP_H__ +#define __RPIPERIPHERALSETUP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "wiringPi.h" + +int8 gRPI_pinNumberinga(char* seq,int size); +uint8 u8RPI_getAlts(uint8 pin); +void u8RPI_pinModeAlts(uint8 pin,uint8 mode); +void u8RPI_pinModes(uint8 pin,char* mode,int size); +void u8RPI_pullControls(uint8 pin,char* mode,int size); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALSETUP_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralShift.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralShift.h new file mode 100644 index 00000000..4c58bb77 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralShift.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALSHIFT_H__ +#define __RPIPERIPHERALSHIFT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "wiringShift.h" +#include "sr595.h" + +uint8 u8RPI_shiftIns(uint8 dpin,uint8 cpin,uint8 order); +void u8RPI_shiftOuts(uint8 dpin,uint8 cpin,uint8 order,uint8 val); +int8 u16RPI_sr595Setups(uint16 pinBase,uint8 nPins,uint8 dP,uint8 cP,uint8 lP); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALSHIFT_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralSoft.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralSoft.h new file mode 100644 index 00000000..9494506e --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralSoft.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* This file declares functions and constants related to Setup*/ + +#ifndef __RPIPERIPHERALSOFT_H__ +#define __RPIPERIPHERALSOFT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "softPwm.h" +#include "softTone.h" + +uint8 u8RPI_softPwmCreates(uint8 pin,uint16 ival,uint16 range); +void u8RPI_softPwmStops(uint8 pin); +void u8RPI_softPwmWrites(uint8 pin,uint16 value); +uint8 u8RPI_softToneCreates(uint8 pin); +void u8RPI_softToneStops(uint8 pin); +void u8RPI_softToneWrites(uint8 pin,uint32 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALSOFT_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h new file mode 100644 index 00000000..e75a5394 --- /dev/null +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* This file declares functions and constants related to rasberrypi*/ + +#ifndef __RPIPERIPHERALTIMING_H__ +#define __RPIPERIPHERALTIMING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "wiringPi.h" + +void u32RPI_delays(uint32 time); +void u32RPI_delayMicros(uint32 time); +uint32 RPI_millis(); +uint32 RPI_micros(); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALTIMING_H__*/ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h new file mode 100644 index 00000000..6b7ed271 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALGPIO_H__ +#define __INT_RPIPERIPHERALGPIO_H__ + +#include "types.h" +#include "RPIPeripheralDigital.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80RPI_digitalReadu80(pin) u8RPI_digitalReads(pin); +#define d0RPI_digitalReadd0(pin) u8RPI_digitalReads(pin); + +#define RPI_digitalReadByteu80() RPI_digitalReadByte(); +#define u80u80RPI_digitalWrite(pin,state) u8RPI_digitalWrites(pin,state); +#define d0d0RPI_digitalWrite(pin,state) u8RPI_digitalWrites(pin,state); + +#define u80RPI_digitalWriteByte(value) u8RPI_digitalWriteBytes(value); +#define d0RPI_digitalWriteByte(value) u8RPI_digitalWriteBytes(value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALGPIO_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralGertboard.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralGertboard.h new file mode 100644 index 00000000..e258068c --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralGertboard.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALGERTBOARD_H__ +#define __INT_RPIPERIPHERALGERTBOARD_H__ + +#include "types.h" +#include "RPIPeripheralGertboard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_gertboardSPISetupi80() RPI_gertboardSPISetup(); + +#define u160RPI_gertboardAnalogSetupi80(pinBase) u16RPI_gertboardAnalogSetups(pinBase); +#define d0RPI_gertboardAnalogSetupi80(pinBase) u16RPI_gertboardAnalogSetups(pinBase); + +#define u160RPI_gertboardAnalogReadu160(pin) u160RPI_gertboardAnalogReads(pin); +#define d0RPI_gertboardAnalogReadu160(pin) u160RPI_gertboardAnalogReads(pin); + +#define u160u160RPI_gertboardAnalogWrite(pin,value) u160RPI_gertboardAnalogWrites(pin,value); +#define d0d0RPI_gertboardAnalogWrite(pin,value) u160RPI_gertboardAnalogWrites(pin,value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALGERTBOARD_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralI2C.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralI2C.h new file mode 100644 index 00000000..b93529e3 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralI2C.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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALI2C_H__ +#define __INT_RPIPERIPHERALI2C_H__ + +#include "types.h" +#include "RPIPeripheralI2C.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u160RPI_I2CSetupi80(arrd) u16RPI_I2CSetups(arrd); +#define d0RPI_I2CSetupi80(arrd) u16RPI_I2CSetups(arrd); + +#define u160RPI_I2CReadi80(fd) u16RPI_I2CReads(fd); +#define d0RPI_I2CReadi80(fd) u16RPI_I2CReads(fd); + +#define u160u160RPI_I2CReadReg8i80(fd,reg) u16RPI_I2CReadReg8s(fd,reg); +#define d0d0RPI_I2CReadReg8i80(fd,reg) u16RPI_I2CReadReg8s(fd,reg); + +#define u160u160RPI_I2CReadReg16i80(fd,reg) u16RPI_I2CReadReg16s(fd,reg); +#define d0d0RPI_I2CReadReg16i80(fd,reg) u16RPI_I2CReadReg16s(fd,reg); + +#define u160u160RPI_I2CWritei80(fd,data) u16RPI_I2CWrites(fd,data); +#define d0d0RPI_I2CWritei80(fd,data) u16RPI_I2CWrites(fd,data); + +#define u160u160u160RPI_I2CWriteReg8i80(fd,reg,data) u16RPI_I2CWriteReg8s(fd,reg,data); +#define d0d0d0RPI_I2CWriteReg8i80(fd,reg,data) u16RPI_I2CWriteReg8s(fd,reg,data); + +#define u160u160u160RPI_I2CWriteReg16i80(fd,reg,data) u16RPI_I2CWriteReg16s(fd,reg,data); +#define d0d0d0RPI_I2CWriteReg16i80(fd,reg,data) u16RPI_I2CWriteReg16s(fd,reg,data); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALI2C_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralInterrupt.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralInterrupt.h new file mode 100644 index 00000000..572d028d --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralInterrupt.h @@ -0,0 +1,30 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALINTERRUPT_H__ +#define __INT_RPIPERIPHERALINTERRUPT_H__ + +#include "types.h" +#include "RPIPeripheralInterrupt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80i160RPI_waitForInterrupti80(pin,time) u8RPI_waitForInterrupts(pin,time); +#define d0d0RPI_waitForInterrupti80(pin,time) u8RPI_waitForInterrupts(pin,time); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALINTERRUPT_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h new file mode 100644 index 00000000..803f93e3 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h @@ -0,0 +1,70 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALLCD_H__ +#define __INT_RPIPERIPHERALLCD_H__ + +#include "types.h" +#include "RPIPeripheralLCD.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80u80u80u80u80u80u80u80u80u80RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); +#define u80d0d0d0d0d0d0d0d0d0RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); +#define d0d0d0d0d0d0d0d0d0d0RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); + +#define u80RPI_lcdClear(fd) u8RPI_lcdClears(fd); +#define d0RPI_lcdClear(fd) u8RPI_lcdClears(fd); + +#define u80u80RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); +#define u80d0RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); +#define d0d0RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); + +#define u80u80RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); +#define u80d0RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); +#define d0d0RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); + +#define u80u80RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); +#define u80d0RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); +#define d0d0RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); + +#define u80RPI_lcdHome(fd) u8RPI_lcdHomes(fd); +#define d0RPI_lcdHome(fd) u8RPI_lcdHomes(fd); + +#define u80u80u80u80u80u80u80u80u80u80u80u80u80RPI_lcdIniti80(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdInits(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7); +#define d0d0d0d0d0d0d0d0d0d0d0d0d0RPI_lcdIniti80(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdInits(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7); + +#define u80u80u80RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); +#define u80d0d0RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); +#define d0d0d0RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); + +#define u80u80RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); +#define u80d0RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); +#define d0d0RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); + +#define u80u80RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); +#define u80d0RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); +#define d0d0RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); + +#define u80g2RPI_lcdPuts(fd,msg,size) u8RPI_lcdPutss(fd,msg,size[1]);; +#define d0g2RPI_lcdPuts(fd,msg,size) u8RPI_lcdPutss(fd,msg,size[1]);; + +#define u80g2RPI_lcdPrintf(fd,data,size) u8RPI_lcdPrintfs(fd,data,size[1]); +#define d0g2RPI_lcdPrintf(fd,data,size) u8RPI_lcdPrintfs(fd,data,size[1]); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALLCD_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h new file mode 100644 index 00000000..8bb4b17e --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h @@ -0,0 +1,62 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALLCD128x64_H__ +#define __INT_RPIPERIPHERALLCD128x64_H__ + +#include "types.h" +#include "RPIPeripheralLCD128x64.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_lcd128x64setupi80() RPI_lcd128x64setup(); + +#define u80RPI_lcd128x64clear(colour) u8RPI_lcd128x64clears(colour); +#define d0RPI_lcd128x64clear(colour) u8RPI_lcd128x64clears(colour); + +#define u80RPI_lcd128x64Orientation(orientation) u8RPI_lcd128x64Orientations(orientation); +#define d0RPI_lcd128x64Orientation(orientation) u8RPI_lcd128x64Orientations(orientation); + +#define u80u80RPI_lcd128x64setOrigin(x,y) u8RPI_lcd128x64setOrigins(x,y); +#define d0d0RPI_lcd128x64setOrigin(x,y) u8RPI_lcd128x64setOrigins(x,y); + +#define u80u80u80RPI_lcd128x64point(x,y,colour) u8RPI_lcd128x64points(x,y,colour); +#define d0d0d0RPI_lcd128x64point(x,y,colour) u8RPI_lcd128x64points(x,y,colour); + +#define u80u80u80RPI_lcd128x64lineTo(x,y,colour) u8RPI_lcd128x64lineTos(x,y,colour); +#define d0d0d0RPI_lcd128x64lineTo(x,y,colour) u8RPI_lcd128x64lineTos(x,y,colour); + +#define u80u80u80u80u80RPI_lcd128x64line(x0,y0,x1,y1,colour) u8RPI_lcd128x64lines(x0,y0,x1,y1,colour); +#define d0d0d0d0d0RPI_lcd128x64line(x0,y0,x1,y1,colour) u8RPI_lcd128x64lines(x0,y0,x1,y1,colour); + +#define u80u80u80u80u80RPI_lcd128x64circle(x,y,r,colour,filled) u8RPI_lcd128x64circles(x,y,r,colour,filled); +#define d0d0d0d0d0RPI_lcd128x64circle(x,y,r,colour,filled) u8RPI_lcd128x64circles(x,y,r,colour,filled); + +#define u80u80u80u80u80RPI_lcd128x64putchar(x,y,c,bgCol,fgCol) u8RPI_lcd128x64putchars(x,y,c,bgCol,fgCol); +#define d0d0d0d0u80RPI_lcd128x64putchar(x,y,c,bgCol,fgCol) u8RPI_lcd128x64putchars(x,y,c,bgCol,fgCol); + +#define u80u80g2u80u80RPI_lcd128x64puts(x,y,str,size,bgCol,fgCol) u8RPI_lcd128x64putss(x,y,str,size[1],bgCol,fgCol); +#define d0d0g2d0d0RPI_lcd128x64puts(x,y,str,size,bgCol,fgCol) u8RPI_lcd128x64putss(x,y,str,size[1],bgCol,fgCol); + +#define u80u80u80u80u80u80RPI_lcd128x64rectangle(x1,y1,x2,y2,colour,filled) u8RPI_lcd128x64rectangles(x1,y1,x2,y2,colour,filled); +#define d0d0d0d0d0d0RPI_lcd128x64rectangle(x1,y1,x2,y2,colour,filled) u8RPI_lcd128x64rectangles(x1,y1,x2,y2,colour,filled); + +#define u80u80u80u80u80u80RPI_lcd128x64ellipse(cx,cy,xRadius,yRadius,colour,filled) u8RPI_lcd128x64ellipses(cx,cy,xRadius,yRadius,colour,filled); +#define d0d0d0d0d0d0RPI_lcd128x64ellipse(cx,cy,xRadius,yRadius,colour,filled) u8RPI_lcd128x64ellipses(cx,cy,xRadius,yRadius,colour,filled); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALLCD128x64_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMcp.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMcp.h new file mode 100644 index 00000000..7857b3ae --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMcp.h @@ -0,0 +1,42 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALMCP_H__ +#define __INT_RPIPERIPHERALMCP_H__ + +#include "types.h" +#include "RPIPeripheralMcp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u160u80RPI_mcp23008Setupu80(pinBase,addr) u16RPI_mcp23008Setups(pinBase,addr); +#define d0d0RPI_mcp23008Setupu80(pinBase,addr) u16RPI_mcp23008Setups(pinBase,addr); + +#define u160u80RPI_mcp23016Setupu80(pinBase,addr) u16RPI_mcp23016Setups(pinBase,addr); +#define d0d0RPI_mcp23016Setupu80(pinBase,addr) u16RPI_mcp23016Setups(pinBase,addr); + +#define u160u80RPI_mcp23017Setupu80(pinBase,addr) u16RPI_mcp23017Setups(pinBase,addr); +#define d0d0RPI_mcp23017Setupu80(pinBase,addr) u16RPI_mcp23017Setups(pinBase,addr); + +#define u160u80u80RPI_mcp23s08Setupu80(pinBase,spiport,devId) u16RPI_mcp23s08Setups(pinBase,spiport,devId); +#define d0d0d0RPI_mcp23s08Setupu80(pinBase,spiport,devId) u16RPI_mcp23s08Setups(pinBase,spiport,devId); + +#define u160u80u80RPI_mcp23s17Setupu80(pinBase,spiport,devId) u16RPI_mcp23s17Setups(pinBase,spiport,devId); +#define d0d0d0RPI_mcp23s17Setupu80(pinBase,spiport,devId) u16RPI_mcp23s17Setups(pinBase,spiport,devId); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALMCP_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMisc.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMisc.h new file mode 100644 index 00000000..de065a24 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMisc.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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALMISC_H__ +#define __INT_RPIPERIPHERALMISC_H__ + +#include "types.h" +#include "RPIPeripheralMisc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_boardRevu80() RPI_boardRev(); + +#define u80u80RPI_padDrive(group,strength) u8RPI_padDrives(group,strength); +#define d0d0RPI_padDrive(group,strength) u8RPI_padDrives(group,strength); + +#define u160RPI_sn3218Setupi80(pinBase) u16RPI_sn3218Setups(pinBase); +#define d0RPI_sn3218Setupi80(pinBase) u16RPI_sn3218Setups(pinBase); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALMISC_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h new file mode 100644 index 00000000..fd1a1b08 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h @@ -0,0 +1,41 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALPWM_H__ +#define __INT_RPIPERIPHERALPWM_H__ + +#include "types.h" +#include "RPIPeripheralPWM.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80u160RPI_pwmWrite(pin,value) u8RPI_pwmWrites(pin,value); +#define d0d0RPI_pwmWrite(pin,value) u8RPI_pwmWrites(pin,value); + +#define u320RPI_pwmRange(value) u32RPI_pwmRanges(value); +#define d0RPI_pwmRange(value) u32RPI_pwmRanges(value); + +#define g2RPI_pwmMode(mode) gRPI_pwmModea(mode); + +#define u160RPI_pwmClock(divisor) u16RPI_pwmClocks(divisor); +#define d0RPI_pwmClock(divisor) u16RPI_pwmClocks(divisor); + +#define u80u160RPI_pwmToneWrite(pin,value) u8RPI_pwmToneWrites(pin,value); +#define d0d0RPI_pwmToneWrite(pin,value) u8RPI_pwmToneWrites(pin,value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALPWM_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPcf.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPcf.h new file mode 100644 index 00000000..3d0cb273 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPcf.h @@ -0,0 +1,33 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALPCF_H__ +#define __INT_RPIPERIPHERALPCF_H__ + +#include "types.h" +#include "RPIPeripheralPcf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u160u80RPI_pcf8574Setupu80(pinBase,addr) u16RPI_pcf8574Setups(pinBase,addr); +#define d0d0RPI_pcf8574Setupu80(pinBase,addr) u16RPI_pcf8574Setups(pinBase,addr); + +#define u160u80RPI_pcf8591Setupu80(pinBase,addr) u16RPI_pcf8591Setups(pinBase,addr); +#define d0d0RPI_pcf8591Setupu80(pinBase,addr) u16RPI_pcf8591Setups(pinBase,addr); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALPCF_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPiGlow.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPiGlow.h new file mode 100644 index 00000000..8e268f6e --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPiGlow.h @@ -0,0 +1,39 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALPIGLOW_H__ +#define __INT_RPIPERIPHERALPIGLOW_H__ + +#include "types.h" +#include "RPIPeripheralPiGlow.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80RPI_piGlowSetup(clear) u8RPI_piGlowSetups(clear); +#define d0RPI_piGlowSetup(clear) u8RPI_piGlowSetups(clear); + +#define u80u80u80RPI_piGlow1(leg,ring,intensity) u8RPI_piGlow1s(leg,ring,intensity); +#define d0d0d0RPI_piGlow1(leg,ring,intensity) u8RPI_piGlow1s(leg,ring,intensity); + +#define u80u80RPI_piGlowLeg(leg,intensity) u8RPI_piGlowLegs(leg,intensity); +#define d0d0RPI_piGlowLeg(leg,intensity) u8RPI_piGlowLegs(leg,intensity); + +#define u80u80RPI_piGlowRing(ring,intensity) u8RPI_piGlowRings(ring,intensity); +#define d0d0RPI_piGlowRing(ring,intensity) u8RPI_piGlowRings(ring,intensity); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALPIGLOW_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinMap.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinMap.h new file mode 100644 index 00000000..8de0dc29 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinMap.h @@ -0,0 +1,33 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALPINMAP_H__ +#define __INT_RPIPERIPHERALPINMAP_H__ + +#include "types.h" +#include "RPIPeripheralPinMap.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80RPI_physToGpioi80(pin) u8RPI_physToGpios(pin); +#define d0RPI_physToGpioi80(pin) u8RPI_physToGpios(pin); + +#define u80RPI_wpiToGpioi80(pin) u8RPI_wpiToGpios(pin); +#define d0RPI_wpiToGpioi80(pin) u8RPI_wpiToGpios(pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALPINMAP_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h new file mode 100644 index 00000000..b308d838 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h @@ -0,0 +1,51 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALSERIAL_H__ +#define __INT_RPIPERIPHERALSERIAL_H__ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2u320RPI_serialOpeni80(device,size,baud) gRPI_serialOpena(device,size[1],baud); +#define g2d0RPI_serialOpeni80(device,size,baud) gRPI_serialOpena(device,size[1],baud); + +#define u80RPI_serialClose(fd) u8RPI_serialCloses(fd); +#define d0RPI_serialClose(fd) u8RPI_serialCloses(fd); + +#define u80RPI_serialDataAvailu80(fd) u8RPI_serialDataAvails(fd); +#define d0RPI_serialDataAvailu80(fd) u8RPI_serialDataAvails(fd); + +#define u80RPI_serialFlush(fd) u8RPI_serialFlushs(fd); +#define d0RPI_serialFlush(fd) u8RPI_serialFlushs(fd); + +#define u80RPI_serialGetcharg2(fd,out) u8RPI_serialGetchars(fd,out); +#define d0RPI_serialGetcharg2(fd,out) u8RPI_serialGetchars(fd,out); + +#define u80g2RPI_serialPrintf(fd,msg,size) u8RPI_serialPrintfs(fd,msg,size[1]); +#define d0g2RPI_serialPrintf(fd,msg,size) u8RPI_serialPrintfs(fd,msg,size[1]); + +#define u80u80RPI_serialPutchar(fd,character) u8RPI_serialPutchars(fd,character); +#define d0d0RPI_serialPutchar(fd,character) u8RPI_serialPutchars(fd,character); + +#define u80g2RPI_serialPutsg2(fd,character,size) u8RPI_serialPutss(fd,character,size[1]); +#define d0g2RPI_serialPutsg2(fd,character,size) u8RPI_serialPutss(fd,character,size[1]); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALSERIAL_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSetup.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSetup.h new file mode 100644 index 00000000..6bcb1632 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSetup.h @@ -0,0 +1,41 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALSETUP_H__ +#define __INT_RPIPERIPHERALSETUP_H__ + +#include "RPIPeripheralSetup.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//pinNumbering +#define g2RPI_pinNumberingi80(seq,size) gRPI_pinNumberinga(seq,size[1]); +//getAlt +#define u80RPI_getAltu80(pin) u8RPI_getAlts(pin); +#define d0RPI_getAltu80(pin) u8RPI_getAlts(pin); +//pinModeAlt +#define u80u80RPI_pinModeAlt(pin,mode) u8RPI_pinModeAlts(pin,mode); +#define d0d0RPI_pinModeAlt(pin,mode) u8RPI_pinModeAlts(pin,mode); +//pinMode +#define u80g2RPI_pinMode(pin,mode,size) u8RPI_pinModes(pin,mode,size[1]); +#define d0g2RPI_pinMode(pin,mode,size) u8RPI_pinModes(pin,mode,size[1]); +//pullControl +#define u80g2RPI_pullControl(pin,mode,size) u8RPI_pullControls(pin,mode,size[1]); +#define d0g2RPI_pullControl(pin,mode,size) u8RPI_pullControls(pin,mode,size[1]); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALSETUP_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralShift.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralShift.h new file mode 100644 index 00000000..7b70ce9a --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralShift.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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALSHIFT_H__ +#define __INT_RPIPERIPHERALSHIFT_H__ + +#include "types.h" +#include "RPIPeripheralShift.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80u80u80RPI_shiftInu80(dpin,cpin,order) u8RPI_shiftIns(dpin,cpin,order); +#define d0d0d0RPI_shiftInu80(dpin,cpin,order) u8RPI_shiftIns(dpin,cpin,order); + +#define u80u80u80u80RPI_shiftOut(dpin,cpin,order,val) u8RPI_shiftOuts(dpin,cpin,order,val); +#define d0d0d0d0RPI_shiftOut(dpin,cpin,order,val) u8RPI_shiftOuts(dpin,cpin,order,val); + +#define u160u80u80u80u80RPI_sr595Setupi80(pinBase,nPins,dP,cP,lP) u16RPI_sr595Setups(pinBase,nPins,dP,cP,lP); +#define d0d0d0d0d0RPI_sr595Setupi80(pinBase,nPins,dP,cP,lP) u16RPI_sr595Setups(pinBase,nPins,dP,cP,lP); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALSHIFT_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSoft.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSoft.h new file mode 100644 index 00000000..646c5244 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSoft.h @@ -0,0 +1,45 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALSOFT_H__ +#define __INT_RPIPERIPHERALSOFT_H__ + +#include "types.h" +#include "RPIPeripheralSoft.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u80u160u160RPI_softPwmCreateu80(pin,ival,range) u8RPI_softPwmCreates(pin,ival,range); +#define d0d0d0RPI_softPwmCreateu80(pin,ival,range) u8RPI_softPwmCreates(pin,ival,range); + +#define u80RPI_softPwmStop(pin) u8RPI_softPwmStops(pin); +#define d0RPI_softPwmStop(pin) u8RPI_softPwmStops(pin); + +#define u80u160RPI_softPwmWrite(pin,value) u8RPI_softPwmWrites(pin,value); +#define d0d0RPI_softPwmWrite(pin,value) u8RPI_softPwmWrites(pin,value); + +#define u80RPI_softToneCreateu80(pin) u8RPI_softToneCreates(pin); +#define d0RPI_softToneCreateu80(pin) u8RPI_softToneCreates(pin); + +#define u80RPI_softToneStop(pin) u8RPI_softToneStops(pin); +#define d0RPI_softToneStop(pin) u8RPI_softToneStops(pin); + +#define u80u320RPI_softToneWrite(pin,value) u8RPI_softToneWrites(pin,value); +#define d0d0RPI_softToneWrite(pin,value) u8RPI_softToneWrites(pin,value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALSOFT_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h new file mode 100644 index 00000000..cbbb47ae --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_RPIPERIPHERALTIMING_H__ +#define __INT_RPIPERIPHERALTIMING_H__ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define u320RPI_delay(time) u32RPI_delays(time); +#define d0RPI_delay(time) u32RPI_delays(time); + +#define u320RPI_delayMicro(time) u32RPI_delayMicros(time); +#define d0RPI_delayMicro(time) u32RPI_delayMicros(time); + +#define RPI_millisu320() RPI_millis(); +#define RPI_microsu320() RPI_micros(); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALTIMING_H__ */ diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCharDefs.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCharDefs.c new file mode 100644 index 00000000..b85d82fd --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCharDefs.c @@ -0,0 +1,18 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdCharDefs(uint8 fd,uint8 index,uint8 d0,uint8 d1,uint8 d2,uint8 d3, uint8 d4,uint8 d5,uint8 d6,uint8 d7){ + uint8 data[8]={d0,d1,d2,d3,d4,d5,d6,d7}; + lcdCharDef(fd,index,data); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdClears.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdClears.c new file mode 100644 index 00000000..659cdf07 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdClears.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdClears(uint8 fd){ + lcdClear(fd); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCursorBlinks.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCursorBlinks.c new file mode 100644 index 00000000..bf0c48e3 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCursorBlinks.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdCursorBlinks(uint8 fd,uint8 state){ + lcdCursorBlink(fd,state); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCursors.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCursors.c new file mode 100644 index 00000000..8bb02715 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdCursors.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdCursors(uint8 fd,uint8 state){ + lcdCursor(fd,state); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdDisplays.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdDisplays.c new file mode 100644 index 00000000..7425ebe9 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdDisplays.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdDisplays(uint8 fd,uint8 state){ + lcdDisplay(fd,state); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdHomes.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdHomes.c new file mode 100644 index 00000000..98762de4 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdHomes.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdHomes(uint8 fd){ + lcdHome(fd); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdInits.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdInits.c new file mode 100644 index 00000000..b69f311c --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdInits.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +int8 u8RPI_lcdInits(uint8 rows,uint8 cols,uint8 bits,uint8 rs,uint8 strb,uint8 d0,uint8 d1,uint8 d2,uint8 d3,uint8 d4,uint8 d5,uint8 d6,uint8 d7){ + uint8 fd; + fd=lcdInit(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7); + return (fd); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPositions.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPositions.c new file mode 100644 index 00000000..3188a972 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPositions.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdPositions(uint8 fd,uint8 row,uint8 col){ + lcdPosition(fd,row,col); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPrintfs.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPrintfs.c new file mode 100644 index 00000000..58d01fa8 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPrintfs.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdPrintfs(uint8 fd,char* data,int size){ + lcdPrintf(fd,data); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPutchars.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPutchars.c new file mode 100644 index 00000000..c50a177b --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPutchars.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdPutchars(uint8 fd,uint8 character){ + lcdPutchar(fd,character); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPutss.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPutss.c new file mode 100644 index 00000000..a7f492ba --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdPutss.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdPutss(uint8 fd,char* msg,int size){ + lcdPuts(fd,msg); +} diff --git a/src/c/hardware/rasberrypi/lcd/u8RPI_lcdSendCommands.c b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdSendCommands.c new file mode 100644 index 00000000..7097d696 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd/u8RPI_lcdSendCommands.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD.h" + +void u8RPI_lcdSendCommands(uint8 fd,uint8 cmd){ + lcdSendCommand(fd,cmd); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64Orientation.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64Orientation.c new file mode 100644 index 00000000..52391029 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64Orientation.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64Orientations(uint8 orientation){ + lcd128x64setOrientation(orientation); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64circle.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64circle.c new file mode 100644 index 00000000..9019d8f4 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64circle.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64circles(uint8 x,uint8 y,uint8 r,uint8 colour,uint8 filled){ + lcd128x64circle(x,y,r,colour,filled); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64clear.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64clear.c new file mode 100644 index 00000000..a83cef25 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64clear.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64clears(uint8 colour){ + lcd128x64clear(colour); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64ellipse.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64ellipse.c new file mode 100644 index 00000000..d2e2f542 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64ellipse.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64ellipses(uint8 cx, uint8 cy, uint8 xRadius, uint8 yRadius, uint8 colour, uint8 filled){ + lcd128x64ellipse(cx,cy,xRadius,yRadius,colour,filled); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64line.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64line.c new file mode 100644 index 00000000..f5850808 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64line.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64lines(uint8 x0, uint8 y0, uint8 x1, uint8 y1, uint8 colour){ + lcd128x64line(x0,y0,x1,y1,colour); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64lineTo.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64lineTo.c new file mode 100644 index 00000000..3f791f64 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64lineTo.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64lineTos(uint8 x, uint8 y, uint8 colour){ + lcd128x64lineTo(x,y,colour); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64point.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64point.c new file mode 100644 index 00000000..a23cdddc --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64point.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64points(uint8 x,uint8 y,uint8 colour){ + lcd128x64point(x,y,colour); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64putchar.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64putchar.c new file mode 100644 index 00000000..2dadb448 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64putchar.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64putchars(uint8 x, uint8 y, uint8 c, uint8 bgCol, uint8 fgCol){ + lcd128x64putchar(x,y,c,bgCol,fgCol); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64puts.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64puts.c new file mode 100644 index 00000000..15c54da3 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64puts.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64putss(uint8 x, uint8 y, char* str,int size, uint8 bgCol, uint8 fgCol){ + lcd128x64puts(x,y,str,bgCol,fgCol); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64rectangle.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64rectangle.c new file mode 100644 index 00000000..78239d9f --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64rectangle.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64rectangles(uint8 x1,uint8 y1,uint8 x2,uint8 y2,uint8 colour,uint8 filled){ + lcd128x64rectangle(x1,y1,x2,y2,colour,filled); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64setOrigin.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64setOrigin.c new file mode 100644 index 00000000..c4b19391 --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64setOrigin.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +void u8RPI_lcd128x64setOrigins(uint8 x,uint8 y){ + lcd128x64setOrigin(x,y); +} diff --git a/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64setup.c b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64setup.c new file mode 100644 index 00000000..8f6e6b6f --- /dev/null +++ b/src/c/hardware/rasberrypi/lcd128x64/RPI_lcd128x64setup.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralLCD128x64.h" + +int8 RPI_lcd128x64setup(){ + int8 out; + out=lcd128x64setup(); + return (out); +} diff --git a/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23008Setups.c b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23008Setups.c new file mode 100644 index 00000000..c7d73268 --- /dev/null +++ b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23008Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMcp.h" + +uint8 u16RPI_mcp23008Setups(uint16 pinBase,uint8 addr){ + uint8 out; + out=mcp23008Setup(pinBase,addr); + return (out); +} diff --git a/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23016Setups.c b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23016Setups.c new file mode 100644 index 00000000..2e35e5c2 --- /dev/null +++ b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23016Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMcp.h" + +uint8 u16RPI_mcp23016Setups(uint16 pinBase,uint8 addr){ + uint8 out; + out=mcp23016Setup(pinBase,addr); + return (out); +} diff --git a/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23017Setups.c b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23017Setups.c new file mode 100644 index 00000000..35ed5477 --- /dev/null +++ b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23017Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMcp.h" + +uint8 u16RPI_mcp23017Setups(uint16 pinBase,uint8 addr){ + uint8 out; + out=mcp23017Setup(pinBase,addr); + return (out); +} diff --git a/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23s08Setups.c b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23s08Setups.c new file mode 100644 index 00000000..e1bdab60 --- /dev/null +++ b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23s08Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMcp.h" + +uint8 u16RPI_mcp23s08Setups(uint16 pinBase,uint8 spiport,uint8 devId){ + uint8 out; + out=mcp23s08Setup(pinBase,spiport,devId); + return (out); +} diff --git a/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23s17Setups.c b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23s17Setups.c new file mode 100644 index 00000000..5ba30d23 --- /dev/null +++ b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23s17Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralMcp.h" + +uint8 u16RPI_mcp23s17Setups(uint16 pinBase,uint8 spiport,uint8 devId){ + uint8 out; + out=mcp23s17Setup(pinBase,spiport,devId); + return (out); +} diff --git a/src/c/hardware/rasberrypi/pcf/u16RPI_pcf8574Setups.c b/src/c/hardware/rasberrypi/pcf/u16RPI_pcf8574Setups.c new file mode 100644 index 00000000..f7e38df0 --- /dev/null +++ b/src/c/hardware/rasberrypi/pcf/u16RPI_pcf8574Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPcf.h" + +uint8 u16RPI_pcf8574Setups(uint16 pinBase,uint8 addr){ + uint8 out; + out=pcf8574Setup(pinBase,addr); + return (out); +} diff --git a/src/c/hardware/rasberrypi/pcf/u16RPI_pcf8591Setups.c b/src/c/hardware/rasberrypi/pcf/u16RPI_pcf8591Setups.c new file mode 100644 index 00000000..de26a926 --- /dev/null +++ b/src/c/hardware/rasberrypi/pcf/u16RPI_pcf8591Setups.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPcf.h" + +uint8 u16RPI_pcf8591Setups(uint16 pinBase,uint8 addr){ + uint8 out; + out=pcf8591Setup(pinBase,addr); + return (out); +} diff --git a/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlow1s.c b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlow1s.c new file mode 100644 index 00000000..792cda1c --- /dev/null +++ b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlow1s.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPiGlow.h" + +void u8RPI_piGlow1s(uint8 leg,uint8 ring,uint8 intensity){ + piGlow1(leg,ring,intensity); +} diff --git a/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowLegs.c b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowLegs.c new file mode 100644 index 00000000..f4ef5b50 --- /dev/null +++ b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowLegs.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPiGlow.h" + +void u8RPI_piGlowLegs(uint8 leg,uint8 intensity){ + piGlowLeg(leg,intensity); +} diff --git a/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowRings.c b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowRings.c new file mode 100644 index 00000000..985696df --- /dev/null +++ b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowRings.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPiGlow.h" + +void u8RPI_piGlowRings(uint8 ring,uint8 intensity){ + piGlowRing(ring,intensity); +} diff --git a/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowSetups.c b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowSetups.c new file mode 100644 index 00000000..2037a9b5 --- /dev/null +++ b/src/c/hardware/rasberrypi/piGlow/u8RPI_piGlowSetups.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPiGlow.h" + +void u8RPI_piGlowSetups(uint8 clear){ + piGlowSetup(clear); +} diff --git a/src/c/hardware/rasberrypi/pinMap/u8RPI_physToGpios.c b/src/c/hardware/rasberrypi/pinMap/u8RPI_physToGpios.c new file mode 100644 index 00000000..09a57132 --- /dev/null +++ b/src/c/hardware/rasberrypi/pinMap/u8RPI_physToGpios.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPinMap.h" + +int8 u8RPI_physToGpios(uint8 pin){ + int8 out; + out=physPinToGpio(pin); + return (pin); +} diff --git a/src/c/hardware/rasberrypi/pinMap/u8RPI_wpiToGpios.c b/src/c/hardware/rasberrypi/pinMap/u8RPI_wpiToGpios.c new file mode 100644 index 00000000..5f65f34c --- /dev/null +++ b/src/c/hardware/rasberrypi/pinMap/u8RPI_wpiToGpios.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPinMap.h" + +int8 u8RPI_wpiToGpios(uint8 pin){ + int8 out; + out=wpiPinToGpio(pin); + return (out); +} diff --git a/src/c/hardware/rasberrypi/pwm/gRPI_pwmModea.c b/src/c/hardware/rasberrypi/pwm/gRPI_pwmModea.c new file mode 100644 index 00000000..da67a15c --- /dev/null +++ b/src/c/hardware/rasberrypi/pwm/gRPI_pwmModea.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPWM.h" + +/*Function to set mode for PWM channel. Two modes are available + "bal" --> balanced mode + "ms" --> mark/space mode + */ + +void gRPI_pwmModea(char* mode,int size){ + if (mode[0] == 'm') /*mark/space mode*/ + pwmSetMode(0); + else if (mode[0] == 'b') + pwmSetMode(1); +} diff --git a/src/c/hardware/rasberrypi/pwm/u16RPI_pwmClocks.c b/src/c/hardware/rasberrypi/pwm/u16RPI_pwmClocks.c new file mode 100644 index 00000000..85e1fb2b --- /dev/null +++ b/src/c/hardware/rasberrypi/pwm/u16RPI_pwmClocks.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPWM.h" + +/*Function to set clock for pwm channel. Default clock is 19.2 MHz. 'clk_divisor' + along with range decides frequency for PWM + PWM frequency = 19.2 MHz / clk_divisor/ range + Range for clk_divisor = 1-2048 +*/ + +void u16RPI_pwmClocks(uint16 divisor){ + pwmSetClock(divisor); +} diff --git a/src/c/hardware/rasberrypi/pwm/u32RPI_pwmRanges.c b/src/c/hardware/rasberrypi/pwm/u32RPI_pwmRanges.c new file mode 100644 index 00000000..1fb22963 --- /dev/null +++ b/src/c/hardware/rasberrypi/pwm/u32RPI_pwmRanges.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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPWM.h" + +/*Function to assign pwm duty to specified pin. PWM duty is decided by 'value' + and 'range' specified using corresponding function. + PWM duty = value/range + */ + +void u32RPI_pwmRanges(uint32 value){ + pwmSetRange(value); +} diff --git a/src/c/hardware/rasberrypi/pwm/u8RPI_pwmToneWrites.c b/src/c/hardware/rasberrypi/pwm/u8RPI_pwmToneWrites.c new file mode 100644 index 00000000..3fe0c828 --- /dev/null +++ b/src/c/hardware/rasberrypi/pwm/u8RPI_pwmToneWrites.c @@ -0,0 +1,17 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPWM.h" + +void u8RPI_pwmToneWrites(uint8 pin,uint16 freq){ + pwmToneWrite(pin,freq); +} diff --git a/src/c/hardware/rasberrypi/pwm/u8RPI_pwmWrites.c b/src/c/hardware/rasberrypi/pwm/u8RPI_pwmWrites.c new file mode 100644 index 00000000..be94e73e --- /dev/null +++ b/src/c/hardware/rasberrypi/pwm/u8RPI_pwmWrites.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani, Jorawar Singh + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralPWM.h" + +/*Function to write the given value to the pwm pin*/ + +void u8RPI_pwmWrites(uint8 pin, uint16 value){ + pwmWrite(pin, value); +} diff --git a/src/c/hardware/rasberrypi/soft/u8RPI_softPwmCreates.c b/src/c/hardware/rasberrypi/soft/u8RPI_softPwmCreates.c new file mode 100644 index 00000000..d6977798 --- /dev/null +++ b/src/c/hardware/rasberrypi/soft/u8RPI_softPwmCreates.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSoft.h" + +uint8 u8RPI_softPwmCreates(uint8 pin,uint16 ival,uint16 range){ + uint8 out; + out=softPwmCreate(pin,ival,range); + return (out); +} diff --git a/src/c/hardware/rasberrypi/soft/u8RPI_softPwmStops.c b/src/c/hardware/rasberrypi/soft/u8RPI_softPwmStops.c new file mode 100644 index 00000000..761fdc23 --- /dev/null +++ b/src/c/hardware/rasberrypi/soft/u8RPI_softPwmStops.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSoft.h" + +void u8RPI_softPwmStops(uint8 pin){ + softPwmStop(pin); +} diff --git a/src/c/hardware/rasberrypi/soft/u8RPI_softPwmWrites.c b/src/c/hardware/rasberrypi/soft/u8RPI_softPwmWrites.c new file mode 100644 index 00000000..2b76d148 --- /dev/null +++ b/src/c/hardware/rasberrypi/soft/u8RPI_softPwmWrites.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSoft.h" + +void u8RPI_softPwmWrites(uint8 pin,uint16 value){ + softPwmWrite(pin,value); +} diff --git a/src/c/hardware/rasberrypi/soft/u8RPI_softToneCreates.c b/src/c/hardware/rasberrypi/soft/u8RPI_softToneCreates.c new file mode 100644 index 00000000..dfcbb1fb --- /dev/null +++ b/src/c/hardware/rasberrypi/soft/u8RPI_softToneCreates.c @@ -0,0 +1,19 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSoft.h" + +uint8 u8RPI_softToneCreates(uint8 pin){ + uint8 out; + out=softToneCreate(pin); + return (out); +} diff --git a/src/c/hardware/rasberrypi/soft/u8RPI_softToneStops.c b/src/c/hardware/rasberrypi/soft/u8RPI_softToneStops.c new file mode 100644 index 00000000..664fbda4 --- /dev/null +++ b/src/c/hardware/rasberrypi/soft/u8RPI_softToneStops.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSoft.h" + +void u8RPI_softToneStops(uint8 pin){ + softToneStop(pin); +} diff --git a/src/c/hardware/rasberrypi/soft/u8RPI_softToneWrites.c b/src/c/hardware/rasberrypi/soft/u8RPI_softToneWrites.c new file mode 100644 index 00000000..be04b476 --- /dev/null +++ b/src/c/hardware/rasberrypi/soft/u8RPI_softToneWrites.c @@ -0,0 +1,17 @@ +/* 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: Jorawar Singh, Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "RPIPeripheralSoft.h" + +void u8RPI_softToneWrites(uint8 pin,uint32 value){ + softToneWrite(pin,value); +} diff --git a/src/c/imageProcessing/cvcore/imcvCreateImages.cpp b/src/c/imageProcessing/cvcore/imcvCreateImages.cpp new file mode 100644 index 00000000..a04e836a --- /dev/null +++ b/src/c/imageProcessing/cvcore/imcvCreateImages.cpp @@ -0,0 +1,46 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to create openCV image object from given specifications*/ + +#include "types.h" +#include "cvcore.hpp" +#include <stdio.h> + +using namespace cv; +using namespace std; + +Mat imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch) +{ + Mat img; + /*Create opencv matrix with given type*/ + if (strcmp(bit_depth,"CV_8U") == 0) + img = Mat(height,width,CV_8U); + else if (strcmp(bit_depth,"CV_8S") == 0) + img = Mat(height,width,CV_8S); + else if (strcmp(bit_depth,"CV_16U") == 0) + img = Mat(height,width,CV_16U); + else if (strcmp(bit_depth,"CV_16S") == 0) + img = Mat(height,width,CV_16S); + else if (strcmp(bit_depth,"CV_32F") == 0) + img = Mat(height,width,CV_32F); + else if (strcmp(bit_depth,"CV_32S") == 0) + img = Mat(height,width,CV_32S); + else if (strcmp(bit_depth,"CV_64F") == 0) + img = Mat(height,width,CV_64F); + + + /*Change no of channels to specified input*/ + img.reshape(no_of_ch); + + return img; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp b/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp new file mode 100644 index 00000000..0c4e848f --- /dev/null +++ b/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to convert image object to other color space*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" +#include <stdio.h> + +using namespace cv; +using namespace std; + +void imcvGetImgSizes(Mat src, double* imgsize) +{ + imgsize[0] = src.rows; + imgsize[1] = src.cols; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp b/src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp new file mode 100644 index 00000000..bf7ff07e --- /dev/null +++ b/src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to load image object from given filename*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvhighgui.hpp" +#include <stdio.h> + +Mat imcvLoadImages(char *filename, uint8 opentype) +{ + return (imread(filename,opentype)); +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvhighgui/imcvShowImages.cpp b/src/c/imageProcessing/cvhighgui/imcvShowImages.cpp new file mode 100644 index 00000000..6179c3dc --- /dev/null +++ b/src/c/imageProcessing/cvhighgui/imcvShowImages.cpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to create show an image */ + +#include "types.h" +#include "cvcore.hpp" +#include "cvhighgui.hpp" +#include <stdio.h> + +using namespace cv; + +uint8 imcvShowImages(char *winname, Mat img) +{ + imshow(winname,img); + + return (0); +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp b/src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp new file mode 100644 index 00000000..927cfb30 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp @@ -0,0 +1,47 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvAdaptThresholds(Mat src, double t_value, double maxvalue, char* AdaptiveMethod, \ + char* ThreholdType, double blocksize, double cont) +{ + + Mat dst(src.rows, src.cols, src.type()); + + if(strcmp(AdaptiveMethod,"ADAPTIVE_THRESH_MEAN_C") == 0) + { + if(strcmp(ThreholdType, "THRESH_BINARY") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_MEAN_C, \ + THRESH_BINARY,blocksize,cont); + else if(strcmp(ThreholdType, "THRESH_BINARY_INV") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_MEAN_C, \ + THRESH_BINARY_INV,blocksize,cont); + } + else if(strcmp(AdaptiveMethod,"ADAPTIVE_THRESH_GAUSSIAN_C") == 0) + { + if(strcmp(ThreholdType, "THRESH_BINARY") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_GAUSSIAN_C, \ + THRESH_BINARY,blocksize,cont); + else if(strcmp(ThreholdType, "THRESH_BINARY_INV") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_GAUSSIAN_C, \ + THRESH_BINARY_INV,blocksize,cont); + } + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvBlurs.cpp b/src/c/imageProcessing/cvimgproc/imcvBlurs.cpp new file mode 100644 index 00000000..d5c06de9 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvBlurs.cpp @@ -0,0 +1,55 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvBlurs(Mat src, double ksize_width, double ksize_height, double anchor_x, \ + double anchor_y, char* border_type) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + + Point anchor = Point(anchor_x,anchor_y); + Size2f ksize = Size2f(ksize_width, ksize_height); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + blur(src,dst,ksize,anchor,BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + blur(src,dst,ksize,anchor,BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + blur(src,dst,ksize,anchor,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + blur(src,dst,ksize,anchor,BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + blur(src,dst,ksize,anchor,BORDER_CONSTANT); + } + + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvCanny.cpp b/src/c/imageProcessing/cvimgproc/imcvCanny.cpp new file mode 100644 index 00000000..a81450bf --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvCanny.cpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to find edges in image */ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvCanny(Mat src, double threshold1, double threshold2, double \ + aperture_size, double L2gradient) +{ + + Mat dst = src.clone(); + + Canny(src, dst, threshold1, threshold2, aperture_size, L2gradient); + + return dst; +} diff --git a/src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp b/src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp new file mode 100644 index 00000000..d6df1cc6 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp @@ -0,0 +1,55 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to find edges using Harris algorithm*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvCornerHarris(Mat src, double blocksize, double ksize, double k, \ + char* border_type) +{ + + Mat dst(src.rows, src.cols, CV_32FC1); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_CONSTANT); + } + else if(strcmp(border_type,"BORDER_DEFAULT")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_DEFAULT); + } + + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp b/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp new file mode 100644 index 00000000..eaad278f --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp @@ -0,0 +1,148 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to convert image object to other color space*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" +#include <stdio.h> + +using namespace cv; + +Mat imcvCvtColors(Mat src, char* code) +{ + Mat dst(src.rows, src.cols, src.type()); + + /*RGB <--> Gray*/ + if(strcmp(code,"CV_RGB2GRAY") == 0) + {cvtColor(src,dst,CV_RGB2GRAY);} + else if(strcmp(code,"CV_BGR2GRAY") == 0) + {cvtColor(src,dst,CV_BGR2GRAY);} + else if(strcmp(code,"CV_GRAY2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_GRAY2RGB);} + else if(strcmp(code,"CV_GRAY2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_GRAY2BGR);} + + /*RGB <--> CIE XYZ.Rec 709 with D65 white point*/ + else if(strcmp(code,"CV_RGB2XYZ") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2XYZ);} + else if(strcmp(code,"CV_BGR2XYZ") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2XYZ);} + else if(strcmp(code,"CV_XYZ2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_XYZ2RGB);} + else if(strcmp(code,"CV_XYZ2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_XYZ2BGR);} + + /*RGB <--> YCrCb JPEG (or YCC) */ + else if(strcmp(code,"CV_BGR2YCrCb") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2YCrCb);} + else if(strcmp(code,"CV_RGB2YCrCb") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2YCrCb);} + else if(strcmp(code,"CV_YCrCb2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_YCrCb2BGR);} + else if(strcmp(code,"CV_YCrCb2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_YCrCb2RGB);} + + /*RGB <--> HSV */ + else if(strcmp(code,"CV_BGR2HSV") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2HSV);} + else if(strcmp(code,"CV_RGB2HSV") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2HSV);} + else if(strcmp(code,"CV_HSV2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HSV2BGR);} + else if(strcmp(code,"CV_HSV2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HSV2RGB);} + + /*RGB <--> HLS */ + else if(strcmp(code,"CV_BGR2HLS") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2HLS);} + else if(strcmp(code,"CV_RGB2HLS") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2HLS);} + else if(strcmp(code,"CV_HLS2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HLS2BGR);} + else if(strcmp(code,"CV_HLS2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HLS2RGB);} + + /*RGB <--> CIE L*a*b* */ + else if(strcmp(code,"CV_BGR2Lab") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2Lab);} + else if(strcmp(code,"CV_RGB2Lab") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2Lab);} + else if(strcmp(code,"CV_Lab2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Lab2BGR);} + else if(strcmp(code,"CV_Lab2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Lab2RGB);} + + /*RGB <--> CIE L*u*v* */ + else if(strcmp(code,"CV_BGR2Luv") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2Luv);} + else if(strcmp(code,"CV_RGB2Luv") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2Luv);} + else if(strcmp(code,"CV_Luv2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Luv2BGR);} + else if(strcmp(code,"CV_Luv2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Luv2RGB);} + + /*Bayer <--> RGB */ + else if(strcmp(code,"CV_BayerBG2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerBG2BGR);} + else if(strcmp(code,"CV_BayerGB2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGB2BGR);} + else if(strcmp(code,"CV_BayerRG2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerRG2BGR);} + else if(strcmp(code,"CV_BayerGR2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGR2BGR);} + else if(strcmp(code,"CV_BayerBG2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerBG2RGB);} + else if(strcmp(code,"CV_BayerGB2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGB2RGB);} + else if(strcmp(code,"CV_BayerRG2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerRG2RGB);} + else if(strcmp(code,"CV_BayerBG2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGR2RGB);} + return dst; +} diff --git a/src/c/imageProcessing/cvimgproc/imcvDilate.cpp b/src/c/imageProcessing/cvimgproc/imcvDilate.cpp new file mode 100644 index 00000000..1659cf58 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvDilate.cpp @@ -0,0 +1,71 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvDilate(Mat src, char* dilation_type, double size, double iterations, \ + char* border_type, double border_value) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + int dilate_type =0; + + if(strcmp(dilation_type,"MORPH_RECT") == 0) + { + dilate_type = MORPH_RECT; + } + else if(strcmp(dilation_type,"MORPH_CROSS") == 0) + { + dilate_type = MORPH_CROSS; + } + else if(strcmp(dilation_type,"MORPH_ELLIPSE") == 0) + { + dilate_type = MORPH_ELLIPSE; + } + + + Mat element = getStructuringElement(dilate_type, Size(size,size), \ + Point((size-1)/2,(size-1)/2)); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + dilate(src, dst, element, Point(-1,-1), iterations,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_CONSTANT, \ + Scalar(border_value)); + } + + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp b/src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp new file mode 100644 index 00000000..e53292a5 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp @@ -0,0 +1,41 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvDistanceTransforms(Mat src, char* distance_type, int mask_size ) +{ + + Mat dst(src.rows, src.cols, CV_32F); + + if(strcmp(distance_type,"CV_DIST_L1") == 0) + { + distanceTransform(src,dst,CV_DIST_L1,mask_size); + } + else if(strcmp(distance_type,"CV_DIST_L2") == 0) + { + distanceTransform(src,dst,CV_DIST_L2,mask_size); + } + else if(strcmp(distance_type,"CV_DIST_C") == 0) + { + distanceTransform(src,dst,CV_DIST_C,mask_size); + } + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvErode.cpp b/src/c/imageProcessing/cvimgproc/imcvErode.cpp new file mode 100644 index 00000000..64bae010 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvErode.cpp @@ -0,0 +1,71 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvErode(Mat src, char* erosion_type, double size, double iterations, \ + char* border_type, double border_value) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + int erode_type =0; + + if(strcmp(erosion_type,"MORPH_RECT") == 0) + { + erode_type = MORPH_RECT; + } + else if(strcmp(erosion_type,"MORPH_CROSS") == 0) + { + erode_type = MORPH_CROSS; + } + else if(strcmp(erosion_type,"MORPH_ELLIPSE") == 0) + { + erode_type = MORPH_ELLIPSE; + } + + + Mat element = getStructuringElement(erode_type, Size(size,size), \ + Point((size-1)/2,(size-1)/2)); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_CONSTANT, \ + Scalar(border_value)); + } + + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp b/src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp new file mode 100644 index 00000000..3c8c481f --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp @@ -0,0 +1,54 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvGaussianBlurs(Mat src, double ksize_width, double ksize_height, + double sigma_x, double sigma_y, char* border_type) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + + Size2f ksize = Size2f(ksize_width, ksize_height); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_CONSTANT); + } + + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp b/src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp new file mode 100644 index 00000000..d8e90ff9 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvMedianBlurs(Mat src, double ksize) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + + medianBlur(src,dst,(int)ksize); + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp b/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp new file mode 100644 index 00000000..9664a44c --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" +#include <stdio.h> + +using namespace cv; + +Mat imcvThresholds(Mat src, double t_value, double maxvalue, char* type) +{ + Mat dst(src.rows, src.cols, src.type()); + + if(strcmp(type,"THRESH_BINARY") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_BINARY); + if(strcmp(type,"THRESH_BINARY_INV") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_BINARY_INV); + if(strcmp(type,"THRESH_TRUNC") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_TRUNC); + if(strcmp(type,"THRESH_TOZERO") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_TOZERO); + if(strcmp(type,"THRESH_TOZERO_INV") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_TOZERO_INV); + + return dst; +}
\ No newline at end of file diff --git a/src/c/imageProcessing/includes/cvcore.hpp b/src/c/imageProcessing/includes/cvcore.hpp new file mode 100644 index 00000000..78876f7a --- /dev/null +++ b/src/c/imageProcessing/includes/cvcore.hpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CVCORE_H__ +#define __CVCORE_H__ + + +#include "types.h" +#include "opencv2/core/core.hpp" + +using namespace cv; + +Mat imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch); +void imcvGetImgSizes(Mat src, double* imgsize); + + +#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/cvhighgui.hpp b/src/c/imageProcessing/includes/cvhighgui.hpp new file mode 100644 index 00000000..167cb63a --- /dev/null +++ b/src/c/imageProcessing/includes/cvhighgui.hpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CVHIGHGUI_H__ +#define __CVHIGHGUI_H__ + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" + +using namespace cv; + +Mat imcvLoadImages(char *filename, uint8 opentype); +uint8 imcvShowImages(char *winname, Mat img); + + +#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/cvimgproc.hpp b/src/c/imageProcessing/includes/cvimgproc.hpp new file mode 100644 index 00000000..8fdf3e39 --- /dev/null +++ b/src/c/imageProcessing/includes/cvimgproc.hpp @@ -0,0 +1,52 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CVIMGPROC_H__ +#define __CVIMGPROC_H__ + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/imgproc/imgproc.hpp" + +using namespace cv; + +Mat imcvCvtColors(Mat src, char* code); + +Mat imcvThresholds(Mat src, double threshold, double maxvalue, char* type); + +Mat imcvAdaptThresholds(Mat src, double t_value, double maxvalue, char* AdaptiveMethod, \ + char* ThreholdType, double blocksize, double C); + +Mat imcvDistanceTransforms(Mat src, char* distance_type, int mask_size); + + +Mat imcvBlurs(Mat src, double ksize_width, double ksize_height, double anchor_x, \ + double anchor_y, char* border_type); + +Mat imcvGaussianBlurs(Mat src, double ksize_width, double ksize_height, double sigma_x, \ + double sigma_y, char* border_type); + +Mat imcvMedianBlurs(Mat src, double ksize); + +Mat imcvErode(Mat src, char* erosion_type, double size, double iterations, \ + char* border_type, double border_value); + +Mat imcvDilate(Mat src, char* dilation_type, double size, double iterations, \ + char* border_type, double border_value); + +Mat imcvCanny(Mat src, double threshold1, double threshold2, double \ + aperture_size, double L2gradient); + +Mat imcvCornerHarris(Mat src, double blocksize, double ksize, double k, \ + char* border_type); + +#endif /*__CVIMGPROC_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvcore.hpp b/src/c/imageProcessing/interfaces/int_cvcore.hpp new file mode 100644 index 00000000..82c1313e --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvcore.hpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CVCORE_H__ +#define __INT_CVCORE_H__ + + +#include "types.h" +#include "cvcore.hpp" + +#define d0d0g2d0CV_CreateImagemt0(width,height,depth,depth_size,no_of_ch) \ + imcvCreateImages(width,height,depth,no_of_ch) + +#define mt0CV_GetImgSized2(img,imgsize) imcvGetImgSizes(img,imgsize) + + +#endif /*__INT_CVCORE_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvhighgui.hpp b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp new file mode 100644 index 00000000..60d6ffdd --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CVHIGHGUI_H__ +#define __INT_CVHIGHGUI_H__ + + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" + +//#define g2d0CV_LoadImageim0(filename,name_size,loadtype) imcvLoadImages(filename,loadtype) +#define g2d0CV_LoadImagemt0(filename,name_size,loadtype) imread(filename,loadtype) +#define g2mt0CV_ShowImageu80(winname,win_size,img) imshow(winname,img) +#define mt0CV_ShowImage(img) imshow("",img) + +#define d0CV_WaitKey(delay) waitKey((int)delay) +#define s80CV_WaitKey(delay) waitKey((int)delay) +#define u80CV_WaitKey(delay) waitKey((int)delay) +#define i80CV_WaitKey(delay) waitKey((int)delay) +#define u160CV_WaitKey(delay) waitKey((int)delay) +#define i160CV_WaitKey(delay) waitKey((int)delay) + +#define g2mt0CV_SaveImage(filename,name_size,img) imwrite(filename,img) + +#endif /*__INT_CVHIGHGUI_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvimgproc.hpp b/src/c/imageProcessing/interfaces/int_cvimgproc.hpp new file mode 100644 index 00000000..9b1a85c9 --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvimgproc.hpp @@ -0,0 +1,71 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CVIMGPROC_H__ +#define __INT_CVIMGPROC_H__ + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/imgproc/imgproc.hpp" + +#define mt0g2CV_CvtColormt0(src,code,code_size) imcvCvtColors(src,code) + +#define mt0d0d0g2CV_Thresholdmt0(src,threshold,maxvalue,thresh_type, \ + type_size) imcvThresholds(src,threshold,maxvalue,thresh_type) + +#define mt0d0g2g2d0d0CV_AdaptiveThresholdmt0(src,maxvalue,adaptmethod, \ + adapt_size,thresh_type,blocksize,C) imcvAdaaptThresholds(src, \ + maxvalue,adaptmethod,thresh_type,blocksize,C) + +#define mt0g2d0CV_DistanceTransform(src,distance_type,type_size,mask_size) \ + imcvDistanceTransform(src,distance_type,mask_size) + +#define mt0d0d0d0d0g2CV_Blurmt0(src,ksize_width,ksize_height,anchor_x, \ + anchor_y,border_type,type_size) imcvBlurs(src,ksize_width, \ + ksize_height,anchor_x,anchor_y,border_type) + +#define mt0d0d0d0d0g2CV_GaussianBlurmt0(src,ksize_width,ksize_height,sigma_x, \ + sigma_y,border_type,type_size) imcvGaussianBlurs(src,ksize_width, \ + ksize_height,sigma_x,sigma_y,border_type) + +#define mt0d0CV_MedianBlurmt0(src,ksize) imcvMedianBlurs(src,ksize) + +#define mt0g2d0CV_Erodemt0(src,erosion_type,type_size,erosion_size) \ + imcvErode(src,erosion_type,erosion_size,1,"BORDER_CONSTANT",0) + +#define mt0g2d0d0g2d0CV_Erodemt0(src,erosion_type,type_size,erosion_size, \ + iterations,border_type,bor_size,border_value) \ + imcvErode(src,erosion_type,erosion_size,iterations,border_type, \ + border_value) + +#define mt0g2d0CV_Dilatemt0(src,dilation_type,type_size,dilation_size) \ + imcvDilate(src,dilation_type,dilation_size,1,"BORDER_CONSTANT",0) + +#define mt0g2d0d0g2d0CV_Dilatemt0(src,dilation_type,type_size,dilation_size, \ + iterations,border_type,bor_size,border_value) \ + imcvDilate(src,dilation_type,dilation_size,iterations,border_type, \ + border_value) + +#define mt0d0d0d0d0CV_Cannymt0(src,threshold1,threshold2,aperture_size, \ + L2gradient) imcvCanny(src,threshold1,threshold2,aperture_size, \ + L2gradient) + +#define mt0d0d0CV_Cannymt0(src,threshold1,threshold2) imcvCanny(src, \ + threshold1,threshold2,3,0) + +#define mt0d0d0d0g2CV_CornerHarrismt0(src,blocksize,ksize,k,border_type, \ + type_size) imcvCornerHarris(src,blocksize,ksize,k,border_type) + +#define mt0d0d0d0CV_CornerHarrismt0(src,blocksize,ksize,k) \ + imcvCornerHarris(src,blocksize,ksize,k,"BORDER_DEFAULT") + +#endif /*__INT_CVIMGPROC_H__*/ diff --git a/src/c/interpolation/includes/interp1.h b/src/c/interpolation/includes/interp1.h new file mode 100644 index 00000000..738bfe67 --- /dev/null +++ b/src/c/interpolation/includes/interp1.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INTERP1_H__ +#define __INTERP1_H__ + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +//void dinterp13a(double *x,double *fx,double *q,int size,double *out); +void dinterp13a(double *x,int size1,double *fx,int size2,double *q,int size3,char *a,int size4,double *out); + +void sinterp13a(float *x,int size1,float *fx,int size2,float *q,int size3,char *a,int size4,float *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/interpolation/interfaces/int_interp1.h b/src/c/interpolation/interfaces/int_interp1.h new file mode 100644 index 00000000..07d8ece4 --- /dev/null +++ b/src/c/interpolation/interfaces/int_interp1.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + + +#ifndef __INT_INTERP1_H__ +#define __INT_INTERP1_H__ + +#include "interp1.h" +#include <string.h> + +#define d2d2d2interp1d2(x,size1,fx,size2,q,size3,out) dinterp13a(x,size1[0]*size1[1],fx,size2[0]*size2[1],q,size3[0]*size3[1],"linear",6,out) + +#define d2d2d2g2interp1d2(x,size1,fx,size2,q,size3,ch,size4,out) dinterp13a(x,size1[0]*size1[1],fx,size2[0]*size2[1],q,size3[0]*size3[1],ch,size4[0]*size4[1],out) + +#define s2s2s2interp1s2(x,size1,fx,size2,q,size3,out) sinterp13a(x,size1[0]*size1[1],fx,size2[0]*size2[1],q,size3[0]*size3[1],"linear",6,out) + +#define s2s2s2g2interp1s2(x,size1,fx,size2,q,size3,ch,size4,out) sinterp13a(x,size1[0]*size1[1],fx,size2[0]*size2[1],q,size3[0]*size3[1],ch,size4[0]*size4[1],out) + + +#endif + diff --git a/src/c/interpolation/interp1/dinterp13a.c b/src/c/interpolation/interp1/dinterp13a.c new file mode 100644 index 00000000..7b755e1c --- /dev/null +++ b/src/c/interpolation/interp1/dinterp13a.c @@ -0,0 +1,75 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "interp1.h" +#include <string.h> + +void dinterp13a(double *x,int size1,double *fx,int size2,double *q,int size3,char *ch,int size4,double *out) +{ + int i,j,k,f; + double a,b; + if(strcmp(ch,"linear")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + a=x[j-1]; + b=x[j]; + out[i]=fx[j-1]+(q[i]-a)*((fx[j]-fx[j-1])/(b-a)); + } + } + } + else if(strcmp(ch,"nearest")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + out[i]=fx[j]; + } + } + } +} + + diff --git a/src/c/interpolation/interp1/sinterp13a.c b/src/c/interpolation/interp1/sinterp13a.c new file mode 100644 index 00000000..b8cb0851 --- /dev/null +++ b/src/c/interpolation/interp1/sinterp13a.c @@ -0,0 +1,75 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "interp1.h" +#include <string.h> + +void sinterp13a(float *x,int size1,float *fx,int size2,float *q,int size3,char *ch,int size4,float *out) +{ + int i,j,k,f; + float a,b; + if(strcmp(ch,"linear")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + a=x[j-1]; + b=x[j]; + out[i]=fx[j-1]+(q[i]-a)*((fx[j]-fx[j-1])/(b-a)); + } + } + } + else if(strcmp(ch,"nearest")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + out[i]=fx[j]; + } + } + } +} + + diff --git a/src/c/interpolation/interpln/dinterplna.c b/src/c/interpolation/interpln/dinterplna.c new file mode 100644 index 00000000..76cd7f83 --- /dev/null +++ b/src/c/interpolation/interpln/dinterplna.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "interpln.h" +#include "stdio.h" +#include "matrixInversion.h" +#include "matrixTranspose.h" + +void dinterplna(double* xyd, int nd, double* x, int x_row, int x_col) +{ + int md=2; + int n= x_col*x_row; + + + + +} + + diff --git a/src/c/interpolation/interpln/sinterp13a.c b/src/c/interpolation/interpln/sinterp13a.c new file mode 100644 index 00000000..b8cb0851 --- /dev/null +++ b/src/c/interpolation/interpln/sinterp13a.c @@ -0,0 +1,75 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "interp1.h" +#include <string.h> + +void sinterp13a(float *x,int size1,float *fx,int size2,float *q,int size3,char *ch,int size4,float *out) +{ + int i,j,k,f; + float a,b; + if(strcmp(ch,"linear")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + a=x[j-1]; + b=x[j]; + out[i]=fx[j-1]+(q[i]-a)*((fx[j]-fx[j-1])/(b-a)); + } + } + } + else if(strcmp(ch,"nearest")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + out[i]=fx[j]; + } + } + } +} + + diff --git a/src/c/linearAlgebra/balanc/dbalanca.c b/src/c/linearAlgebra/balanc/dbalanca.c new file mode 100644 index 00000000..a86a1967 --- /dev/null +++ b/src/c/linearAlgebra/balanc/dbalanca.c @@ -0,0 +1,75 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to balance given square matrix to improve its condition number*/ +#include "balanc.h" +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include "eye.h" + +void dbalanca(double* in1, int rows, double* in2, double* out1, \ + double* out2, double* out3, double* out4) +{ + char JOB = 'B'; + char RSIDE = 'R'; + char LSIDE = 'L'; + + int ILO, IHI, INFO; + double *buf1, *buf2, *LSCALE, *RSCALE; + double *LWORK; + + + if(in2 == NULL) + { + /*Single input matrix*/ + buf1 = (double*) malloc((double) rows*rows*sizeof(double)); + LSCALE = (double*) malloc((double) rows*sizeof(double)); + + /*copy input to temp buf as lapack function modifies input*/ + memcpy(buf1,in1,rows*rows*sizeof(double)); + + dgebal_(&JOB,&rows,buf1,&rows,&ILO,&IHI,LSCALE,&INFO); + deyea(out2,rows,rows); + dgebak_(&JOB,&RSIDE,&rows,&ILO,&IHI,LSCALE,&rows,out2,&rows,&INFO); + + /*copy computed matrix to output*/ + memcpy(out1,buf1,rows*rows*sizeof(double)); + } + else + { + /*two matrices as inputs*/ + buf1 = (double*) malloc((double) rows*rows*sizeof(double)); + buf2 = (double*) malloc((double) rows*rows*sizeof(double)); + LSCALE = (double*) malloc((double) rows*sizeof(double)); + RSCALE = (double*) malloc((double) rows*sizeof(double)); + LWORK = (double*) malloc((double) 6*rows*sizeof(double)); + + /*copy input to temp buf as lapack function modifies input*/ + memcpy(buf1,in1,rows*rows*sizeof(double)); + memcpy(buf2,in2,rows*rows*sizeof(double)); + + dggbal_(&JOB,&rows,buf1,&rows,buf2,&rows,&ILO,&IHI,LSCALE,RSCALE, \ + LWORK,&INFO); + deyea(out3,rows,rows); + deyea(out4,rows,rows); + + dgebak_(&JOB,&LSIDE,&rows,&ILO,&IHI,LSCALE,&rows,out3,&rows,&INFO); + dgebak_(&JOB,&RSIDE,&rows,&ILO,&IHI,LSCALE,&rows,out4,&rows,&INFO); + + /*copy computed matrix to output*/ + memcpy(out1,buf1,rows*rows*sizeof(double)); + memcpy(out2,buf2,rows*rows*sizeof(double)); + + } + +}
\ No newline at end of file diff --git a/src/c/linearAlgebra/bdiag/dbdiaga.c b/src/c/linearAlgebra/bdiag/dbdiaga.c new file mode 100644 index 00000000..fd455ba7 --- /dev/null +++ b/src/c/linearAlgebra/bdiag/dbdiaga.c @@ -0,0 +1,23 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*This function performs the block-diagonalization of matrix A.*/ + +/*--------------------------------------------------------------------------*/ +/* [Ab [,X [,bs]]]=bdiag(A [,rMax]) */ +/*--------------------------------------------------------------------------*/ + +#include <stdio.h> +#include "string.h" +#include "stdlib.h" +#include "lapack.h" + diff --git a/src/c/linearAlgebra/fullrf/dfullrfa.c b/src/c/linearAlgebra/fullrf/dfullrfa.c new file mode 100644 index 00000000..a409ae35 --- /dev/null +++ b/src/c/linearAlgebra/fullrf/dfullrfa.c @@ -0,0 +1,112 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* FULL Rank factorization function in scilab */ + +/* + //[Q,M,rk]=fullrf(A) + //Full rank factorization : A=Q.M + //with range(Q)=range(A) and ker(M)=ker(A), + //Q full column rank , M full row rank + // rk = rank(A) = #columns(Q) = #rows(M) + //F.D. +*/ + +#include "fullrf.h" +#include <stdio.h> +#include <stdlib.h> +#include "svd.h" +#include <math.h> +#include "norm.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" + +double dfullrfa(int ninp,double *inp1,int row,int col,double tol,double *out1,double *out2){ + + int i,j; + /* norm inp1 - norm(inp1,1)*/ + double na1; + na1 = dnorma(inp1,row,col,1); + + if(ninp == 1){ + tol = sqrt(pow(2,-52)); + } + + if(na1 < pow(1,-10)){ + out1 = NULL; + out2 = NULL; + return 0; + } + + double tol1; + tol1 = tol*na1; + + double *U,*S,*V; + U = (double *)malloc(row*row*sizeof(double)); + S = (double *)malloc(row*col*sizeof(double)); + V = (double *)malloc(col*col*sizeof(double)); + + double rk; + rk = dsvda(tol1,inp1,row,col,0,4,U,S,V); + + /* sq = sqrt(s) */ + for(i=0;i<row;i++){ + for(j=0;j<col;j++){ + if(i == j){ + S[i*row+j] = pow(S[i*row+j],0.5); + } + else{ + S[i*row+j] = 0; + } + } + } + + double *Q; + Q = (double *)malloc(row*col*sizeof(double)); + dmulma(U,row,row,S,row,col,Q); + + double *VT; + VT = (double *)malloc(col*col*sizeof(double)); + dtransposea(V,col,col,VT); + + /* multiplication of sq*V' or S*VT */ + double *M; + M = (double *)malloc(row*col*sizeof(double)); + dmulma(S,row,col,VT,col,col,M); + + /* This Program is not yet completed properly, as it outputs the whole matrix, instead of the exact output. + + if anyone finds, how to fix the size in INITFILLscidir.sci +please change there and change below few lines of codes accordingly. + +*/ + for(i=0;i<row;i++){ + for(j=0;j<col;j++){ + //if(j < rk) + out1[i*col+j] = Q[i*col+j]; + //else + // out1[i*col+j] = 0; + } + //printf("\n"); + } + + for(i=0;i<row;i++){ + for(j=0;j<col;j++){ + //if(i < rk) + out2[i*col+j] = M[i*col+j]; + //else + // out2[i*col+j] = 0; + } + } + + return rk; +} diff --git a/src/c/linearAlgebra/givens/dgivensa.c b/src/c/linearAlgebra/givens/dgivensa.c new file mode 100644 index 00000000..9bf0637b --- /dev/null +++ b/src/c/linearAlgebra/givens/dgivensa.c @@ -0,0 +1,76 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* GIVENS scilab function + Syntax : u=givens(xy) + u=givens(x,y) + xy = [x;y], u=givens(xy) + returns a 2*2 matrix u such that u*xy=[r;0]. + c is equal to u*xy + givens(x,y)=givens([x;y]) +*/ + +#include "givens.h" +#include <stdio.h> +#include <math.h> +#include "norm.h" + +/* All variable names are according to scilab code */ + +void dgivensa(int ninp,double *inp1,int row,int col,double *inp2,int row1,int col1,int nout,double *out1,double *out2){ + double *x; + double r; + x = (double *)malloc((double)2*sizeof(double)); + if(ninp == 2){ + if(row != 1 || col != 1 || row1 != 1 || col1 != 1){ + printf("Wrong size for input argument: A column vector expected.\n"); + return; + } + *(x) = *(inp1); + *(x+1) = *(inp2); + } + else{ + //printf("(%d %d)",row,col); + if(row != 2 || col != 1){ + printf("Wrong size for input argument: A column vector expected.\n"); + return; + } + //printf("(%lf %lf)",inp1[0],inp1[1]); + x[0] = inp1[0]; + x[1] = inp1[1]; + } + if(*(x+1) != 0){ + //printf("(%lf %lf)",x[0],x[1]); + /*Norm of type 2 - find the maximum singular value*/ + r = dnorma(x,2,1,2); + //printf("%lf \n",r); + *(out1) = (*(x))/r; + *(out1+1) = -(*(x+1))/r; + *(out1+2) = (*(x+1))/r; + *(out1+3) = (*(x))/r; + if(nout == 2){ + *(out2) = r; + *(out2+1) = 0; + } + + } + else{ + *(out1) = 1; + *(out1+1) = 0; + *(out1+2) = 1; + *(out1+3) = 0; + if(nout == 2){ + *(out2) = *(x); + *(out2+1) = *(x+1); + } + } +} diff --git a/src/c/linearAlgebra/hess/dhessa.c b/src/c/linearAlgebra/hess/dhessa.c new file mode 100644 index 00000000..e1f2e2d1 --- /dev/null +++ b/src/c/linearAlgebra/hess/dhessa.c @@ -0,0 +1,83 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*This function finds the hessenberg form of a matrix A.*/ + +#include "hess.h" +#include <stdio.h> +#include "string.h" +#include "stdlib.h" +#include "lapack.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" + +/* Lapack subroutines - which are used*/ +extern int dgehrd_(int *, int *,int *,double *,int *,double *,double *,int *,int *); +extern int dorghr_(int *, int *,int *,double *,int *,double *,double *,int *,int *); + +/* All the vairbale names are given exactly the same name as scilab source code */ +void dhessa(double *in1,int size,int nout,double *out1, double *out2){ +/* Variables names are done through, Lapack library. */ + int i,j,k; + int N = size; + int ILO=1; + int IHI=N; + double *A; + int LDA=N; + double *TAU; + double *WORK; + int LWORK = N; + int INFO; + A = (double *)malloc((double)size*size*sizeof(double)); + memcpy(A,in1,size*size*sizeof(double)); + TAU = (double *)malloc((double)size*sizeof(double)); + WORK = (double *)malloc((double)LWORK*sizeof(double)); + dgehrd_(&N,&ILO,&IHI,A,&LDA,TAU,WORK,&N,&INFO); + + for(i=0;i<N;i++) /* copying it in output */ + for(j=0;j<N;j++) + out2[i+j*N] = A[i+j*N]; + + for(j=1;j<=N-2;j++){ /* copying it in output */ + for(i=j+2;i<=N;i++){ + out2[(i-1)+(j-1)*N] = 0; + } + } + + if(nout > 1){ + dorghr_(&N,&ILO,&IHI,A,&LDA,TAU,WORK,&LWORK,&INFO); + for(i=0;i<N;i++) + for(j=0;j<N;j++) + out1[i+j*N] = A[i+j*N]; + } + + /*for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + if(i == j) out1[i+j*N]=1; + else out1[i+j*N]=0; + } + } + double result[size*size]; + for(i=IHI-2;i>=ILO-1;i--){ + tau = TAU[i]; + double V[size],v[size],v1[size*size]; + for(j=0;j<i;j++) V[j]=0; + V[j]=1*tau; + for(j=i+1;j<IHI;j++) V[j] = tau*A[j+i*N]; + dtransposea (V,N,1,v); + dmulma(V,N,1,v,1,N,v1); + for(j=0;j<N;j++) for(k=0;k<N;k++) if(j == k) v1[j+k*N]--; + for(j=0;j<N;j++) for(k=0;k<N;k++) result[j+k*N] = out1[j+k*N]; + dmulma(v1,N,N,result,N,N,out1); + }*/ + //out2 = NULL; +} diff --git a/src/c/linearAlgebra/householder/dhouseholdera.c b/src/c/linearAlgebra/householder/dhouseholdera.c new file mode 100644 index 00000000..5a98bfae --- /dev/null +++ b/src/c/linearAlgebra/householder/dhouseholdera.c @@ -0,0 +1,90 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* Householder orthogonal reflexion matrix */ + +/* +Syntax :- + //u=householder(v [,w]) + //Description + //given 2 column vectors v w of same size householder(v,w) returns a unitary + //column vector u, such that (eye-2*u*u')*v is proportional to w. + //(eye-2*u*u') is the orthogonal Householder reflexion matrix + // + // w default value is eye(v). In this case vector (eye-2*u*u')*v is the + // vector eye(v)*(+-norm(v)) +*/ +#include <stdio.h> +#include <stdlib.h> +#include "householder.h" +#include "eye.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include <math.h> +#include "norm.h" + +void dhouseholdera(int ninp,double *inp1,int row,double *inp2,double *out1){ + + int i,j; + double *x; + x = (double *)malloc(row*sizeof(double)); + + for(i=0;i<row;i++) + x[i] = inp1[i]; + + if(ninp < 2){ + deyea(x,row,1); + } + else{ + for(i=0;i<row;i++){ + x[i] = inp2[i]; + } + } + + /* vt transpose of inp1 */ + + double *vt; + vt = (double *)malloc(row*sizeof(double)); + dtransposea(inp1,row,1,vt); + + /*wt transpose of inp2 */ + double *wt; + wt = (double *)malloc(row*sizeof(double)); + dtransposea(x,row,1,wt); + + /* vvt = inp1*vt */ + double *vvt; + vvt = (double *)malloc(1*1*sizeof(double)); + dmulma(vt,1,row,inp1,row,1,vvt); + + /* wwt = inp2*wt */ + double *wwt; + wwt = (double *)malloc(1*1*sizeof(double)); + dmulma(wt,1,row,x,row,1,wwt); + + /* a=-sqrt((v'*v)/(w'*w)) */ + double a; + //a = (double *)malloc(1*1*sizeof(double)); + a = -sqrt(vvt[0]/wwt[0]); + + for(i=0;i<row;i++){ + out1[i] = x[i]*a+inp1[i]; + } + + /* norm of out1 */ + double r; + r = dnorma(out1,row,1,2); + + for(i=0;i<row;i++){ + out1[i]=out1[i]/r; + } +} diff --git a/src/c/linearAlgebra/includes/balanc.h b/src/c/linearAlgebra/includes/balanc.h new file mode 100644 index 00000000..dcc66b28 --- /dev/null +++ b/src/c/linearAlgebra/includes/balanc.h @@ -0,0 +1,27 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __BALANC_H__ +#define __BALANC_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +void dbalanca(double* in1, int rows, double* in2, double* out1, \ + double* out2, double* out3, double* out4); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__BALANC_H__*/ diff --git a/src/c/linearAlgebra/includes/fullrf.h b/src/c/linearAlgebra/includes/fullrf.h new file mode 100644 index 00000000..cc0a33d0 --- /dev/null +++ b/src/c/linearAlgebra/includes/fullrf.h @@ -0,0 +1,26 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __FULLRF_H__ +#define __FULLRF_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dfullrfa(int ninp,double *in1,int row,int col,double tol,double *out1,double *out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__FULLRF_H__*/ diff --git a/src/c/linearAlgebra/includes/givens.h b/src/c/linearAlgebra/includes/givens.h new file mode 100644 index 00000000..4aac91b2 --- /dev/null +++ b/src/c/linearAlgebra/includes/givens.h @@ -0,0 +1,25 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __GIVENS_H__ +#define __GIVENS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void dgivensa(int ninp,double *inp1,int row,int col,double *inp2,int row1,int col1,int nout,double *out1,double *out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__givens_H__*/ diff --git a/src/c/linearAlgebra/includes/hess.h b/src/c/linearAlgebra/includes/hess.h new file mode 100644 index 00000000..b9c53ded --- /dev/null +++ b/src/c/linearAlgebra/includes/hess.h @@ -0,0 +1,26 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __HESS_H__ +#define __HESS_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dhessa(double *in1,int size,int nout,double *out1,double *out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__HESS_H__*/ diff --git a/src/c/linearAlgebra/includes/householder.h b/src/c/linearAlgebra/includes/householder.h new file mode 100644 index 00000000..64350a15 --- /dev/null +++ b/src/c/linearAlgebra/includes/householder.h @@ -0,0 +1,26 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __HOUSEHOLDER_H__ +#define __HOUSEHOLDER_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dhouseholdera(int ninp,double *inp1,int row,double *inp2,double *out1); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__HOUSEHOLDER_H__*/ diff --git a/src/c/linearAlgebra/includes/lu.h b/src/c/linearAlgebra/includes/lu.h new file mode 100644 index 00000000..08f46637 --- /dev/null +++ b/src/c/linearAlgebra/includes/lu.h @@ -0,0 +1,33 @@ + /* 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 __LU_H__ +#define __LU_H__ +#include "types.h" +#include "doubleComplex.h" +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "lapack.h" +#include "string.h" +#include "matrixTranspose.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dlua(double*inp1, int size, double* out1, double* out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__LU_H__*/ diff --git a/src/c/linearAlgebra/includes/qr.h b/src/c/linearAlgebra/includes/qr.h new file mode 100644 index 00000000..2ed12e3a --- /dev/null +++ b/src/c/linearAlgebra/includes/qr.h @@ -0,0 +1,26 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __QR_H__ +#define __QR_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dqra(int ninp,int nout,double *inp1,int M,int N,double tol,double *out1,double *out2,double *out3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__QR_H__*/ diff --git a/src/c/linearAlgebra/includes/range.h b/src/c/linearAlgebra/includes/range.h new file mode 100644 index 00000000..cb1d3a3e --- /dev/null +++ b/src/c/linearAlgebra/includes/range.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 __RANGE_H__ +#define __RANGE_H__ +#include "types.h" +#include "eye.h" +#include "rowcomp.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double drangea(double* inp1, int row, int col, double inp2, double* out1); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RANGE_H__*/ diff --git a/src/c/linearAlgebra/includes/rank.h b/src/c/linearAlgebra/includes/rank.h new file mode 100644 index 00000000..0a21b4f8 --- /dev/null +++ b/src/c/linearAlgebra/includes/rank.h @@ -0,0 +1,29 @@ + /* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RANK_H__ +#define __RANK_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dranka(double* in1, int rows, int cols); + +doubleComplex zranka(doubleComplex* in1, int rows, int cols); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RANK_H__*/ diff --git a/src/c/linearAlgebra/includes/rcond.h b/src/c/linearAlgebra/includes/rcond.h new file mode 100644 index 00000000..4796f029 --- /dev/null +++ b/src/c/linearAlgebra/includes/rcond.h @@ -0,0 +1,26 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RCOND_H__ +#define __RCOND_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +double drconda(double* in1, int rows); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RCOND_H__*/ diff --git a/src/c/linearAlgebra/includes/rowcomp.h b/src/c/linearAlgebra/includes/rowcomp.h new file mode 100644 index 00000000..faf5a2a7 --- /dev/null +++ b/src/c/linearAlgebra/includes/rowcomp.h @@ -0,0 +1,26 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __ROWCOMP_H__ +#define __ROWCOMP_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double drowcompa(int ninp,double *A,int row,int col,char *flag,double tol,double *w); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ROWCOMP_H__*/ diff --git a/src/c/linearAlgebra/includes/schur.h b/src/c/linearAlgebra/includes/schur.h new file mode 100644 index 00000000..27b5c2aa --- /dev/null +++ b/src/c/linearAlgebra/includes/schur.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __SCHUR_H__ +#define __SCHUR_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +double dschura(double* in1, int size, int flag, int nout, double* out1, \ + double* out2); + +double dgschura(double* in1, int size, double* in2, int flag, int nout, \ + double* out1, double* out2, double* out3, double* out4); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__SCHUR_H__*/ diff --git a/src/c/linearAlgebra/includes/spec.h b/src/c/linearAlgebra/includes/spec.h new file mode 100644 index 00000000..3cd0b186 --- /dev/null +++ b/src/c/linearAlgebra/includes/spec.h @@ -0,0 +1,59 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 __SPEC_H__ +#define __SPEC_H__ + +#include "dynlib_matrixoperations.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* spec gives only the eigenvalues + If you want the eigenvalues and the eigenvectors, use spec2 */ + +/* spec */ +#define sspecs(in) in +#define dspecs(in) in +#define cspecs(in) in +#define zspecs(in) in + +EXTERN_MATOPS void sspeca(float* in, int rows, float* out); +EXTERN_MATOPS void dspeca(double* in, int rows, double* out); +EXTERN_MATOPS void cspeca(floatComplex* in, int rows, floatComplex* out); +EXTERN_MATOPS void zspeca(doubleComplex* in, int rows,doubleComplex* out); + + + +/* spec2 */ +#define sspec2s(in,out) sspecs(1);*out=in; +#define dspec2s(in,out) dspecs(1);*out=in; +#define cspec2s(in,out) cspecs(FloatComplex(1,0));*out=FloatComplex(creals(in),cimags(in)); +#define zspec2s(in,out) zspecs(DoubleComplex(1,0));*out=DoubleComplex(zreals(in),zimags(in)); + +EXTERN_MATOPS void sspec2a(float* in, int rows, float* eigenvalues,float* eigenvectors); +EXTERN_MATOPS void dspec2a(double* in, int rows, double* eigenvalues,double* eigenvectors); +EXTERN_MATOPS void cspec2a(floatComplex* in, int rows, floatComplex* eigenvalues,floatComplex* eigenvectors); +EXTERN_MATOPS void zspec2a(doubleComplex* in, int rows,doubleComplex* eigenvalues,doubleComplex* eigenvectors); + +/*Edited by - Sandeep Gupta, IITB FOSSEE*/ +void dspec1a(double *in1,double *in2,int size,int nout,doubleComplex *out1,double *out2,doubleComplex *out3,doubleComplex *out4); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SPEC_H__ */ diff --git a/src/c/linearAlgebra/includes/sqroot.h b/src/c/linearAlgebra/includes/sqroot.h new file mode 100644 index 00000000..9c1d9652 --- /dev/null +++ b/src/c/linearAlgebra/includes/sqroot.h @@ -0,0 +1,26 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __SQROOT_H__ +#define __SQROOT_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsqroota(double *inp,int row,int col,double *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__SQROOT_H__*/ diff --git a/src/c/linearAlgebra/includes/sva.h b/src/c/linearAlgebra/includes/sva.h new file mode 100644 index 00000000..ea628a32 --- /dev/null +++ b/src/c/linearAlgebra/includes/sva.h @@ -0,0 +1,29 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SVA_H__ +#define __SVA_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \ + double *out2,double *out3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__SVA_H__*/ + diff --git a/src/c/linearAlgebra/includes/svd.h b/src/c/linearAlgebra/includes/svd.h new file mode 100644 index 00000000..dea681fc --- /dev/null +++ b/src/c/linearAlgebra/includes/svd.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __SVD_H__ +#define __SVD_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dsvda(double tol,double *in1,int row,int col,double in2,double nout,double *out1, \ + double *out2,double *out3); +void zsvda(doubleComplex *in1,int row,int col,int in2,int nout, doubleComplex *out1,\ + doubleComplex *out2,doubleComplex *out3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__SVD_H__*/ diff --git a/src/c/linearAlgebra/interfaces/int_balanc.h b/src/c/linearAlgebra/interfaces/int_balanc.h new file mode 100644 index 00000000..a16ba8c2 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_balanc.h @@ -0,0 +1,29 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_BALANC_H__ +#define __INT_BALANC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2balancd2d2(in1,size1,out1,out2) dbalanca(in1,size1[0],NULL,out1, \ + out2,NULL,NULL) + +#define d2d2balancd2d2d2d2(in1,size1,in2,size2,out1,out2,out3,out4) \ + dbalanca(in1,size1[0],in2,out1,out2,out3,out4) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_BALANC_H__*/ diff --git a/src/c/linearAlgebra/interfaces/int_fullrf.h b/src/c/linearAlgebra/interfaces/int_fullrf.h new file mode 100644 index 00000000..1b8a067b --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_fullrf.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FULLRF_H__ +#define __INT_FULLRF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2fullrfd2d2d0(in1,size,out1,out2) dfullrfa(1,in1,size[0],size[1],0,out1,out2); +#define d2d0fullrfd2d2d0(in1,size,in2,out1,out2) dfullrfa(2,in1,size[0],size[1],in2,out1,out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_FULLRF_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_givens.h b/src/c/linearAlgebra/interfaces/int_givens.h new file mode 100644 index 00000000..ba30dbce --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_givens.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_GIVENS_H__ +#define __INT_GIVENS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2givensd2(in1,size,out1) dgivensa(1,in1,size[0],size[1],NULL,0,0,1,out1,NULL); +#define d2givensd2d2(in1,size,out1,out2) dgivensa(1,in1,size[0],size[1],NULL,0,0,2,out1,out2); + +#define d0d0givensd2d2(in1,in2,out1,out2) dgivensa(2,&in1,1,1,&in2,1,1,2,out1,out2); +#define d0d0givensd2(in1,out1) dgivensa(2,&in1,1,1,&in2,1,1,1,out1,NULL); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_GIVENS_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_hess.h b/src/c/linearAlgebra/interfaces/int_hess.h new file mode 100644 index 00000000..fb2ca720 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_hess.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_HESS_H__ +#define __INT_HESS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2hessd2(in1,size,out2) dhessa(in1,size[0],1,NULL,out2); +#define d2hessd2d2(in1,size,out1,out2) dhessa(in1,size[0],2,out1,out2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_HESS_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_householder.h b/src/c/linearAlgebra/interfaces/int_householder.h new file mode 100644 index 00000000..f8637197 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_householder.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_HOUSEHOLDER_H__ +#define __INT_HOUSEHOLDER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2householderd2(in1,size,out1) dhouseholdera(1,in1,size[0],NULL,out2); +#define d2d2householderd2(in1,size1,in2,size2,out1) dhouseholdera(2,in1,size1[0],in2,out1); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_HOUSEHOLDER_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_lu.h b/src/c/linearAlgebra/interfaces/int_lu.h new file mode 100644 index 00000000..44c258a7 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_lu.h @@ -0,0 +1,26 @@ + /* 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_LU_H__ +#define __INT_LU_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2lud2d2(in1,size1, out1,out2) dlua(in1,size1[0]*size1[1],out1,out2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_LU_H__*/ diff --git a/src/c/linearAlgebra/interfaces/int_qr.h b/src/c/linearAlgebra/interfaces/int_qr.h new file mode 100644 index 00000000..d34d8f41 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_qr.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_QR_H__ +#define __INT_QR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2qrd2d2(in1,size,out1,out2) dqra(1,2,in1,size[0],size[1],0,out1,out2,NULL); +#define d2qrd2d2d2(in1,size,out1,out2,out3) dqra(1,3,in1,size[0],size[1],0,out1,out2,out3); +#define d2g2qrd2d2(in1,size,in2,size1,out1,out2) dqra(2,2,in1,size[0],size[1],0,out1,out2,NULL); +#define d2g2qrd2d2d2(in1,size,in2,size1,out1,out2,out3) dqra(2,3,in1,size[0],size[1],0,out1,out2,out3); +#define d2d0qrd2d2d0d2(in1,size,in2,out1,out2,out3) dqra(2,4,in1,size[0],size[1],in2,out1,out2,out3); +#define d2qrd2d2d0d2(in1,size,out1,out2,out3) dqra(1,4,in1,size[0],size[1],0,out1,out2,out3); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_HESS_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_range.h b/src/c/linearAlgebra/interfaces/int_range.h new file mode 100644 index 00000000..d0c529d8 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_range.h @@ -0,0 +1,27 @@ + /* 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_RANGE_H__ +#define __INT_RANGE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2d0ranged2d0(in1,size1,in2,out1) drangea(in1,size1[0],size1[1],in2,out1) +#define d2ranged2d0(in1,size1,out1) drangea(in1,size1[0],size1[1], 1,out1) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RANGE_H__*/ diff --git a/src/c/linearAlgebra/interfaces/int_rank.h b/src/c/linearAlgebra/interfaces/int_rank.h new file mode 100644 index 00000000..5c04e717 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_rank.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_RANK_H__ +#define __INT_RANK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2rankd0(in1,size1) dranka(in1, size1[0], size1[1]) + +#define z2rankz0(in1,size1) zranka(in1, size1[0], size1[1]) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RANK_H__*/ diff --git a/src/c/linearAlgebra/interfaces/int_rcond.h b/src/c/linearAlgebra/interfaces/int_rcond.h new file mode 100644 index 00000000..6e6a4454 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_rcond.h @@ -0,0 +1,25 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_RCOND_H__ +#define __INT_RCOND_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2rcondd0(in1,size1) drconda(in1,size1[0]) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RCOND_H__*/ diff --git a/src/c/linearAlgebra/interfaces/int_rowcomp.h b/src/c/linearAlgebra/interfaces/int_rowcomp.h new file mode 100644 index 00000000..b72687d5 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_rowcomp.h @@ -0,0 +1,29 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ROWCOMP_H__ +#define __INT_ROWCOMP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2rowcompd2d0(in1,size,out1) drowcompa(1,in1,size[0],size[1],NULL,0,out1); +#define d2g2rowcompd2d0(in1,size,flag,size1,out1) drowcompa(2,in1,size[0],size[1],flag,0,out1); +#define d2g2d0rowcompd2d0(in1,size,flag,size1,tol,out1) drowcompa(2,in1,size[0],size[1],flag,tol,out1); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_ROWCOMP_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_schur.h b/src/c/linearAlgebra/interfaces/int_schur.h new file mode 100644 index 00000000..81324e66 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_schur.h @@ -0,0 +1,60 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_SCHUR_H__ +#define __INT_SCHUR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2schurd2(in1,size1,out1) dschura(in1,size1[0],0,1,out1,NULL) + +#define d2schurd2d2(in1,size1,out1,out2) dschura(in1,size1[0],0,2,out1,out2) + +#define d2g2schurd2(in1,size1,in2,size2,out1) (in2[0]=='c')? \ + dschura(in1,size1[0],1,1,out1,NULL): \ + dschura(in1,size1[0],2,1,out1,NULL) + +#define d2g2schurd2d0(in1,size1,in2,size2,out1) (in2[0]=='c')? \ + dschura(in1,size1[0],1,2,out1,NULL): \ + dschura(in1,size1[0],2,2,out1,NULL) + +#define d2g2schurd2d0d2(in1,size1,in2,size2,out1,out2) (in2[0]=='c')? \ + dschura(in1,size1[0],1,3,out1,out2): \ + dschura(in1,size1[0],2,3,out1,out2) + +#define d2d2schurd2d2(in1,size1,in2,size2,out1,out2) dgschura(in1,size1[0], \ + in2,0,2,out1,out2,NULL,NULL) + +#define d2d2schurd2d2d2d2(in1,size1,in2,size2,out1,out2,out3,out4) \ + dgschura(in1,size1[0],in2,0,4,out1,out2,out3,out4) + +#define d2d2g2schurd0(in1,size1,in2,size2,in3,size3) dgschura(in1,size1[0], \ + in2,1,1,NULL,NULL,NULL,NULL) + +#define d2d2g2schurd2d0(in1,size1,in2,size2,in3,size3,out1) \ + dgschura(in1,size1[0],in2,1,2,out1,NULL,NULL,NULL) + +#define d2d2g2schurd2d2d0(in1,size1,in2,size2,in3,size3,out1,out2) \ + dgschura(in1,size1[0],in2,1,3,out1,out2,NULL,NULL) + +#define d2d2g2schurd2d2d2d0(in1,size1,in2,size2,in3,size3,out1,out2,out3) \ + dgschura(in1,size1[0],in2,1,4,out1,out2,out3,NULL) + +#define d2d2g2schurd2d2d2d2d0(in1,size1,in2,size2,in3,size3,out1,out2,out3, \ + out4) dgschura(in1,size1[0],in2,1,5,out1,out2,out3,out4) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_SCHUR_H__*/ diff --git a/src/c/linearAlgebra/interfaces/int_spec.h b/src/c/linearAlgebra/interfaces/int_spec.h new file mode 100644 index 00000000..8772a6a6 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_spec.h @@ -0,0 +1,79 @@ +/* + * 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 + * + * Edited - Sandeep Gupta (FOSSEE) - IIT Bombay + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_SPEC_H__ +#define __INT_SPEC_H__ + +/* Only eigenvalues */ + +#define s0specc0(in) FloatComplex (sspecs(in) , 0) + +#define d0specz0(in) DoubleComplex ( dspecs(in) , 0) + +#define c0specc0(in) cspecs(in) + +#define z0specz0(in) zspecs(in) + +#define s2specc2(in,size,out) {float* ZEROS;\ + ZEROS=(float *)malloc((uint)(size[0]*size[0]*sizeof(float)));\ + szerosa(ZEROS,size[0],size[0]);\ + cspeca(FloatComplexMatrix(in,ZEROS,size[0]*size[0]), size[0], out);\ + } + +#define d2specz2(in,size,out) {double* ZEROS;\ + ZEROS=(double *)malloc((uint)(size[0]*size[0]*sizeof(double)));\ + dzerosa(ZEROS,size[0],size[0]);\ + zspeca(DoubleComplexMatrix(in,ZEROS,size[0]*size[0]), size[0] , out);\ + } + +#define c2specc2(in,size,out) cspeca(in, size[0], out) + +#define z2specz2(in,size,out) zspeca(in, size[0], out) + +/* Eigenvalues and eigenvectors */ + +#define s0specc0c0(in,out) cspec2s(FloatComplex( in,0) ,out) + +#define d0specz0z0(in,out) zspec2s(DoubleComplex(in,0) ,out) + +#define c0specc0c0(in,out) cspec2s(in,out) + +#define z0specz0z0(in,out) zspec2s(in,out) + +#define s2specc2c2(in,size,out1,out2) {float* ZEROS;\ + ZEROS=(float *)malloc((uint)(size[0]*size[0]*sizeof(float)));\ + szerosa(ZEROS,size[0],size[0]);\ + cspec2a(FloatComplexMatrix(in,ZEROS,size[0]*size[0]), size[0] , out1 , out2 );\ + } + +#define d2specz2z2(in,size,out1,out2) {double* ZEROS;\ + ZEROS=(double *)malloc((uint)(size[0]*size[0]*sizeof(double)));\ + dzerosa(ZEROS,size[0],size[0]);\ + zspec2a(DoubleComplexMatrix(in,ZEROS,size[0]*size[0]), size[0] , out1 , out2 );\ + } + + +#define c2specc2c2(in,size,out1,out2) cspec2a(in, size[0], out2, out1) + +#define z2specz2z2(in,size,out1,out2) zspec2a(in, size[0], out2, out1) + +/*Edited by Sandeep Gupta, IITB, FOSSEE Project.spec(A,B) */ + +#define d2d2specz2(in1,size,in2,size2,out1) dspec1a(in1,in2,size[0],1,out1,NULL,NULL,NULL) +#define d2d2specz2d2(in1,size,in2,size2,out1,out2) dspec1a(in1,in2,size[0],2,out1,out2,NULL,NULL) +#define d2d2specz2d2z2(in1,size,in2,size2,out1,out2,out3) dspec1a(in1,in2,size[0],3,out1,out2,out3,NULL) +#define d2d2specz2d2z2z2(in1,size,in2,size2,out1,out2,out3,out4) dspec1a(in1,in2,size[0],4,out1,out2,out3,out4) + +#endif /* !__INT_SPEC_H__ */ diff --git a/src/c/linearAlgebra/interfaces/int_sqroot.h b/src/c/linearAlgebra/interfaces/int_sqroot.h new file mode 100644 index 00000000..57af2c08 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_sqroot.h @@ -0,0 +1,27 @@ + /* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SQROOT_H__ +#define __INT_SQROOT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2sqrootd2(inp,size,out) dsqroota(inp,size[0],size[1],out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_HESS_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_sva.h b/src/c/linearAlgebra/interfaces/int_sva.h new file mode 100644 index 00000000..f1f8260a --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_sva.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SVA_H__ +#define __INT_SVA_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2svad2d2d2(in1,size,out1,out2,out3) dsvaa(1,in1,size[0],size[1],0,out1,out2,out3); +#define d2d0svad2d2d2(in1,size1,in2,out1,out2,out3) dsvaa(2,in1,size1[0],size1[1],in2,out1,out2,out3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_SVA_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_svd.h b/src/c/linearAlgebra/interfaces/int_svd.h new file mode 100644 index 00000000..8f40bffe --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_svd.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SVD_H__ +#define __INT_SVD_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2svdd2(in1,size1,out1) dsvda(0,in1,size1[0],size1[1],0,1,out1,NULL,NULL) +#define d2g2svdd2d2d2(in1,size1,in2,size2,out1,out2,out3) dsvda(0,in1,size1[0],size1[1],1,3,out1,out2,out3); +#define d2svdd2d2d2(in1,size1,out1,out2,out3) dsvda(0,in1,size1[0],size1[1],0,3,out1,out2,out3); + +#define d2svdd2d2d2d0(in1,size1,out1,out2,out3) dsvda(0,in1,size1[0],size1[1],0,4,out1,out2,out3); +#define d2d0svdd2d2d2d0(in1,size1,tol,out1,out2,out3) dsvda(tol,in1,size1[0],size1[1],0,4,out1,out2,out3); + +#define z2svdz2(in1,size1,out2) zsvda(in1,size1[0],size1[1],0,1,NULL,out2,NULL); +#define z2g2svdz2z2z2(in1,size1,in2,size2,out1,out2,out3) zsvda(in1,size1[0],size1[1],1,3,out1,out2,out3); +#define z2svdz2z2z2(in1,size1,out1,out2,out3) zsvda(in1,size1[0],size1[1],0,3,out1,out2,out3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_SVD_H__*/ diff --git a/src/c/linearAlgebra/lu/dlua.c b/src/c/linearAlgebra/lu/dlua.c new file mode 100644 index 00000000..d3cf6d11 --- /dev/null +++ b/src/c/linearAlgebra/lu/dlua.c @@ -0,0 +1,55 @@ +/* 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 <stdlib.h> +#include <math.h> +#include "lu.h" +#include "lapack.h" +#include "string.h" +#include "matrixTranspose.h" + +extern double dgetrf_ (int* , int* , double* , int* , int* , int* ); + +void dlua(double*inp1, int size, double* out1, double* out2) +{ + char TRANS = 'N'; + int INFO=3; + int LDA = 3; + int LDB = 3; + int N = 3; + int NRHS = 1; + int IPIV[2] ; + + /*double A[9] = + { + 1, 2, 3, + 2, 3, 4, + 3, 4, 1 + };*/ + + //void LAPACK_dgetrf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); +// dgetrf_(&N,&N,inp1,&LDA,IPIV,&INFO); + + dgetrf_(6,2,inp1,6,IPIV,&INFO); + + // checks INFO, if INFO != 0 something goes wrong, for more information see the MAN page of dgetrf. + for(int i = 0; i < 3*3; i++) + printf("%lf \n ", inp1[i]); + + printf("PIVOTTTTTT \n "); + + for(int i = 0; i < 2; i++) + printf("%d \n ", IPIV[i]); + + +} + diff --git a/src/c/linearAlgebra/pbig/pbig.c b/src/c/linearAlgebra/pbig/pbig.c new file mode 100644 index 00000000..c13a942d --- /dev/null +++ b/src/c/linearAlgebra/pbig/pbig.c @@ -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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*This function finds the hessenberg form of a matrix A.*/ + +#include "schur.h" +#include <stdio.h> +#include "string.h" +#include "stdlib.h" +#include "lapack.h" + +//Projection on eigensubspace associated with eigenvalues +//with real part >= thres (flag='c') or with modulus >= thres (flag='d') +//Projection is defined by Q*M. Eigenvalues of M*A*Q = eigenvalues +//of A with real part >= thres (case 'c',...). +//If [Q1,M1]== full rank factorization (fullrf) of eye-Q*M then evals of +// M1*A*Q1 = evals of A with real part < thres (case 'c',...). +// See also psmall. +//! + +void dpbiga(double *in1,int N,double *in2,double *in3,double *out1,double *out2){ + + + + +} diff --git a/src/c/linearAlgebra/proj/dproja.c b/src/c/linearAlgebra/proj/dproja.c new file mode 100644 index 00000000..e27cd6f2 --- /dev/null +++ b/src/c/linearAlgebra/proj/dproja.c @@ -0,0 +1,73 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* Scilab function proj code in C */ + +#include <stdio.h> +#include <stdlib.h> +#include "proj.h" +#include "eye.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include <math.h> +#include "norm.h" + + +double dproja(double *x1,int l,int k,double *x2,int m2,int n2,double *y){ + int i,j; + double *w; + w = (double *)malloc(l*l*sizeof(double)); + double rk; + rk = drowcompa(1,x1,l,k,NULL,0,w); + + double *w1; + w1 = (double *)malloc(rk*l*sizeof(double)); + + for(i=0;i<l*rk;i++){ + w1[i]=w[i]; + } + + double *x1t; + x1t = (double *)malloc((l-n)*l*sizeof(double); + + for(i=n;i<l;i++){ + for(j=0;j<l;j++){ + x1t[i-n+j*l] = w1[i+j*l]; + } + } + + double x1x2; + x1x2 = (double *)malloc((l-n+1)*n2*sizeof(double)); + dmulma(x1t,l-n+1,l,x2,m2,n2,x1x2); + + double *inx1x2; + inx1x2 = (double *)malloc(); + + + + + + + + + + + + + + + + + + + +} diff --git a/src/c/linearAlgebra/projspec/dprojspeca.c b/src/c/linearAlgebra/projspec/dprojspeca.c new file mode 100644 index 00000000..aea9713e --- /dev/null +++ b/src/c/linearAlgebra/projspec/dprojspeca.c @@ -0,0 +1,67 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* PROJSPEC function in scilab */ + +/* + //[S,P,D,index]=projspec(A) + //Spectral characteristics of A at 0 + //S = reduced resolvent at 0 (S=-Drazin_inverse(A)) + //P = spectral projection at 0 + //D = Nilpotent operator at 0 + //index = index of the 0 eigenvalue + //! + +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "norm.h" +#include "eye.h" + +#define eps pow(2,-52) + +double dprojspeca(double *inp1,int row,int col,double *out1,double *out2,double *out3){ + double tol = pow(10,-6); + int i,j,index; + /*norm(A,1)*/ + double nor; + nor = dnorma(inp1,row,col,1); + + /* P=eye(A),D=A,S=0*P;index=1; */ + if(nor < eps*row*row){ + memcpy(out2,inp1,row*col*sizeof(double)); + deyea(out2,row,col); + memcpy(out3,inp1,row*col*sizeof(double)); + for(i=0;i<row;i++){ + for(j=0;j<row;j++){ + out1[i*row+j] = 0; + } + } + index = 1; + } + + /* rcond(A) */ + double *rcon; + rcon = rcond(inp1,row); + if(rcon > tol){ + dinverma(inp1,out1,row); + for(i=0;i<row*col;i++){ + out2[i]=0; + out3[i]=0; + } + index = 0; + return index; + } + index = 1; +} diff --git a/src/c/linearAlgebra/qr/dqra.c b/src/c/linearAlgebra/qr/dqra.c new file mode 100644 index 00000000..bae4bc27 --- /dev/null +++ b/src/c/linearAlgebra/qr/dqra.c @@ -0,0 +1,298 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* This C code is used to generate function for QR decomposition */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "qr.h" +#include "lapack.h" +#include "string.h" +#include "matrixTranspose.h" + +/*For reference check Scilab source code & lapack library websites +Names of variable are almost same for convience. +*/ +/* +int min(int M,int N){ + if(M > N) return N; + return M; +} + +int max(int M,int N){ + if(M > N) return N; + return N; +}*/ + +/* External Function used of lapack library */ +extern double dgeqrf_(int *,int *,double *,int *,double *,double *,int *,int *); +extern double dlacpy_(char *,int *,int *,double *,int *,double *,int *); +extern double dgeqpf_(int *,int *,double *,int *,int *,double *,double *,int *); +extern double dorgqr_(int *,int *,int *,double *,int *,double *,double *,int *,int *); +extern void dlaset_(char *,int *,int *,double *,double *,double *,int *); + +/* function for finding qr */ +double dqra(int ninp,int nout,double *inp1,int M,int N,double tol,double *out1,double *out2,double *out3){ + int i,j; + char choice; + double alpha=0.0,beta=0.0; + int minMN = min(M,N); + + double *A; + A = (double *)malloc(M*N*sizeof(double)); + memcpy(A,inp1,M*N*sizeof(double)); + + if(M <= 0 || N <= 0){ + out1 = NULL; + out2 = NULL; + return 0; + } + /* doldqr */ + if(nout == 4){ /* [Q,R,rk,E]=qr(X [,tol]) */ + if(ninp == 1){ + tol = -1; + } + + int INFO,rk; + + int *JPVT; + JPVT = ( int *)malloc(N*sizeof(int)); + + double *TAU; + TAU = (double *)malloc(minMN*sizeof(double)); + + int LWORK = 3*N; + + double *WORK; + WORK = (double *)malloc(LWORK*sizeof(double)); + + for(i=1;i<=M;i++){ + JPVT[i-1]=0.0; + } + dgeqpf_(&M,&N,A,&M,JPVT,TAU,WORK,&INFO); + + choice = 'U'; + dlacpy_(&choice,&M,&N,A,&M,out2,&M); + + if(M > N){ + for(j=1;j<=N;j++){ + for(i=j+1;i<=M;i++){ + out2[i-1+(j-1)*M] = 0.0; + } + } + } + else{ + for(j=1;j<=M-1;j++){ + for(i=j+1;i<=M;i++){ + out2[i-1+(j-1)*M] = 0.0; + } + } + } + + if(M > N){ + choice = 'F'; + dlacpy_(&choice,&M,&N,A,&M,out1,&M); + for(j=N+1;j<=M;j++){ + for(i=1;i<=M;i++){ + out1[i-1+(j-1)*M] = 0.0; + } + } + } + else{ + choice = 'F'; + dlacpy_(&choice,&M,&M,A,&M,out1,&M); + } + + dorgqr_(&M,&M,&minMN,out1,&M,TAU,WORK,&LWORK,&INFO); + + choice = 'F'; + dlaset_(&choice,&N,&N,&alpha,&beta,out3,&N); + + for(j=1;j<=N;j++){ + i = JPVT[j-1]; + out3[i-1+(j-1)*N] = 1.0; + } + + double tt = abs(out2[0]); + + if(tol == -1){ + tol = (double)max(M,N)*pow(2,-52)*tt; + } + double ch; + //printf("%lf ",tol); + for(j=1;j<=minMN;j++){ + //printf("%e ",out2[(j-1)+(j-1)*M]); + if(out2[(j-1)+(j-1)*M] < 0){ + ch = -out2[(j-1)+(j-1)*M]; + } + else{ + ch = out2[(j-1)+(j-1)*M]; + } + if(ch > tol){ + rk = j; + } + else{ + break; + } + } + //printf("\n"); + return rk; + } + else if(ninp == 1){ + /* (intdgeqpf3) + [Q,R]=qr(A) + [Q,R,E]=qr(A) + */ + int LDA = M; + + double *TAU; + TAU = (double *)malloc(min(M,N)*sizeof(double)); + + int LWORK; + if(nout <= 2) + LWORK = N; + else + LWORK = 3*N; + + double *WORK; + WORK = (double *)malloc((LWORK+1)*sizeof(double)); + + int INFO; + + int *JPVT; + JPVT = (int *)malloc(N*sizeof(int)); + + if(nout <= 2){ + dgeqrf_(&M,&N,A,&M,TAU,WORK,&LWORK,&INFO); + } + else{ + for(i=0;i<N;i++){ + *(JPVT+i)=0.0; + } + dgeqpf_(&M,&N,A,&M,JPVT,TAU,WORK,&INFO); + } + + /* Copying code from A to R */ + choice = 'U'; + dlacpy_(&choice,&M,&N,A,&M,out2,&M); + /*for(i=0;i<M;i++){ + for(j=0;j<N-i;j++){ + out2[i+j*M] = A[i+j*M]; + } + }*/ + + if(M > N){ + for(j=1;j<=N;j++){ + for(i=j+1;i<=M;i++){ + out2[i-1+(j-1)*M] = 0.0; + } + } + } + else{ + for(j=1;j<=M-1;j++){ + for(i=j+1;i<=M;i++){ + out2[i-1+(j-1)*M] = 0.0; + } + } + } + /* lQ - out1 */ + if(M > N){ + choice = 'F'; + dlacpy_(&choice,&M,&N,A,&M,out1,&M); + /*for(i=0;i<M*N;i++){ + out1[i]=A[i]; + }*/ + for(j=N+1;j<=M;j++){ + for(i=1;i<=M;i++){ + out1[i+(j-1)*M] = 0.0; + } + } + } + else{ + choice = 'F'; + dlacpy_(&choice,&M,&M,A,&M,out1,&M); + /*for(i=0;i<M;i++){ + for(j=0;j<M;j++){ + out1 + } + }*/ + } + dorgqr_(&M,&M,&minMN,out1,&M,TAU,WORK,&LWORK,&INFO); + + if(nout > 2){ + choice = 'F'; + dlaset_(&choice,&N,&N,&alpha,&beta,out3,&N); + for(j=1;j<=N;j++){ + i = *(JPVT+j-1); + //printf("%d ",i-1+(j-1)*N); + *(out3+i-1+(j-1)*N) = 1.0; + } + //printf("\n"); + } + } + else{/* + [[Q,R]=qr(A,'e') + [Q,R,E]=qr(A,'e') ] */ + int *JPVT; + JPVT = (int *)malloc(N*sizeof(int)); + + double *TAU; + TAU = (double *)malloc(min(M,N)*sizeof(double)); + int LWORK; + if(nout <= 2){ + LWORK = N; + } + else{ + LWORK = 3*N; + } + + double *WORK; + WORK = (double *)malloc(LWORK*sizeof(double)); + + int INFO; + if(nout <= 2) + dgeqrf_(&M,&N,A,&M,TAU,WORK,&LWORK,&INFO); + else{ + for(i=1;i<=N;i++){ + JPVT[i-1]=0.0; + } + dgeqpf_(&M,&N,A,&M,JPVT,TAU,WORK,&INFO); + } + choice = 'U'; + + dlacpy_(&choice,&minMN,&N,A,&M,out2,&minMN); + + if(N >= 2){ + for(j=1;j<=N-1;j++){ + if(j+1 <= minMN){ + for(i=j+1;i<=minMN;i++){ + out2[i-1+(j-1)*minMN] = 0.0; + } + } + } + } + choice = 'F'; + dlacpy_(&choice,&M,&minMN,A,&M,out1,&M); + dorgqr_(&M,&minMN,&minMN,out1,&M,TAU,WORK,&LWORK,&INFO); + + if(nout > 2){ + choice = 'F'; + dlaset_(&choice,&N,&N,&alpha,&beta,out3,&N); + for(j=1;j<=N;j++){ + i = JPVT[j-1]; + out3[i-1+(j-1)*N] = 1.0; + } + } + } + return 0; +} diff --git a/src/c/linearAlgebra/range/drangea.c b/src/c/linearAlgebra/range/drangea.c new file mode 100644 index 00000000..7627f24a --- /dev/null +++ b/src/c/linearAlgebra/range/drangea.c @@ -0,0 +1,78 @@ +/* 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 "range.h" + +double drangea(double* inp1, int row, int col, double inp2, double* out1) +{ + double a[row*col], aprod[row*col], dim = 0, u[row*row], utrans[row*row], o[row*row], unew[row*col], otemp[row*col]; + if (inp2 == 0) + { + deyea(out1, row, col); + return row; + + } + + dim = drowcompa(1,inp1,row,col,NULL,0,u); + + + for(int i = 0; i < row*row; i++) + o[i] = u[i]; + + for(int i = 0; i < row*col; i++) + a[i] = inp1[i]; + + dtransposea(u,row,row, utrans); + + + for(int i = 2; i <= inp2; i++) + { + + dmulma(a, row, col, utrans, row, row, aprod); + + for(int i = 0; i < row*col; i++) + a[i] = aprod[i]; + + + double acut[row*(int)dim]; + + for(int i = 0; i < row*dim; i++) + acut[i] = a[i]; + + + + dim = drowcompa(1,acut,row,(int)dim,NULL,0,unew); + + for(int i = 0; i < row*col; i++) + u[i] = unew[i]; + + + + dmulma(u, row, row, o, row, col, otemp); + + for(int i = 0; i < row*col; i++) + o[i] = otemp[i]; + + + } + + + + for(int i = 0; i < row*col; i++) + out1[i] = o[i]; + + return dim; + +} diff --git a/src/c/linearAlgebra/rank/dranka.c b/src/c/linearAlgebra/rank/dranka.c new file mode 100644 index 00000000..ebfb5a80 --- /dev/null +++ b/src/c/linearAlgebra/rank/dranka.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to find inverse condition number of square matrix*/ + +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include "rank.h" +#include "svd.h" + +double dranka(double* in1, int rows, int cols) +{ + double out1[rows*rows]; + double out2[rows*cols]; + double out3[cols*cols]; + double rk; + + + rk = dsvda(0,in1,rows,cols, 0, 4, out1, out2, out3); + + + return rk; + +} diff --git a/src/c/linearAlgebra/rank/zranka.c b/src/c/linearAlgebra/rank/zranka.c new file mode 100644 index 00000000..0efad251 --- /dev/null +++ b/src/c/linearAlgebra/rank/zranka.c @@ -0,0 +1,82 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to find inverse condition number of square matrix*/ + +#include "lapack.h" +#include "stdlib.h" +#include "stdio.h" +#include "string.h" +#include "rank.h" +#include "svd.h" +#include "doubleComplex.h" +#include "addition.h" + +#define eps 2.22044604925e-16 + +doubleComplex zranka(doubleComplex* in1, int rows, int cols) +{ + doubleComplex out1[rows*rows]; + doubleComplex out2[rows*cols]; + doubleComplex out3[cols*cols]; + doubleComplex rk=0; + + + zsvda(in1,rows,cols, 0, 3, out1, out2, out3); + +double tol = (double)max(rows,cols)*eps*zreals(out2[0]) ; + +/* +for(int i=0; i< rows*rows; i++) + printf("%lf + i*%lf \t", zreals(out1[i]), zimags(out1[i])); +printf("\n"); + +for(int i=0; i< rows*cols; i++) + printf("%lf + i*%lf \t", zreals(out2[i]), zimags(out2[i])); +printf("\n"); + +for(int i=0; i< cols*cols; i++) + printf("%lf + i*%lf \t", zreals(out3[i]), zimags(out3[i])); +printf("\n"); + +*/ + +if(rows<cols) +{ + for(int i=0;i< rows;i++) + { + if( zreals(out2[i+i*rows]) > tol) + { + rk = zadds(rk,1); + } + } + +} + +else +{ + + for(int i=0;i< cols;i++) + { + if( zreals(out2[i+i*rows]) > tol) + { + rk = zadds(rk,1); + } + } + + + +} + + return rk; + +} diff --git a/src/c/linearAlgebra/rcond/drconda.c b/src/c/linearAlgebra/rcond/drconda.c new file mode 100644 index 00000000..a203c1e3 --- /dev/null +++ b/src/c/linearAlgebra/rcond/drconda.c @@ -0,0 +1,46 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to find inverse condition number of square matrix*/ + +#include "lapack.h" +#include "stdlib.h" +#include "string.h" + +double drconda(double* in1, int rows) +{ + double *buf, *LDWORK; + int INFO, *IPIV, *LIWORK; + char one = '1'; + double ANORM; + double RCOND = 1; + + buf = (double*) malloc((double) rows*rows*sizeof(double)); + IPIV = (int*) malloc((int) rows*sizeof(int)); + LIWORK = (int*) malloc((int) rows*sizeof(int)); + LDWORK = (double*) malloc((double) 4*rows*sizeof(double)); + + /*Copy input in temp buf, as lapack modifies input*/ + memcpy(buf,in1,rows*rows*sizeof(double)); + + ANORM = dlange_(&one,&rows,&rows,buf,&rows,LDWORK); + + dgetrf_(&rows,&rows,buf,&rows,IPIV,&INFO); + + if(INFO == 0) + { + dgecon_(&one,&rows,buf,&rows,&ANORM,&RCOND,LDWORK,LIWORK,&INFO); + } + + return RCOND; + +}
\ No newline at end of file diff --git a/src/c/linearAlgebra/rowcomp/drowcompa.c b/src/c/linearAlgebra/rowcomp/drowcompa.c new file mode 100644 index 00000000..3161a2d6 --- /dev/null +++ b/src/c/linearAlgebra/rowcomp/drowcompa.c @@ -0,0 +1,79 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* This function is used to find row compression, range */ + +#include "rowcomp.h" +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "svd.h" +#include "norm.h" +#include "eye.h" +#include "matrixTranspose.h" +#include "qr.h" + +/* All variable names, are in consideration of scilab documentation. for reference please check the scilab code.*/ + +double drowcompa(int ninp,double *A,int row,int col,char *flag,double tol,double *w){ + double rk; + double *U; + double *S; + double *V; + double *q,*r,*e; + if(row == 0 || col == 0){ + w = NULL; + return 0; + } + + double nA1 = dnorma(A,row,col,1); + if(nA1 < sqrt(pow(2,-52))/10){ + deyea(w,row,col); + return 0; + } + if(ninp == 1){ + flag = "svd"; + tol = sqrt(pow(2,-52))*nA1; + } + else if(ninp == 2){ + tol = sqrt(pow(2,-52))*nA1; + } + else{ + if(tol < 0){ /* if tolerance is negative */ + printf(" Wrong values for input argument #: Non-negative scalar expected"); + } + } + int M = row,N=col; + int minMN = min(M,N); + char check[3]="qr"; + //printf(" %s ",flag); + if(strcmp(check,flag) == 0){ + /* calling qr function*/ + //printf(" * "); + q = (double *)malloc(M*min(M,N)*sizeof(double)); + r = (double *)malloc(minMN*N*sizeof(double)); + e = (double *)malloc(N*N*sizeof(double)); + rk = dqra(2,4,A,M,N,tol,q,r,e); + memcpy(w,q,row*col*sizeof(double)); + dtransposea(q,row,row,w); + return rk; + } + else{ + /* svd function type */ + U = (double *)malloc(row*row*sizeof(double)); + S = (double *)malloc(row*col*sizeof(double)); + V = (double *)malloc(col*col*sizeof(double)); + rk = dsvda(tol,A,row,col,0,4,U,S,V); + dtransposea(U,row,row,w); + return rk; + } +} diff --git a/src/c/linearAlgebra/schur/dgschura.c b/src/c/linearAlgebra/schur/dgschura.c new file mode 100644 index 00000000..f17da8c8 --- /dev/null +++ b/src/c/linearAlgebra/schur/dgschura.c @@ -0,0 +1,161 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Fucntion to find generalised schur decomposition of given square matrices */ +#include "schur.h" +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include <math.h> + +/*flag --> 0: nothing + --> 1: continuous + --> 2: discrete +*/ + +lapack_logical selctg21( double* in1, double* in2, double* in3); +lapack_logical selctg22( double* in1, double* in2, double* in3); + +double dgschura(double* in1, int size, double* in2, int flag, int nout, \ + double* out1, double* out2, double* out3, double* out4) +{ + char JOBVSL = 'N'; + char JOBVSR = 'N'; + char SORT = 'N'; + int SDIM = 0; + int LDVSL = size, LDVSR = size; + int LWORK = 8*size+16, INFO; + double *ALPHAR, *ALPHAI, *BETA, *VSL, *VSR, *WORK; + int *BWORK; + double ret = 0; + double *buf1, *buf2; /*input is copied to buf, since lapack function directly + modifies the input variable*/ + + /*Used incase of flag > 0*/ + LAPACK_D_SELECT3 selctg = &selctg21; + + if(nout >= 2){ + JOBVSL = 'V'; + JOBVSR = 'V'; + } + if(flag > 0) SORT = 'S'; + + buf1 = (double*) malloc((double) size*size*sizeof(double)); + buf2 = (double*) malloc((double) size*size*sizeof(double)); + ALPHAR = (double*) malloc((double) size*sizeof(double)); + ALPHAI = (double*) malloc((double) size*sizeof(double)); + BETA = (double*) malloc((double) size*sizeof(double)); + VSL = (double*) malloc((double) LDVSL*size*sizeof(double)); + VSR = (double*) malloc((double) LDVSR*size*sizeof(double)); + WORK = (double*) malloc((double) LWORK*sizeof(double)); + BWORK = (int*) malloc((double) size*sizeof(double)); + + + memcpy(buf1,in1,size*size*sizeof(double)); + memcpy(buf2,in2,size*size*sizeof(double)); + + dgges_(&JOBVSL,&JOBVSR,&SORT,selctg,&size,buf1,&size,buf2,&size,&SDIM, \ + ALPHAR,ALPHAI,BETA,VSL,&LDVSL,VSR,&LDVSR,WORK,&LWORK,BWORK,&INFO); + + /*if (INFO != 0) + { + out1 = NULL; + return 0; + }*/ + + if(nout == 1) + { + return(SDIM); + } + else if(nout == 2) + { + if(flag == 0) + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(double)); + memcpy(out2,buf2,size*size*sizeof(double)); + } + else + { + /*copy VSR to out1 and return SDIM */ + memcpy(out1,VSR,size*size*sizeof(double)); + ret = SDIM; + } + } + else if(nout == 3) + { + /*copy VSL to out1, VSR to out2, return SDIM*/ + memcpy(out1,VSL,size*size*sizeof(double)); + memcpy(out2,VSR,size*size*sizeof(double)); + ret = SDIM; + } + else if(nout == 4) + { + if(flag == 0) + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(double)); + memcpy(out2,buf2,size*size*sizeof(double)); + /*copy VSL to out3 and VSR to out4*/ + memcpy(out3,VSL,size*size*sizeof(double)); + memcpy(out4,VSR,size*size*sizeof(double)); + } + else + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(double)); + memcpy(out2,buf2,size*size*sizeof(double)); + /*copy VSR to out3 and return SDIM*/ + memcpy(out3,VSR,size*size*sizeof(double)); + ret = SDIM; + } + } + else /*nout = 5*/ + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(double)); + memcpy(out2,buf2,size*size*sizeof(double)); + /*copy VSL to out3 and VSR to out4*/ + memcpy(out3,VSL,size*size*sizeof(double)); + memcpy(out4,VSR,size*size*sizeof(double)); + /*return SDIM*/ + ret = SDIM; + } + + free(buf1); + free(buf2); + free(VSL); + free(VSR); + free(ALPHAR); + free(ALPHAI); + free(BETA); + free(WORK); + free(BWORK); + + return ret; +} + +lapack_logical selctg21(double* in1, double* in2, double* in3) +{ + if((sqrt(*in1**in1+*in2**in2)/ *in3) < 1) + return 1; + else + return 0; +} + +lapack_logical selctg22(double* in1, double* in2, double* in3) +{ + if((sqrt(*in1**in1+*in2**in2)/ *in3) < 1) + return 1; + else + return 0; +}
\ No newline at end of file diff --git a/src/c/linearAlgebra/schur/dschura.c b/src/c/linearAlgebra/schur/dschura.c new file mode 100644 index 00000000..802caa81 --- /dev/null +++ b/src/c/linearAlgebra/schur/dschura.c @@ -0,0 +1,126 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to find schur decomposition of given square matrix */ +#include "schur.h" +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include <math.h> + +/*flag --> 0: nothing + --> 1: continuous + --> 2: discrete +*/ + +lapack_logical selctg11( double* in1, double* in2); +lapack_logical selctg12( double* in1, double* in2); + +double dschura(double* in1, int size, int flag, int nout, double* out1, \ + double* out2) +{ + char JOBVS = 'N'; + char SORT = 'N'; + int SDIM = 0; + int LVDS = size; + int LWORK = 3*size, INFO; + double *WR, *WI, *VS, *WORK; + int *BWORK; + double ret = 0; + double *buf; /*input is copied to buf, since lapack function direclty + modifies the input variable*/ + + + /*Used incase of flag > 0*/ + LAPACK_D_SELECT2 selctg; + + if(flag == 1 || flag == 0) + selctg = &selctg11; + else if(flag == 2) + selctg = &selctg12; + + if(nout >= 2) JOBVS = 'V'; + if(flag > 0) SORT = 'S'; + + buf = (double*) malloc((double) size*size*sizeof(double)); + WR = (double*) malloc((double) size*sizeof(double)); + WI = (double*) malloc((double) size*sizeof(double)); + VS = (double*) malloc((double) LVDS*size*sizeof(double)); + WORK = (double*) malloc((double) LWORK*sizeof(double)); + BWORK = (int*) malloc((double) size*sizeof(double)); + + + memcpy(buf,in1,size*size*sizeof(double)); + + dgees_(&JOBVS,&SORT,selctg,&size,buf,&size,&SDIM,WR,WI,VS,&LVDS, \ + WORK,&LWORK,BWORK,&INFO); + + /*if (INFO != 0) + { + out1 = NULL; + return 0; + } */ + + if(nout == 1) + { + /*Copy result in in1 to out1*/ + memcpy(out1,buf,size*size*sizeof(double)); + } + else if(nout == 2) + { + if(flag == 0) + { + /*copy in1 to out2 and VS to out1*/ + memcpy(out2,buf,size*size*sizeof(double)); + memcpy(out1,VS,size*size*sizeof(double)); + } + else + { + /*copy VS to out1 and SDIM to out2*/ + memcpy(out1,VS,size*size*sizeof(double)); + ret = SDIM; + } + } + else + { + /*copy VS to out1, SDIM to out2, in1 to out3*/ + memcpy(out1,VS,size*size*sizeof(double)); + memcpy(out2,buf,size*size*sizeof(double)); + ret = SDIM; + } + + free(buf); + free(WI); + free(WR); + free(VS); + free(WORK); + free(BWORK); + + return ret; +} + +lapack_logical selctg11(double* in1, double* in2) +{ + if(*in1 <= 0) + return 1; + else + return 0; +} + +lapack_logical selctg12(double* in1, double* in2) +{ + + if(sqrt(*in1**in1+*in2**in2) < 1) + return 1; + else + return 0; +}
\ No newline at end of file diff --git a/src/c/linearAlgebra/schur/zgschura.c b/src/c/linearAlgebra/schur/zgschura.c new file mode 100644 index 00000000..a49cbe51 --- /dev/null +++ b/src/c/linearAlgebra/schur/zgschura.c @@ -0,0 +1,164 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Fucntion to find generalised schur decomposition of given square complex matrices */ + +#include "schur.h" +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include <math.h> +#include "doubleComplex.h" +#include "matrixTranspose.h" + +/*flag --> 0: nothing + --> 1: continuous + --> 2: discrete +*/ + +lapack_logical selctg21( doubleComplex* in1, doubleComplex* in2, doubleComplex* in3); +lapack_logical selctg22( doubleComplex* in1, doubleComplex* in2, doubleComplex* in3); + +doubleComplex dgschura(doubleComplex* in1, int size, doubleComplex* in2, int flag, int nout, \ + doubleComplex* out1, doubleComplex* out2, doubleComplex* out3, doubleComplex* out4) +{ + char JOBVSL = 'N'; + char JOBVSR = 'N'; + char SORT = 'N'; + int SDIM = 0; + int LDVSL = size, LDVSR = size; + int LWORK = 2*size, INFO; + doubleComplex *ALPHA, *BETA, *VSL, *VSR, *WORK; + double *RWORK; + int *BWORK; + doubleComplex ret = 0; + doubleComplex *buf1, *buf2; /*input is copied to buf, since lapack function directly + modifies the input variable*/ + + /*Used incase of flag > 0*/ + LAPACK_D_SELECT3 selctg = &selctg21; + + if(nout >= 2){ + JOBVSL = 'V'; + JOBVSR = 'V'; + } + if(flag > 0) SORT = 'S'; + + buf1 = (doubleComplex*) malloc((doubleComplex) size*size*sizeof(doubleComplex)); + buf2 = (doubleComplex*) malloc((doubleComplex) size*size*sizeof(doubleComplex)); + ALPHA = (doubleComplex*) malloc((doubleComplex) size*sizeof(doubleComplex)); + RWORK = (double *)malloc((double)8*size*sizeof(double)); + BETA = (doubleComplex*) malloc((doubleComplex) size*sizeof(doubleComplex)); + VSL = (doubleComplex*) malloc((doubleComplex) LDVSL*size*sizeof(doubleComplex)); + VSR = (doubleComplex*) malloc((doubleComplex) LDVSR*size*sizeof(doubleComplex)); + WORK = (doubleComplex*) malloc((doubleComplex) LWORK*sizeof(doubleComplex)); + BWORK = (int*) malloc((doubleComplex) size*sizeof(doubleComplex)); + + + memcpy(buf1,in1,size*size*sizeof(doubleComplex)); + memcpy(buf2,in2,size*size*sizeof(doubleComplex)); + + zgges_(&JOBVSL,&JOBVSR,&SORT,selctg,&size,buf1,&size,buf2,&size,&SDIM, \ + ALPHA,BETA,VSL,&LDVSL,VSR,&LDVSR,WORK,&LWORK,RWORK,BWORK,&INFO); + + /*if (INFO != 0) + { + out1 = NULL; + return 0; + }*/ + + if(nout == 1) + { + return(SDIM); + } + else if(nout == 2) + { + if(flag == 0) + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(doubleComplex)); + memcpy(out2,buf2,size*size*sizeof(doubleComplex)); + } + else + { + /*copy VSR to out1 and return SDIM */ + memcpy(out1,VSR,size*size*sizeof(doubleComplex)); + ret = SDIM; + } + } + else if(nout == 3) + { + /*copy VSL to out1, VSR to out2, return SDIM*/ + memcpy(out1,VSL,size*size*sizeof(doubleComplex)); + memcpy(out2,VSR,size*size*sizeof(doubleComplex)); + ret = SDIM; + } + else if(nout == 4) + { + if(flag == 0) + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(doubleComplex)); + memcpy(out2,buf2,size*size*sizeof(doubleComplex)); + /*copy VSL to out3 and VSR to out4*/ + memcpy(out3,VSL,size*size*sizeof(doubleComplex)); + memcpy(out4,VSR,size*size*sizeof(doubleComplex)); + } + else + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(doubleComplex)); + memcpy(out2,buf2,size*size*sizeof(doubleComplex)); + /*copy VSR to out3 and return SDIM*/ + memcpy(out3,VSR,size*size*sizeof(doubleComplex)); + ret = SDIM; + } + } + else /*nout = 5*/ + { + /*copy in1 to out1 and in2 to out2*/ + memcpy(out1,buf1,size*size*sizeof(doubleComplex)); + memcpy(out2,buf2,size*size*sizeof(doubleComplex)); + /*copy VSL to out3 and VSR to out4*/ + memcpy(out3,VSL,size*size*sizeof(doubleComplex)); + memcpy(out4,VSR,size*size*sizeof(doubleComplex)); + /*return SDIM*/ + ret = SDIM; + } + + free(buf1); + free(buf2); + free(VSL); + free(VSR); + free(ALPHA); + free(BETA); + free(WORK); + free(BWORK); + + return ret; +} + +lapack_logical selctg21(doubleComplex* in1, doubleComplex* in2, doubleComplex* in3) +{ + if((sqrt(*in1**in1+*in2**in2)/ *in3) < 1) + return 1; + else + return 0; +} + +lapack_logical selctg22(doubleComplex* in1, doubleComplex* in2, doubleComplex* in3) +{ + if((sqrt(*in1**in1+*in2**in2)/ *in3) < 1) + return 1; + else + return 0; +} diff --git a/src/c/linearAlgebra/spec/Makefile.am b/src/c/linearAlgebra/spec/Makefile.am new file mode 100644 index 00000000..90dbd0aa --- /dev/null +++ b/src/c/linearAlgebra/spec/Makefile.am @@ -0,0 +1,70 @@ +## +## Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +## Copyright (C) 2006-2008 - INRIA - Bruno JOFRET +## +## This file must be used under the terms of the CeCILL. +## This source file is licensed as described in the file COPYING, which +## you should have received as part of this distribution. The terms +## are also available at +## http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +## +## + +libSpec_la_CFLAGS = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + + +instdir = $(top_builddir)/lib + +pkglib_LTLIBRARIES = libSpec.la + +HEAD = ../includes/spec.h + +libSpec_la_SOURCES = $(HEAD) \ + sspeca.c \ + dspeca.c \ + cspeca.c \ + zspeca.c + + +############ +## CHECK +############ + + +check_PROGRAMS = testDoubleSpec testFloatSpec + +check_LDADD = $(top_builddir)/src/c/type/libDoubleComplex.la \ + $(top_builddir)/src/c/type/libFloatComplex.la \ + $(top_builddir)/src/c/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/src/fortran/lapack/libscilapack.la \ + $(top_builddir)/src/fortran/blas/libsciblas.la \ + $(top_builddir)/src/c/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/src/c/auxiliaryFunctions/conj/libConj.la \ + $(top_builddir)/src/c/auxiliaryFunctions/sign/libSign.la \ + $(top_builddir)/src/c/auxiliaryFunctions/pythag/libPythag.la \ + $(top_builddir)/src/c/operations/addition/libAddition.la \ + $(top_builddir)/src/c/operations/multiplication/libMultiplication.la \ + $(top_builddir)/src/c/matrixOperations/inversion/libMatrixInversion.la\ + $(top_builddir)/src/c/matrixOperations/zeros/libMatrixZeros.la\ + libSpec.la + +check_INCLUDES = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + +testDoubleSpec_SOURCES = testDoubleSpec.c +testDoubleSpec_LDADD = $(check_LDADD) +testDoubleSpec_CFLAGS = $(check_INCLUDES) + +testFloatSpec_SOURCES = testFloatSpec.c +testFloatSpec_LDADD = $(check_LDADD) +testFloatSpec_CFLAGS = $(check_INCLUDES) + +TESTS = testDoubleSpec testFloatSpec + diff --git a/src/c/linearAlgebra/spec/Makefile.in b/src/c/linearAlgebra/spec/Makefile.in new file mode 100644 index 00000000..9c34c9e6 --- /dev/null +++ b/src/c/linearAlgebra/spec/Makefile.in @@ -0,0 +1,755 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = testDoubleSpec$(EXEEXT) testFloatSpec$(EXEEXT) +TESTS = testDoubleSpec$(EXEEXT) testFloatSpec$(EXEEXT) +subdir = src/c/matrixOperations/spec +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/includes/machine.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkglibdir)" +LTLIBRARIES = $(pkglib_LTLIBRARIES) +libSpec_la_LIBADD = +am__objects_1 = +am_libSpec_la_OBJECTS = $(am__objects_1) libSpec_la-sspeca.lo \ + libSpec_la-dspeca.lo libSpec_la-cspeca.lo libSpec_la-zspeca.lo +libSpec_la_OBJECTS = $(am_libSpec_la_OBJECTS) +libSpec_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libSpec_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testDoubleSpec_OBJECTS = testDoubleSpec-testDoubleSpec.$(OBJEXT) +testDoubleSpec_OBJECTS = $(am_testDoubleSpec_OBJECTS) +testDoubleSpec_DEPENDENCIES = $(check_LDADD) +testDoubleSpec_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleSpec_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testFloatSpec_OBJECTS = testFloatSpec-testFloatSpec.$(OBJEXT) +testFloatSpec_OBJECTS = $(am_testFloatSpec_OBJECTS) +testFloatSpec_DEPENDENCIES = $(check_LDADD) +testFloatSpec_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatSpec_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libSpec_la_SOURCES) $(testDoubleSpec_SOURCES) \ + $(testFloatSpec_SOURCES) +DIST_SOURCES = $(libSpec_la_SOURCES) $(testDoubleSpec_SOURCES) \ + $(testFloatSpec_SOURCES) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBMATH = @LIBMATH@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libSpec_la_CFLAGS = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + +instdir = $(top_builddir)/lib +pkglib_LTLIBRARIES = libSpec.la +HEAD = ../includes/spec.h +libSpec_la_SOURCES = $(HEAD) \ + sspeca.c \ + dspeca.c \ + cspeca.c \ + zspeca.c + +check_LDADD = $(top_builddir)/src/c/type/libDoubleComplex.la \ + $(top_builddir)/src/c/type/libFloatComplex.la \ + $(top_builddir)/src/c/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/src/fortran/lapack/libscilapack.la \ + $(top_builddir)/src/fortran/blas/libsciblas.la \ + $(top_builddir)/src/c/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/src/c/auxiliaryFunctions/conj/libConj.la \ + $(top_builddir)/src/c/auxiliaryFunctions/sign/libSign.la \ + $(top_builddir)/src/c/auxiliaryFunctions/pythag/libPythag.la \ + $(top_builddir)/src/c/operations/addition/libAddition.la \ + $(top_builddir)/src/c/operations/multiplication/libMultiplication.la \ + $(top_builddir)/src/c/matrixOperations/inversion/libMatrixInversion.la\ + $(top_builddir)/src/c/matrixOperations/zeros/libMatrixZeros.la\ + libSpec.la + +check_INCLUDES = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + +testDoubleSpec_SOURCES = testDoubleSpec.c +testDoubleSpec_LDADD = $(check_LDADD) +testDoubleSpec_CFLAGS = $(check_INCLUDES) +testFloatSpec_SOURCES = testFloatSpec.c +testFloatSpec_LDADD = $(check_LDADD) +testFloatSpec_CFLAGS = $(check_INCLUDES) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/c/matrixOperations/spec/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/c/matrixOperations/spec/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ + } + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libSpec.la: $(libSpec_la_OBJECTS) $(libSpec_la_DEPENDENCIES) + $(libSpec_la_LINK) -rpath $(pkglibdir) $(libSpec_la_OBJECTS) $(libSpec_la_LIBADD) $(LIBS) + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +testDoubleSpec$(EXEEXT): $(testDoubleSpec_OBJECTS) $(testDoubleSpec_DEPENDENCIES) + @rm -f testDoubleSpec$(EXEEXT) + $(testDoubleSpec_LINK) $(testDoubleSpec_OBJECTS) $(testDoubleSpec_LDADD) $(LIBS) +testFloatSpec$(EXEEXT): $(testFloatSpec_OBJECTS) $(testFloatSpec_DEPENDENCIES) + @rm -f testFloatSpec$(EXEEXT) + $(testFloatSpec_LINK) $(testFloatSpec_OBJECTS) $(testFloatSpec_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec_la-cspeca.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec_la-dspeca.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec_la-sspeca.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec_la-zspeca.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleSpec-testDoubleSpec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatSpec-testFloatSpec.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libSpec_la-sspeca.lo: sspeca.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -MT libSpec_la-sspeca.lo -MD -MP -MF $(DEPDIR)/libSpec_la-sspeca.Tpo -c -o libSpec_la-sspeca.lo `test -f 'sspeca.c' || echo '$(srcdir)/'`sspeca.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec_la-sspeca.Tpo $(DEPDIR)/libSpec_la-sspeca.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sspeca.c' object='libSpec_la-sspeca.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -c -o libSpec_la-sspeca.lo `test -f 'sspeca.c' || echo '$(srcdir)/'`sspeca.c + +libSpec_la-dspeca.lo: dspeca.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -MT libSpec_la-dspeca.lo -MD -MP -MF $(DEPDIR)/libSpec_la-dspeca.Tpo -c -o libSpec_la-dspeca.lo `test -f 'dspeca.c' || echo '$(srcdir)/'`dspeca.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec_la-dspeca.Tpo $(DEPDIR)/libSpec_la-dspeca.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dspeca.c' object='libSpec_la-dspeca.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -c -o libSpec_la-dspeca.lo `test -f 'dspeca.c' || echo '$(srcdir)/'`dspeca.c + +libSpec_la-cspeca.lo: cspeca.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -MT libSpec_la-cspeca.lo -MD -MP -MF $(DEPDIR)/libSpec_la-cspeca.Tpo -c -o libSpec_la-cspeca.lo `test -f 'cspeca.c' || echo '$(srcdir)/'`cspeca.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec_la-cspeca.Tpo $(DEPDIR)/libSpec_la-cspeca.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cspeca.c' object='libSpec_la-cspeca.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -c -o libSpec_la-cspeca.lo `test -f 'cspeca.c' || echo '$(srcdir)/'`cspeca.c + +libSpec_la-zspeca.lo: zspeca.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -MT libSpec_la-zspeca.lo -MD -MP -MF $(DEPDIR)/libSpec_la-zspeca.Tpo -c -o libSpec_la-zspeca.lo `test -f 'zspeca.c' || echo '$(srcdir)/'`zspeca.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec_la-zspeca.Tpo $(DEPDIR)/libSpec_la-zspeca.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zspeca.c' object='libSpec_la-zspeca.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec_la_CFLAGS) $(CFLAGS) -c -o libSpec_la-zspeca.lo `test -f 'zspeca.c' || echo '$(srcdir)/'`zspeca.c + +testDoubleSpec-testDoubleSpec.o: testDoubleSpec.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec_CFLAGS) $(CFLAGS) -MT testDoubleSpec-testDoubleSpec.o -MD -MP -MF $(DEPDIR)/testDoubleSpec-testDoubleSpec.Tpo -c -o testDoubleSpec-testDoubleSpec.o `test -f 'testDoubleSpec.c' || echo '$(srcdir)/'`testDoubleSpec.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testDoubleSpec-testDoubleSpec.Tpo $(DEPDIR)/testDoubleSpec-testDoubleSpec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleSpec.c' object='testDoubleSpec-testDoubleSpec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec_CFLAGS) $(CFLAGS) -c -o testDoubleSpec-testDoubleSpec.o `test -f 'testDoubleSpec.c' || echo '$(srcdir)/'`testDoubleSpec.c + +testDoubleSpec-testDoubleSpec.obj: testDoubleSpec.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec_CFLAGS) $(CFLAGS) -MT testDoubleSpec-testDoubleSpec.obj -MD -MP -MF $(DEPDIR)/testDoubleSpec-testDoubleSpec.Tpo -c -o testDoubleSpec-testDoubleSpec.obj `if test -f 'testDoubleSpec.c'; then $(CYGPATH_W) 'testDoubleSpec.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleSpec.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testDoubleSpec-testDoubleSpec.Tpo $(DEPDIR)/testDoubleSpec-testDoubleSpec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleSpec.c' object='testDoubleSpec-testDoubleSpec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec_CFLAGS) $(CFLAGS) -c -o testDoubleSpec-testDoubleSpec.obj `if test -f 'testDoubleSpec.c'; then $(CYGPATH_W) 'testDoubleSpec.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleSpec.c'; fi` + +testFloatSpec-testFloatSpec.o: testFloatSpec.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec_CFLAGS) $(CFLAGS) -MT testFloatSpec-testFloatSpec.o -MD -MP -MF $(DEPDIR)/testFloatSpec-testFloatSpec.Tpo -c -o testFloatSpec-testFloatSpec.o `test -f 'testFloatSpec.c' || echo '$(srcdir)/'`testFloatSpec.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testFloatSpec-testFloatSpec.Tpo $(DEPDIR)/testFloatSpec-testFloatSpec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatSpec.c' object='testFloatSpec-testFloatSpec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec_CFLAGS) $(CFLAGS) -c -o testFloatSpec-testFloatSpec.o `test -f 'testFloatSpec.c' || echo '$(srcdir)/'`testFloatSpec.c + +testFloatSpec-testFloatSpec.obj: testFloatSpec.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec_CFLAGS) $(CFLAGS) -MT testFloatSpec-testFloatSpec.obj -MD -MP -MF $(DEPDIR)/testFloatSpec-testFloatSpec.Tpo -c -o testFloatSpec-testFloatSpec.obj `if test -f 'testFloatSpec.c'; then $(CYGPATH_W) 'testFloatSpec.c'; else $(CYGPATH_W) '$(srcdir)/testFloatSpec.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testFloatSpec-testFloatSpec.Tpo $(DEPDIR)/testFloatSpec-testFloatSpec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatSpec.c' object='testFloatSpec-testFloatSpec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec_CFLAGS) $(CFLAGS) -c -o testFloatSpec-testFloatSpec.obj `if test -f 'testFloatSpec.c'; then $(CYGPATH_W) 'testFloatSpec.c'; else $(CYGPATH_W) '$(srcdir)/testFloatSpec.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pkglibLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkglibLTLIBRARIES + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pkglibLTLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkglibLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkglibLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/c/linearAlgebra/spec/cspeca.c b/src/c/linearAlgebra/spec/cspeca.c new file mode 100644 index 00000000..a2b6548b --- /dev/null +++ b/src/c/linearAlgebra/spec/cspeca.c @@ -0,0 +1,34 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" + + + +void cspeca(floatComplex* in, int rows, floatComplex* out){ + /* As we use Lapack to find the eigenvalues, we must cast the floatComplex input into doubleComplex + and the doubleComplex output of dspeca into floatComplex*/ + + int i; + doubleComplex* dblin; + doubleComplex* dblout; + + dblin=(doubleComplex*)malloc((unsigned int)(rows*rows)*sizeof(doubleComplex)); + dblout=(doubleComplex*)malloc((unsigned int)rows*sizeof(doubleComplex)); + + for (i=0;i<rows*rows;i++) dblin[i]=DoubleComplex((double)creals(in[i]),(double)cimags(in[i])); + + zspeca(dblin,rows,dblout); + + for (i=0;i<rows;i++) out[i]=FloatComplex((float)zreals(dblout[i]),(float)zimags(dblout[i])); +} diff --git a/src/c/linearAlgebra/spec/dspec1a.c b/src/c/linearAlgebra/spec/dspec1a.c new file mode 100644 index 00000000..28440be6 --- /dev/null +++ b/src/c/linearAlgebra/spec/dspec1a.c @@ -0,0 +1,176 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*This function finds the hessenberg form of a matrix A.*/ + +#include "spec.h" +#include <stdio.h> +#include "string.h" +#include "stdlib.h" +#include "lapack.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include "doubleComplex.h" + +extern int dggev_(char *,char *,int *,double *,int *,double *,int *,double *,double *,double *,double *,int *,double *,int *,double *,int *,int *); + +void assembleEigenvectorsInPlace(int N,double *ALPHAI,double *EVreal,double *EVimg){ + int j,i; + j=0; + while(j<N){ + if(ALPHAI[j] == 0){ + //printf(" * "); + j+=1; + } + else{ + int ij; + int ij1; + for(i=0;i<N;i++){ + ij = i+j*N; + ij1 = i+(j+1)*N; + EVimg[ij] = EVreal[ij1]; + EVimg[ij1] = -EVreal[ij1]; + EVreal[ij1] = EVreal[ij]; + } + j+=2; + } + } +} + +void dspec1a(double *in1,double *in2,int size,int nout,doubleComplex *out1,double *out2,doubleComplex *out3,doubleComplex *out4){ + + int i,j; + char JOBVL; + char JOBVR; + int N=size; + + double *A; + int LDA=N; + A = (double *)malloc(N*N*sizeof(double)); + memcpy(A,in1,N*N*sizeof(double)); + + double *B; + int LDB=N; + B = (double *)malloc(N*N*sizeof(double)); + memcpy(B,in2,N*N*sizeof(double)); + + double *ALPHAR; + ALPHAR = (double *)malloc(N*sizeof(double)); + + double *ALPHAI; + ALPHAI = (double *)malloc(N*sizeof(double)); + + double *BETA; + BETA = (double *)malloc(N*sizeof(double)); + + double *VL; + VL = (double *)malloc(N*N*sizeof(double)); + + int LDVL=N; + + double *VR; + VR = (double *)malloc(N*N*sizeof(double)); + int LDVR=N; + + int LWORK=8*N; + + double *WORK; + WORK = (double *)malloc(LWORK*sizeof(double)); + + int INFO; + if(nout == 1){ /*out1 = spec(A,B)*/ + JOBVL = 'N'; + JOBVR = 'N'; + dggev_(&JOBVL,&JOBVR,&N,A,&LDA,B,&LDB,ALPHAR,ALPHAI,BETA,VL,&LDVL,VR,&LDVR,WORK,&LWORK,&INFO); + for(i=0;i<N;i++){ + out1[i] = DoubleComplex(ALPHAR[i]/BETA[i],ALPHAI[i]/BETA[i]); + } + } + else if(nout == 2){ /*[out1,out2] = spec(A,B)*/ + JOBVL = 'N'; + JOBVR = 'N'; + dggev_(&JOBVL,&JOBVR,&N,A,&LDA,B,&LDB,ALPHAR,ALPHAI,BETA,VL,&LDVL,VR,&LDVR,WORK,&LWORK,&INFO); + for(i=0;i<N;i++){ + out1[i] = DoubleComplex(ALPHAR[i],ALPHAI[i]); + } + memcpy(out2,BETA,N*sizeof(double)); + } + else if(nout == 3){ /* [out1,out2,out3] = spec(A,B) */ + JOBVL = 'N'; + JOBVR = 'V'; + dggev_(&JOBVL,&JOBVR,&N,A,&LDA,B,&LDB,ALPHAR,ALPHAI,BETA,VL,&LDVL,VR,&LDVR,WORK,&LWORK,&INFO); + for(i=0;i<N;i++){ + out1[i] = DoubleComplex(ALPHAR[i],ALPHAI[i]); + } + memcpy(out2,BETA,N*sizeof(double)); + + /*Because lapack routine doesn't give result in actual format, \ + so we have to change the VR little-bit and then return the function */ + + /*See the Scilab code || see the lapack subroutine libary - DGGEV where \ + it is very explantory and explains all this. + */ + double *EVimg; + EVimg = (double *)malloc(N*N*sizeof(double)); + for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + EVimg[i+j*N] = 0; + } + } + assembleEigenvectorsInPlace(N,ALPHAI,VR,EVimg); + for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + out3[i+j*N] = DoubleComplex(VR[i+j*N],EVimg[i+j*N]); + } + } + } + else if(nout == 4){ + JOBVL = 'V'; + JOBVR = 'V'; + + dggev_(&JOBVL,&JOBVR,&N,A,&LDA,B,&LDB,ALPHAR,ALPHAI,BETA,VL,&LDVL,VR,&LDVR,WORK,&LWORK,&INFO); + + for(i=0;i<N;i++){ + out1[i] = DoubleComplex(ALPHAR[i],ALPHAI[i]); + } + + memcpy(out2,BETA,N*sizeof(double)); + + double *EVimg; + EVimg = (double *)malloc(N*N*sizeof(double)); + for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + EVimg[i+j*N] = 0; + } + } + assembleEigenvectorsInPlace(N,ALPHAI,VR,EVimg); + for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + out4[i+j*N] = DoubleComplex(VR[i+j*N],EVimg[i+j*N]); + } + } + + double *EVimg1; + EVimg1 = (double *)malloc(N*N*sizeof(double)); + for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + EVimg1[i+j*N] = 0; + } + } + assembleEigenvectorsInPlace(N,ALPHAI,VL,EVimg1); + for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + out3[i+j*N] = DoubleComplex(VL[i+j*N],EVimg1[i+j*N]); + } + } + } +} diff --git a/src/c/linearAlgebra/spec/dspeca.c b/src/c/linearAlgebra/spec/dspeca.c new file mode 100644 index 00000000..1131ecf2 --- /dev/null +++ b/src/c/linearAlgebra/spec/dspeca.c @@ -0,0 +1,71 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" +#include "lapack.h" +#include "zeros.h" +#include "max.h" + +void dspeca(double* in, int rows,double* out){ + int i=0, j=0; + int symmetric=0; + int INFO=0; + int iWorkSize = 0; + double* pdblWork; + double* outReal; + double* outImag; + double* pdblLeftvectors; + double* pdblRightvectors; + double* inCopy; + + inCopy = (double*)malloc((unsigned int)(rows*rows) * sizeof(double)); + outReal = (double*)malloc((unsigned int)rows * sizeof(double)); + outImag = (double*)malloc((unsigned int)rows * sizeof(double)); + pdblLeftvectors=NULL; + pdblRightvectors=NULL; + + + iWorkSize = 3*rows; + pdblWork = (double*)malloc((unsigned int)iWorkSize * sizeof(double)); + + for(i=0;i<rows*rows;i++) inCopy[i]=in[i]; + /* look if the matrix is symmetric */ + for (i=0;i<rows;i++) + for (j=0;j<rows;j++) + if (in[i*rows+j]!=in[i+j*rows]) break; + + /* the matrix is symmetric if the 2 loops goes to end i.e + i==rows and j==rows */ + if ((i==rows)&&(j==rows)) symmetric=1; + + + /* apply lapack function according to symmetry */ + if(symmetric){ + C2F(dsyev)( "N", "U", &rows, in, &rows, outReal, pdblWork, &iWorkSize, &INFO ); + } + else { + C2F(dgeev)( "N", "N", &rows, inCopy, &rows, outReal, outImag, + pdblLeftvectors, &rows, pdblRightvectors, &rows, pdblWork, &iWorkSize, &INFO ); + } + + for (i=0;i<rows;i++) out[i]=outReal[i]; + + + free(inCopy); + free(outReal); + free(outImag); + free(pdblWork); + free(pdblLeftvectors); + free(pdblRightvectors); +} + diff --git a/src/c/linearAlgebra/spec/sspeca.c b/src/c/linearAlgebra/spec/sspeca.c new file mode 100644 index 00000000..50751a29 --- /dev/null +++ b/src/c/linearAlgebra/spec/sspeca.c @@ -0,0 +1,34 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" + + + +void sspeca(float* in, int rows, float* out){ + /* As we use Lapack to find the eigenvalues, we must cast the float input into double + and the doubleComplex output of dspeca into floatComplex*/ + + int i; + double* dblin; + double* dblout; + + dblin=(double*)malloc((unsigned int)(rows*rows)*sizeof(double)); + dblout=(double*)malloc((unsigned int)rows*sizeof(double)); + + for (i=0;i<rows*rows;i++) dblin[i]=(double)in[i]; + + dspeca(dblin,rows,dblout); + + for (i=0;i<rows;i++) out[i]=(float)dblout[i]; +} diff --git a/src/c/linearAlgebra/spec/testDoubleSpec.c b/src/c/linearAlgebra/spec/testDoubleSpec.c new file mode 100644 index 00000000..25c88065 --- /dev/null +++ b/src/c/linearAlgebra/spec/testDoubleSpec.c @@ -0,0 +1,116 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" +#include "stdio.h" +#include "assert.h" +#include "math.h" + +static void dspecaTest(void){ + double in[4]={1,1,1,3}; + double resultR[2]={0.5857864376269050765700,3.4142135623730949234300}; + + + double *out; + + int i; + + out=(double*)malloc((unsigned int)2*sizeof(double)); + + dspeca(in,2,out); + for(i=0;i<2;i++){ + if (out[i]>1e-16) assert( fabs(out[i]-resultR[i]) / fabs(out[i]) <3e-16); + else assert(1); + } + +} + + + + +static void zspecaTest(void){ + double inR[4]={1,1,1,3}; + double inI[4]={0,0,0,0}; + double resultR[2]={0.5857864376269050765700,3.4142135623730949234300}; + double resultI[2]={0,0}; + + double in2R[4]={1,1,-2,3}; + double in2I[4]={0,0,0,0}; + double result2R[2]={1.9999999999999997779554,1.9999999999999997779554}; + double result2I[2]={0.9999999999999997779554,-0.9999999999999997779554}; + + double in3R[16]={0.0603054538369178771973,0.631347181741148233414 ,0.0241030259057879447937,0.1527438252232968807221, + 0.9481177683919668197632,0.2744265575893223285675,0.4794727200642228126526,0.485576837789267301559, + 0.676400367170572280884,0.8321249918080866336823,0.0125875836238265037537,0.5453779897652566432953, + 0.8426716942340135574341,0.9029165101237595081329,0.4409482078626751899719,0.8332359003834426403046 }; + double in3I[16]={0.7233976423740386962891,0.4377150186337530612946,0.3080607382580637931824,0.8749813153408467769623, + 0.5355882328003644943237 ,0.3085998897440731525421,0.3354632416740059852600,0.2342486302368342876434, + 0.2589411698281764984131,0.8521509231068193912506,0.4821739485487341880798,0.6095217890106141567230, + 0.9872822705656290054321,0.9811426815576851367950,0.3303113700821995735169,0.3589145573787391185761}; + double result3R[4]={1.9486046375762748894545,0.2315060459861970343365,- 0.7694743345806510648188,- 0.2300808535483104266817}; + double result3I[4]={2.1242015857341254303492,- 0.4115101262891645017561,- 0.1980716835789462781925,0.3584662621795701720195}; + + doubleComplex *in,*in2,*in3,out[2],out2[4]; + + int i; + + in=DoubleComplexMatrix(inR,inI,4); + in2=DoubleComplexMatrix(in2R,in2I,4); + in3=DoubleComplexMatrix(in3R,in3I,16); + + zspeca(in,2,out); + for(i=0;i<2;i++){ + if (zreals(out[i])>1e-16) assert( fabs(zreals(out[i])-resultR[i]) / fabs(zreals(out[i])) <3e-16); + else assert(1); + if (zimags(out[i])>1e-16) assert( fabs(zimags(out[i])-resultI[i]) / fabs(zimags(out[i])) <1e-16); + else assert(1); + } + + + zspeca(in2,2,out); + for(i=0;i<2;i++){ + if (zreals(out[i])>1e-16) assert( fabs(zreals(out[i])-result2R[i]) / fabs(zreals(out[i])) <3e-16); + else assert(1); + if (zimags(out[i])>1e-16) assert( fabs(zimags(out[i])-result2I[i]) / fabs(zimags(out[i])) <3e-15); + else assert(1); + } + + + zspeca(in3,4,out2); + for(i=0;i<4;i++){ + if (zreals(out2[i])>1e-16) assert( fabs(zreals(out2[i])-result3R[i]) / fabs(zreals(out2[i])) <3e-15); + else assert(1); + if (zimags(out2[i])>1e-16) assert( fabs(zimags(out2[i])-result3I[i]) / fabs(zimags(out2[i])) <3e-15); + else assert(1); + } + + +} + + +static int testSpec(void){ + printf(">>> Double Spec Tests <<<\n"); + printf(">>> Double <<<\n"); + dspecaTest(); + printf(">>> DoubleComplex <<<\n"); + zspecaTest(); + return 0; +} + + +int main(void){ + assert (testSpec()==0); + + + return 0; +} diff --git a/src/c/linearAlgebra/spec/testFloatSpec.c b/src/c/linearAlgebra/spec/testFloatSpec.c new file mode 100644 index 00000000..9bd46adc --- /dev/null +++ b/src/c/linearAlgebra/spec/testFloatSpec.c @@ -0,0 +1,110 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" +#include "stdio.h" +#include "assert.h" +#include "math.h" + +static void sspecaTest(void){ + float in[4]={1.0f,1.0f,1.0f,3.0f}; + float resultR[2]={0.5857864376269050765700f,3.4142135623730949234300f}; + + float in1[4]={0.0f,4.0f,1.0f,0.0f}; + float result[2]={2.0f,-2.0f}; + + float in2[4]={1.0f,1.0f,-2.0f,3.0f}; + + float *out; + + int i; + + out=(float *)malloc((unsigned int)2*sizeof(float)); + + sspeca(in,2,out); + for (i=0;i<2;i++) printf("%f\n",out[i]); + for(i=0;i<2;i++){ + if (out[i]>1e-16) assert( fabs(out[i]-resultR[i]) / fabs(out[i]) <1e-16); + else assert(1); + } + + + sspeca(in1,2,out); + for (i=0;i<2;i++) printf("%f\n",out[i]); + for(i=0;i<2;i++){ + if (out[i]>1e-16) assert( fabs(out[i]-result[i]) / fabs(out[i]) <1e-16); + else assert(1); + } + + sspeca(in2,2,out); + for (i=0;i<2;i++) printf("%f\n",out[i]); + +} + + +static void cspecaTest(void){ + float inR[4]={1.0f,1.0f,1.0f,3.0f}; + float inI[4]={0.0f,0.0f,0.0f,0.0f}; + float resultR[2]={0.5857864376269050765700f,3.4142135623730949234300f}; + float resultI[2]={0,0}; + + float in2R[4]={1.0f,1.0f,-2.0f,3.0f}; + float in2I[4]={0.0f,0.0f,0.0f,0.0f}; + float result2R[2]={1.9999999999999997779554f,1.9999999999999997779554f}; + float result2I[2]={0.9999999999999997779554f,-0.9999999999999997779554f}; + + floatComplex *in,*in2,out[4]; + + int i; + + in=FloatComplexMatrix(inR,inI,4); + in2=FloatComplexMatrix(in2R,in2I,4); + + cspeca(in,2,out); + for(i=0;i<2;i++){ + if (creals(out[i])>1e-16) assert( fabs(creals(out[i])-resultR[i]) / fabs(creals(out[i])) <1e-15); + else assert(1); + if (cimags(out[i])>1e-16) assert( fabs(cimags(out[i])-resultI[i]) / fabs(cimags(out[i])) <1e-16); + else assert(1); + } + + + cspeca(in2,2,out); + for(i=0;i<2;i++){ + if (creals(out[i])>1e-16) assert( fabs(creals(out[i])-result2R[i]) / fabs(creals(out[i])) <1e-15); + else assert(1); + if (cimags(out[i])>1e-16) assert( fabs(cimags(out[i])-result2I[i]) / fabs(cimags(out[i])) <1e-15); + else assert(1); + } + +} + + + + +static int testSpec(void){ + printf(">>> Float Spec Tests <<<\n"); + printf(">>> Float <<<\n"); + sspecaTest(); + printf(">>> FloatComplex <<<\n"); + cspecaTest(); + return 0; +} + + +int main(void){ + assert (testSpec()==0); + + + return 0; +} diff --git a/src/c/linearAlgebra/spec/test_DoubleSpec/testDoubleSpec.vcxproj b/src/c/linearAlgebra/spec/test_DoubleSpec/testDoubleSpec.vcxproj new file mode 100644 index 00000000..f696bff4 --- /dev/null +++ b/src/c/linearAlgebra/spec/test_DoubleSpec/testDoubleSpec.vcxproj @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{651B0E61-1047-4575-BE31-D9CB28062CBA}</ProjectGuid>
+ <RootNamespace>testDoubleSpec</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testDoubleSpec.c">
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\type\type.vcxproj">
+ <Project>{9b1bd750-1fef-4d6b-9422-782d16181cee}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\matrixOperations.vcxproj">
+ <Project>{fd335544-52bf-4736-a34e-77f591d158d5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec/test_DoubleSpec/testDoubleSpec.vcxproj.filters b/src/c/linearAlgebra/spec/test_DoubleSpec/testDoubleSpec.vcxproj.filters new file mode 100644 index 00000000..dcdaea5c --- /dev/null +++ b/src/c/linearAlgebra/spec/test_DoubleSpec/testDoubleSpec.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testDoubleSpec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec/test_FloatSpec/testFloatSpec.vcxproj b/src/c/linearAlgebra/spec/test_FloatSpec/testFloatSpec.vcxproj new file mode 100644 index 00000000..0631bb40 --- /dev/null +++ b/src/c/linearAlgebra/spec/test_FloatSpec/testFloatSpec.vcxproj @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{B7BEF8A2-3E42-4FA3-94A7-22618594057D}</ProjectGuid>
+ <RootNamespace>testFloatSpec</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testFloatSpec.c">
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\type\type.vcxproj">
+ <Project>{9b1bd750-1fef-4d6b-9422-782d16181cee}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\matrixOperations.vcxproj">
+ <Project>{fd335544-52bf-4736-a34e-77f591d158d5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec/test_FloatSpec/testFloatSpec.vcxproj.filters b/src/c/linearAlgebra/spec/test_FloatSpec/testFloatSpec.vcxproj.filters new file mode 100644 index 00000000..2ba2e59f --- /dev/null +++ b/src/c/linearAlgebra/spec/test_FloatSpec/testFloatSpec.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testFloatSpec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec/zspeca.c b/src/c/linearAlgebra/spec/zspeca.c new file mode 100644 index 00000000..a2b1c25a --- /dev/null +++ b/src/c/linearAlgebra/spec/zspeca.c @@ -0,0 +1,80 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" +#include "lapack.h" +#include "zeros.h" +#include "conj.h" + +void zspeca(doubleComplex* in, int rows,doubleComplex* out){ + int i = 0, j = 0; + int hermitian = 0; + int INFO = 0; + int iWorkSize = 0; + doubleComplex* pdblWork; + doubleComplex* pdblLeftvectors; + doubleComplex* pdblRightvectors; + doubleComplex* pdblRWork; + double* outReal; + double* outImag; + doubleComplex* inCopy; + + inCopy = (doubleComplex*)malloc((unsigned int)(rows*rows) * sizeof(doubleComplex)); + outReal = (double*)malloc((unsigned int)rows * sizeof(double)); + outImag = (double*)malloc((unsigned int)rows * sizeof(double)); + pdblLeftvectors=NULL; + pdblRightvectors=NULL; + + iWorkSize = 2*rows; + pdblWork = (doubleComplex*)malloc((unsigned int)iWorkSize * sizeof(doubleComplex)); + pdblRWork = (doubleComplex*)malloc((unsigned int)(3*rows) * sizeof(doubleComplex)); + + for(i=0;i<rows*rows;i++) inCopy[i]=DoubleComplex(zreals(in[i]),zimags(in[i])); + + /* look if the matrix is symmetric */ + for (i=0;i<rows;i++){ + for (j=0;j<rows;j++) + if ( (zreals(in[i*rows+j])!=zreals(zconjs(in[i+j*rows]))) || + (zimags(in[i*rows+j])!=zimags(zconjs(in[i+j*rows]))) ) + break; + if (j!=rows) break; + } + + + /* the matrix is symmetric if the 2 loops goes to end i.e + i==rows and j==rows */ + if ((i==rows)&&(j==rows)) hermitian=1; + + + /* apply lapack function according to symmetry */ + if(hermitian){ + C2F(zheev)( "N", "U", &rows, inCopy, &rows, outReal, pdblWork, &iWorkSize, outImag, &INFO ); + dzerosa(outImag,1,rows); + for (i=0;i<rows;i++) out[i]=DoubleComplex(outReal[i],outImag[i]); + } + else { + C2F(zgeev)( "N", "N", &rows, inCopy, &rows, out, + pdblLeftvectors, &rows, pdblRightvectors, &rows, pdblWork, &iWorkSize, + pdblRWork, &INFO ); + } + + + + free(inCopy); + free(outReal); + free(outImag); + free(pdblWork); + free(pdblRWork); + free(pdblLeftvectors); + free(pdblRightvectors); +} diff --git a/src/c/linearAlgebra/spec2/Makefile.am b/src/c/linearAlgebra/spec2/Makefile.am new file mode 100644 index 00000000..5a357fa5 --- /dev/null +++ b/src/c/linearAlgebra/spec2/Makefile.am @@ -0,0 +1,70 @@ +## +## Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +## Copyright (C) 2006-2008 - INRIA - Bruno JOFRET +## +## This file must be used under the terms of the CeCILL. +## This source file is licensed as described in the file COPYING, which +## you should have received as part of this distribution. The terms +## are also available at +## http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +## +## + +libSpec2_la_CFLAGS = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + + +instdir = $(top_builddir)/lib + +pkglib_LTLIBRARIES = libSpec2.la + +HEAD = ../includes/spec.h + +libSpec2_la_SOURCES = $(HEAD) \ + sspec2a.c \ + dspec2a.c \ + cspec2a.c \ + zspec2a.c + + +############ +## CHECK +############ + + +check_PROGRAMS = testDoubleSpec2 testFloatSpec2 + +check_LDADD = $(top_builddir)/src/c/type/libDoubleComplex.la \ + $(top_builddir)/src/c/type/libFloatComplex.la \ + $(top_builddir)/src/c/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/src/fortran/lapack/libscilapack.la \ + $(top_builddir)/src/fortran/blas/libsciblas.la \ + $(top_builddir)/src/c/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/src/c/auxiliaryFunctions/conj/libConj.la \ + $(top_builddir)/src/c/auxiliaryFunctions/sign/libSign.la \ + $(top_builddir)/src/c/auxiliaryFunctions/pythag/libPythag.la \ + $(top_builddir)/src/c/operations/addition/libAddition.la \ + $(top_builddir)/src/c/operations/multiplication/libMultiplication.la \ + $(top_builddir)/src/c/matrixOperations/inversion/libMatrixInversion.la\ + $(top_builddir)/src/c/matrixOperations/zeros/libMatrixZeros.la\ + libSpec2.la + +check_INCLUDES = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + +testDoubleSpec2_SOURCES = testDoubleSpec2.c +testDoubleSpec2_LDADD = $(check_LDADD) +testDoubleSpec2_CFLAGS = $(check_INCLUDES) + +testFloatSpec2_SOURCES = testFloatSpec2.c +testFloatSpec2_LDADD = $(check_LDADD) +testFloatSpec2_CFLAGS = $(check_INCLUDES) + +TESTS = testDoubleSpec2 testFloatSpec2 + diff --git a/src/c/linearAlgebra/spec2/Makefile.in b/src/c/linearAlgebra/spec2/Makefile.in new file mode 100644 index 00000000..6e46c059 --- /dev/null +++ b/src/c/linearAlgebra/spec2/Makefile.in @@ -0,0 +1,757 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = testDoubleSpec2$(EXEEXT) testFloatSpec2$(EXEEXT) +TESTS = testDoubleSpec2$(EXEEXT) testFloatSpec2$(EXEEXT) +subdir = src/c/matrixOperations/spec2 +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/includes/machine.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkglibdir)" +LTLIBRARIES = $(pkglib_LTLIBRARIES) +libSpec2_la_LIBADD = +am__objects_1 = +am_libSpec2_la_OBJECTS = $(am__objects_1) libSpec2_la-sspec2a.lo \ + libSpec2_la-dspec2a.lo libSpec2_la-cspec2a.lo \ + libSpec2_la-zspec2a.lo +libSpec2_la_OBJECTS = $(am_libSpec2_la_OBJECTS) +libSpec2_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libSpec2_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testDoubleSpec2_OBJECTS = \ + testDoubleSpec2-testDoubleSpec2.$(OBJEXT) +testDoubleSpec2_OBJECTS = $(am_testDoubleSpec2_OBJECTS) +testDoubleSpec2_DEPENDENCIES = $(check_LDADD) +testDoubleSpec2_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleSpec2_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testFloatSpec2_OBJECTS = testFloatSpec2-testFloatSpec2.$(OBJEXT) +testFloatSpec2_OBJECTS = $(am_testFloatSpec2_OBJECTS) +testFloatSpec2_DEPENDENCIES = $(check_LDADD) +testFloatSpec2_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatSpec2_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libSpec2_la_SOURCES) $(testDoubleSpec2_SOURCES) \ + $(testFloatSpec2_SOURCES) +DIST_SOURCES = $(libSpec2_la_SOURCES) $(testDoubleSpec2_SOURCES) \ + $(testFloatSpec2_SOURCES) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBMATH = @LIBMATH@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libSpec2_la_CFLAGS = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + +instdir = $(top_builddir)/lib +pkglib_LTLIBRARIES = libSpec2.la +HEAD = ../includes/spec.h +libSpec2_la_SOURCES = $(HEAD) \ + sspec2a.c \ + dspec2a.c \ + cspec2a.c \ + zspec2a.c + +check_LDADD = $(top_builddir)/src/c/type/libDoubleComplex.la \ + $(top_builddir)/src/c/type/libFloatComplex.la \ + $(top_builddir)/src/c/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/src/fortran/lapack/libscilapack.la \ + $(top_builddir)/src/fortran/blas/libsciblas.la \ + $(top_builddir)/src/c/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/src/c/auxiliaryFunctions/conj/libConj.la \ + $(top_builddir)/src/c/auxiliaryFunctions/sign/libSign.la \ + $(top_builddir)/src/c/auxiliaryFunctions/pythag/libPythag.la \ + $(top_builddir)/src/c/operations/addition/libAddition.la \ + $(top_builddir)/src/c/operations/multiplication/libMultiplication.la \ + $(top_builddir)/src/c/matrixOperations/inversion/libMatrixInversion.la\ + $(top_builddir)/src/c/matrixOperations/zeros/libMatrixZeros.la\ + libSpec2.la + +check_INCLUDES = -I $(top_builddir)/src/c/type \ + -I $(top_builddir)/src/c/matrixOperations/includes \ + -I $(top_builddir)/src/c/operations/includes \ + -I $(top_builddir)/src/c/elementaryFunctions/includes\ + -I $(top_builddir)/src/c/auxiliaryFunctions/includes + +testDoubleSpec2_SOURCES = testDoubleSpec2.c +testDoubleSpec2_LDADD = $(check_LDADD) +testDoubleSpec2_CFLAGS = $(check_INCLUDES) +testFloatSpec2_SOURCES = testFloatSpec2.c +testFloatSpec2_LDADD = $(check_LDADD) +testFloatSpec2_CFLAGS = $(check_INCLUDES) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/c/matrixOperations/spec2/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/c/matrixOperations/spec2/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ + } + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libSpec2.la: $(libSpec2_la_OBJECTS) $(libSpec2_la_DEPENDENCIES) + $(libSpec2_la_LINK) -rpath $(pkglibdir) $(libSpec2_la_OBJECTS) $(libSpec2_la_LIBADD) $(LIBS) + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +testDoubleSpec2$(EXEEXT): $(testDoubleSpec2_OBJECTS) $(testDoubleSpec2_DEPENDENCIES) + @rm -f testDoubleSpec2$(EXEEXT) + $(testDoubleSpec2_LINK) $(testDoubleSpec2_OBJECTS) $(testDoubleSpec2_LDADD) $(LIBS) +testFloatSpec2$(EXEEXT): $(testFloatSpec2_OBJECTS) $(testFloatSpec2_DEPENDENCIES) + @rm -f testFloatSpec2$(EXEEXT) + $(testFloatSpec2_LINK) $(testFloatSpec2_OBJECTS) $(testFloatSpec2_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec2_la-cspec2a.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec2_la-dspec2a.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec2_la-sspec2a.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libSpec2_la-zspec2a.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleSpec2-testDoubleSpec2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatSpec2-testFloatSpec2.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libSpec2_la-sspec2a.lo: sspec2a.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -MT libSpec2_la-sspec2a.lo -MD -MP -MF $(DEPDIR)/libSpec2_la-sspec2a.Tpo -c -o libSpec2_la-sspec2a.lo `test -f 'sspec2a.c' || echo '$(srcdir)/'`sspec2a.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec2_la-sspec2a.Tpo $(DEPDIR)/libSpec2_la-sspec2a.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sspec2a.c' object='libSpec2_la-sspec2a.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -c -o libSpec2_la-sspec2a.lo `test -f 'sspec2a.c' || echo '$(srcdir)/'`sspec2a.c + +libSpec2_la-dspec2a.lo: dspec2a.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -MT libSpec2_la-dspec2a.lo -MD -MP -MF $(DEPDIR)/libSpec2_la-dspec2a.Tpo -c -o libSpec2_la-dspec2a.lo `test -f 'dspec2a.c' || echo '$(srcdir)/'`dspec2a.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec2_la-dspec2a.Tpo $(DEPDIR)/libSpec2_la-dspec2a.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dspec2a.c' object='libSpec2_la-dspec2a.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -c -o libSpec2_la-dspec2a.lo `test -f 'dspec2a.c' || echo '$(srcdir)/'`dspec2a.c + +libSpec2_la-cspec2a.lo: cspec2a.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -MT libSpec2_la-cspec2a.lo -MD -MP -MF $(DEPDIR)/libSpec2_la-cspec2a.Tpo -c -o libSpec2_la-cspec2a.lo `test -f 'cspec2a.c' || echo '$(srcdir)/'`cspec2a.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec2_la-cspec2a.Tpo $(DEPDIR)/libSpec2_la-cspec2a.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cspec2a.c' object='libSpec2_la-cspec2a.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -c -o libSpec2_la-cspec2a.lo `test -f 'cspec2a.c' || echo '$(srcdir)/'`cspec2a.c + +libSpec2_la-zspec2a.lo: zspec2a.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -MT libSpec2_la-zspec2a.lo -MD -MP -MF $(DEPDIR)/libSpec2_la-zspec2a.Tpo -c -o libSpec2_la-zspec2a.lo `test -f 'zspec2a.c' || echo '$(srcdir)/'`zspec2a.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libSpec2_la-zspec2a.Tpo $(DEPDIR)/libSpec2_la-zspec2a.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zspec2a.c' object='libSpec2_la-zspec2a.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libSpec2_la_CFLAGS) $(CFLAGS) -c -o libSpec2_la-zspec2a.lo `test -f 'zspec2a.c' || echo '$(srcdir)/'`zspec2a.c + +testDoubleSpec2-testDoubleSpec2.o: testDoubleSpec2.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec2_CFLAGS) $(CFLAGS) -MT testDoubleSpec2-testDoubleSpec2.o -MD -MP -MF $(DEPDIR)/testDoubleSpec2-testDoubleSpec2.Tpo -c -o testDoubleSpec2-testDoubleSpec2.o `test -f 'testDoubleSpec2.c' || echo '$(srcdir)/'`testDoubleSpec2.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testDoubleSpec2-testDoubleSpec2.Tpo $(DEPDIR)/testDoubleSpec2-testDoubleSpec2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleSpec2.c' object='testDoubleSpec2-testDoubleSpec2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec2_CFLAGS) $(CFLAGS) -c -o testDoubleSpec2-testDoubleSpec2.o `test -f 'testDoubleSpec2.c' || echo '$(srcdir)/'`testDoubleSpec2.c + +testDoubleSpec2-testDoubleSpec2.obj: testDoubleSpec2.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec2_CFLAGS) $(CFLAGS) -MT testDoubleSpec2-testDoubleSpec2.obj -MD -MP -MF $(DEPDIR)/testDoubleSpec2-testDoubleSpec2.Tpo -c -o testDoubleSpec2-testDoubleSpec2.obj `if test -f 'testDoubleSpec2.c'; then $(CYGPATH_W) 'testDoubleSpec2.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleSpec2.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testDoubleSpec2-testDoubleSpec2.Tpo $(DEPDIR)/testDoubleSpec2-testDoubleSpec2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleSpec2.c' object='testDoubleSpec2-testDoubleSpec2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleSpec2_CFLAGS) $(CFLAGS) -c -o testDoubleSpec2-testDoubleSpec2.obj `if test -f 'testDoubleSpec2.c'; then $(CYGPATH_W) 'testDoubleSpec2.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleSpec2.c'; fi` + +testFloatSpec2-testFloatSpec2.o: testFloatSpec2.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec2_CFLAGS) $(CFLAGS) -MT testFloatSpec2-testFloatSpec2.o -MD -MP -MF $(DEPDIR)/testFloatSpec2-testFloatSpec2.Tpo -c -o testFloatSpec2-testFloatSpec2.o `test -f 'testFloatSpec2.c' || echo '$(srcdir)/'`testFloatSpec2.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testFloatSpec2-testFloatSpec2.Tpo $(DEPDIR)/testFloatSpec2-testFloatSpec2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatSpec2.c' object='testFloatSpec2-testFloatSpec2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec2_CFLAGS) $(CFLAGS) -c -o testFloatSpec2-testFloatSpec2.o `test -f 'testFloatSpec2.c' || echo '$(srcdir)/'`testFloatSpec2.c + +testFloatSpec2-testFloatSpec2.obj: testFloatSpec2.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec2_CFLAGS) $(CFLAGS) -MT testFloatSpec2-testFloatSpec2.obj -MD -MP -MF $(DEPDIR)/testFloatSpec2-testFloatSpec2.Tpo -c -o testFloatSpec2-testFloatSpec2.obj `if test -f 'testFloatSpec2.c'; then $(CYGPATH_W) 'testFloatSpec2.c'; else $(CYGPATH_W) '$(srcdir)/testFloatSpec2.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/testFloatSpec2-testFloatSpec2.Tpo $(DEPDIR)/testFloatSpec2-testFloatSpec2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatSpec2.c' object='testFloatSpec2-testFloatSpec2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatSpec2_CFLAGS) $(CFLAGS) -c -o testFloatSpec2-testFloatSpec2.obj `if test -f 'testFloatSpec2.c'; then $(CYGPATH_W) 'testFloatSpec2.c'; else $(CYGPATH_W) '$(srcdir)/testFloatSpec2.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pkglibLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkglibLTLIBRARIES + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pkglibLTLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkglibLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkglibLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/c/linearAlgebra/spec2/cspec2a.c b/src/c/linearAlgebra/spec2/cspec2a.c new file mode 100644 index 00000000..d3a4312f --- /dev/null +++ b/src/c/linearAlgebra/spec2/cspec2a.c @@ -0,0 +1,36 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" + + + +void cspec2a(floatComplex* in, int rows, floatComplex* eigenvalues,floatComplex* eigenvectors){ + /* As we use Lapack to find the eigenvalues, we must cast the floatComplex input into doubleComplex + and the doubleComplex outputs of dspeca into floatComplex*/ + + int i; + doubleComplex* dblin; + doubleComplex* dbleigenvalues,*dbleigenvectors; + + dblin=(doubleComplex*)malloc((unsigned int)(rows*rows)*sizeof(doubleComplex)); + dbleigenvalues=(doubleComplex*)malloc((unsigned int)(rows*rows)*sizeof(doubleComplex)); + dbleigenvectors=(doubleComplex*)malloc((unsigned int)(rows*rows)*sizeof(doubleComplex)); + + for (i=0;i<rows*rows;i++) dblin[i]=DoubleComplex((double)creals(in[i]),(double)cimags(in[i])); + + zspec2a(dblin,rows,dbleigenvalues,dbleigenvectors); + + for (i=0;i<rows*rows;i++) eigenvalues[i]=FloatComplex((float)zreals(dbleigenvalues[i]),(float)zimags(dbleigenvalues[i])); + for (i=0;i<rows*rows;i++) eigenvectors[i]=FloatComplex((float)zreals(dbleigenvectors[i]),(float)zimags(dbleigenvectors[i])); +} diff --git a/src/c/linearAlgebra/spec2/dspec2a.c b/src/c/linearAlgebra/spec2/dspec2a.c new file mode 100644 index 00000000..98b2c5ad --- /dev/null +++ b/src/c/linearAlgebra/spec2/dspec2a.c @@ -0,0 +1,113 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" +#include "lapack.h" +#include "zeros.h" +#include "max.h" + +void dspec2a(double* in, int rows,double* eigenvalues,double* eigenvectors){ + int i=0, j=0, ij=0, ij1=0; + int symmetric=0; + int INFO=0; + int iWorkSize = 0; + double* pdblWork; + double* outReal; + double* outImag; + double* pdblLeftvectors; + double* pdblRightvectors; + double* inCopy; + + /* FIXME : malloc here */ + inCopy = (double*)malloc((unsigned int)(rows*rows) * sizeof(double)); + outReal = (double*)malloc((unsigned int)rows * sizeof(double)); + outImag = NULL; + pdblLeftvectors=NULL; + pdblRightvectors=NULL; + + + iWorkSize = 4*rows; + pdblWork = (double*)malloc((unsigned int)iWorkSize * sizeof(double)); + + for(i=0;i<rows*rows;i++) inCopy[i]=in[i]; + + + + /* look if the matrix is symmetric */ + for (i=0;i<rows;i++){ + for (j=0;j<rows;j++) + if (in[i*rows+j]!=in[i+j*rows]) break; + if (j!=rows) break; + + } + + /* the matrix is symmetric if the 2 loops goes to end i.e + i==rows and j==rows */ + if ((i==rows)&&(j==rows)) symmetric=1; + + /* apply lapack function according to symmetry */ + if(symmetric){ + C2F(dsyev)( "V", "U", &rows, inCopy, &rows, outReal, pdblWork, &iWorkSize, &INFO ); + + /* Computation of eigenvectors */ + for (i=0;i<rows*rows;i++) eigenvectors[i] = inCopy[i]; + } + else { + pdblRightvectors=(double*)malloc((unsigned int)(rows*rows) * sizeof(double)); + outImag = (double*)malloc((unsigned int)rows * sizeof(double)); + C2F(dgeev)( "N", "V", &rows, inCopy, &rows, outReal, outImag, + pdblLeftvectors, &rows, pdblRightvectors, &rows, pdblWork, &iWorkSize, &INFO ); + + /* Computation of eigenvectors */ + j=0; + while (j<rows) + { + if (outImag[j]==0) + { + for(i = 0 ; i < rows ; i++) + { + ij = i + j * rows; + eigenvectors[ij] = pdblRightvectors[ij]; + } + j = j + 1; + } + else + { + for(i = 0 ; i < rows ; i++) + { + ij = i + j * rows; + ij1 = i + (j + 1) * rows; + eigenvectors[ij] = pdblRightvectors[ij]; + eigenvectors[ij1] = pdblRightvectors[ij]; + } + j = j + 2; + } + } + } + + /* Computation of eigenvalues */ + dzerosa(eigenvalues,1,rows*rows); + for (i=0;i<rows;i++) eigenvalues[i+i*rows]=outReal[i]; + + + + + free(inCopy); + free(outReal); + free(outImag); + free(pdblLeftvectors); + free(pdblRightvectors); + free(pdblWork); + +} + diff --git a/src/c/linearAlgebra/spec2/sspec2a.c b/src/c/linearAlgebra/spec2/sspec2a.c new file mode 100644 index 00000000..d3ab00d5 --- /dev/null +++ b/src/c/linearAlgebra/spec2/sspec2a.c @@ -0,0 +1,36 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" + + + +void sspec2a(float* in, int rows, float* eigenvalues,float* eigenvectors){ + /* As we use Lapack to find the eigenvalues, we must cast the float input into double + and the doubleComplex outputs of dspec2a into floatComplex*/ + + int i; + double* dblin; + double *dbleigenvalues,*dbleigenvectors; + + dblin=(double*)malloc((unsigned int)(rows*rows)*sizeof(double)); + dbleigenvalues = (double*)malloc((unsigned int)(rows*rows)*sizeof(double)); + dbleigenvectors = (double*)malloc((unsigned int)(rows*rows)*sizeof(double)); + + for (i=0;i<rows*rows;i++) dblin[i]=(double)in[i]; + + dspec2a(dblin,rows,dbleigenvalues,dbleigenvectors); + + for (i=0;i<rows*rows;i++) eigenvalues[i]=(float)dbleigenvalues[i]; + for (i=0;i<rows*rows;i++) eigenvectors[i]=(float)dbleigenvectors[i]; +} diff --git a/src/c/linearAlgebra/spec2/testDoubleSpec2.c b/src/c/linearAlgebra/spec2/testDoubleSpec2.c new file mode 100644 index 00000000..a090f028 --- /dev/null +++ b/src/c/linearAlgebra/spec2/testDoubleSpec2.c @@ -0,0 +1,261 @@ +/* + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "spec.h" +#include "stdio.h" +#include "assert.h" +#include "math.h" + +static void dspec2aTest(void){ + double in[4]={1,1,1,3}; + double resultValuesR[4]={0.5857864376269050765700,0,0,3.4142135623730949234300}; + double resultVectorsR[4]={- 0.9238795325112867384831,0.3826834323650897817792, + 0.3826834323650897817792,0.9238795325112867384831}; + + + double in2[4]={1,1,-2,3}; + double resultValues2R[4]={1.9999999999999997779554,0,0,1.9999999999999997779554}; + double resultVectors2R[4]={0.8164965809277261454824,- 0.4082482904638631282523, + 0.8164965809277261454824,- 0.4082482904638631282523}; + + double in3[9]={0,-1,0,1,0,0,0,0,0}; + double resultValues3R[9]={0}; + double resultVectors3R[9]={0.7071067811865474617150,0,0,0.7071067811865474617150,0,0,0,0,1}; + + + double out1[4],out2[4],out3[9],out4[9]; + + int i; + dspec2a(in3,3,out3,out4); + for(i=0;i<9;i++){ + if (out3[i]>1e-16) assert( fabs(out3[i]-resultValues3R[i]) / fabs(out3[i]) <3e-16); + else assert(1); + } + for(i=0;i<9;i++){ + if (out4[i]>1e-16) assert( fabs(out4[i]-resultVectors3R[i]) / fabs(out4[i]) <3e-16); + else assert(1); + } + + + dspec2a(in,2,out1,out2); + for(i=0;i<4;i++) printf("%f\n",out1[i]); + for(i=0;i<4;i++){ + if (out1[i]>1e-16) assert( fabs(out1[i]-resultValuesR[i]) / fabs(out1[i]) <3e-16); + else assert(1); + } + for(i=0;i<4;i++){ + if (out2[i]>1e-16) assert( fabs(out2[i]-resultVectorsR[i]) / fabs(out2[i]) <3e-16); + else assert(1); + } + + + dspec2a(in2,2,out1,out2); + + for(i=0;i<4;i++){ + if (out1[i]>1e-16) assert( fabs(out1[i]-resultValues2R[i]) / fabs(out1[i]) <1e-16); + else assert(1); + } + for(i=0;i<4;i++){ + if (out2[i]>1e-16) assert( fabs(out2[i]-resultVectors2R[i]) / fabs(out2[i]) <3e-16); + else assert(1); + } + +} + + + + +static void zspec2aTest(void){ + double inR[4]={1,1,1,3}; + double inI[4]={0,0,0,0}; + double resultValuesR[4]={0.5857864376269050765700,0,0,3.4142135623730949234300}; + double resultValuesI[4]={0,0,0,0}; + double resultVectorsR[4]={- 0.9238795325112867384831,0.3826834323650897817792, + 0.3826834323650897817792,0.9238795325112867384831}; + double resultVectorsI[4]={0,0,0,0}; + + double in2R[4]={1,1,-2,3}; + double in2I[4]={0,0,0,0}; + double resultValues2R[4]={1.9999999999999997779554,0,0,1.9999999999999997779554}; + double resultValues2I[4]={0.9999999999999997779554,0,0,-0.9999999999999997779554}; + double resultVectors2R[4]={0.8164965809277261454824,- 0.4082482904638631282523, + 0.8164965809277261454824,- 0.4082482904638631282523}; + double resultVectors2I[4]={0,- 0.4082482904638629062077,0,0.4082482904638629062077}; + + + double in3R[16]={ 0.4685934986919164657593, 0.4262020816095173358917, 0.4217656338587403297424, 0.1034853602759540081024 , + 0.4279759414494037628174, 0.7860729382373392581940, 0.8568082069978117942810, 0.1993437460623681545258 , + 0.7131301630288362503052, 0.5208952468819916248322, 0.9311723159626126289368, 0.4143836158327758312225, + 0.5980196148157119750977, 0.5549105503596365451813, 0.8552952585741877555847, 0.3097750707529485225678}; + double in3I[16]={0.9446128141134977340698, 0.2442680452950298786163, 0.8760446915403008460999, 0.4874215493910014629364, + 0.3844018988311290740967, 0.0922345430590212345123, 0.0705418726429343223572, 0.7338807261548936367035, + 0.7792180571705102920532, 0.7827638057060539722443, 0.2161567779257893562317, 0.3420197847299277782440, + 0.430093832314014434814 , 0.6261752569116652011871, 0.9554250938817858695984, 0.45415506651625037193 }; + double resultValues3R[16]={2.0556597713281337114211 , 0. , 0. , 0. , + 0. , - 0.3025728286579054682193 , 0. , 0. , + 0. , 0. , 0.1432776981289703988054 , 0. , + 0. , 0. , 0. , 0.59924918284561956571821}; + double resultValues3I[16]={2.0772175543447914947137 , 0. , 0. , 0. , + 0. , - 0.5223086999196728807959 , 0. , 0. , + 0. , 0. , 0.3871735516160564882782 , 0. , + 0. , 0. , 0. , - 0.2349232044266161556489 }; + double resultVectors3R[16]={ 0.5762578366606958546470 , 0.4529873647084416976583 , 0.5438116534400605495137 , 0.3599855200589946457868 , + - 0.3285074902800487195442, - 0.0923654569732548225147, 0.6473744750124794666846, - 0.1812302216765642182139 , + 0.7395301236826927748780, - 0.4588526195219964631811, 0.0997916953568371567496, - 0.3603263850824164338249 , + 0.0717862182160008133192, 0.6967198304315765922112, - 0.1153149977500917411355 , - 0.3232658081022470875077 }; + double resultVectors3I[16]={ 0. , - 0.1082260232744242933745, - 0.1403164362264210929254 , 0.0775054168635924967123 , + 0.0347047096401541868560, - 0.4780157518240965019984, 0. , 0.4493438228998393735303, + 0. , - 0.0484367977162360741072 , 0.0664282497469102783949 , - 0.3098340648435350952461 , + 0.1768623397230159322024, 0. , - 0.4621680558325051979551 , 0.3830799998945915163517}; + + + double in4R[49]={0.0292230211198329925537, 0.1069206790998578071594, 9.7463708464056253433228, 7.7042609406635165214539 , 6.3966313377022743225098, 9.5358861843124032020569, 4.1484833415597677230835, + 4.6615396952256560325623, 2.2384551353752613067627, 3.4569733263924717903137, 2.3406236339360475540161, 6.6193414805456995964050,2.6911795139312744140625,9.8302489006891846656799 , + 7.3933512251824140548706, 2.9021358629688620567322 , 3.9959496073424816131592 , 9.792278115637600421906 , 0.0755135808140039443970, 7.0210226578637957572937 , 8.9075061306357383728027 , + 6.5269742021337151527405 , 4.136228552088141441345 , 8.5816909139975905418396 , 2.3960896767675876617432 , 4.8200417729094624519348, 9.848585547879338264465 , 4.4697216479107737541199, + 2.3298137634992599487305, 2.2345139319077134132385, 8.0025654565542936325073, 7.7507343282923102378845, 4.8250066302716732025146, 7.8448831336572766304016 , 1.5346793178468942642212 , + 7.7228771103546023368835 , 8.9520217850804328918457, 9.4673257926478981971741, 6.9818257447332143783569, 9.5591608202084898948669, 0.4840173013508319854736, 5.3235206427052617073059, + 2.9468670953065156936646, 6.9771366892382502555847 , 9.3762038648128509521484 , 1.0755608463659882545471 , 7.7634243946522474288940, 6.3734178384765982627869 , 0.6630615703761577606201 }; + double in4I[49]={8.1694598542526364326477, 3.5473910067230463027954, 5.860544512979686260223, 3.4610254690051078796387, 4.4247510144487023353577, 8.8226650562137365341187, 7.6436930662021040916443 , + 7.764139864593744277954, 2.8076809318736195564270, 6.9086006004363298416138, 7.1747286943718791007996, 3.7201813608407974243164 , 9.3254965776577591896057, 2.2566775511950254440308, + 7.5211019208654761314392 , 3.0747506581246852874756 , 5.9793261485174298286438, 1.9238903466612100601196, 2.3870888305827975273132 , 7.4708331003785133361816, 9.7131536761298775672913, + 4.3703553732484579086304, 6.2248750543221831321716, 3.2913279719650745391846, 3.2963873865082859992981, 2.7686371374875307083130 , 4.8729835031554102897644, 7.7320465445518493652344 , + 9.0775218093767762184143, 5.0122931879013776779175, 5.1595458528026938438416, 5.79267887398600578308 , 1.5463936375454068183899 , 7.6111377868801355361938, 6.9079177780076861381531 , + 2.8732293471693992614746, 9.64253133628517389297 , 5.6607243325561285018921, 5.7821379369124770164490, 2.6634209789335727691650 , 4.7470985027030110359192, 6.0735465306788682937622, + 0.4097307054325938224793, 5.0125684589147567749023 , 5.2959309751167893409729, 6.2594583164900541305542, 2.2193526616320013999939 , 3.467419948428869247437, 3.9511676924303174018860 }; + double resultValues4R[49]={39.018457752476393807228 ,0,0,0,0,0,0, + 0,2.2455352415739073812517,0,0,0,0,0, + 0,0,- 8.4848591657394489828903,0,0,0,0, + 0,0,0,- 9.617033196016185669919,0,0,0, + 0,0,0,0,- 3.7815852014367528077798,0,0, + 0,0,0,0,0,- 4.44858427601393291440,0, + 0,0,0,0,0,0,- 0.3001282122401837670900}; + double resultValues4I[49]={36.525725390582877594170,0,0,0,0,0,0, + 0,- 5.9058762755733944516123,0,0,0,0,0, + 0,0,- 3.5959527108686115681735,0,0,0,0, + 0,0,0,1.8928051444081777088257,0,0,0, + 0,0,0,0,- 3.1889864758923365251064,0,0, + 0,0,0,0,0,3.2418188738592150777151,0, + 0,0,0,0,0,0,1.5279802073147508156836}; + + double resultVectors4R[49]={ 0.3499995148567048852684, 0.3131141942665225941234, 0.4518966551544936205431, 0.3429358568207974133912, 0.3073919828504245721490, 0.4236868694783915145763, 0.3928739146959387973368 , + 0.2654822689469810148566 , - 0.3607918093136298631762, 0.0473515544359270068586 , 0.5097969509656486986060 , -0.3771134435310480315096 , 0.2011534205484152293408, - 0.4415200724898113993078, + 0.5454886553461798515130, - 0.2173248800239625522224, - 0.2171708216301463378883 , - 0.2460117034233289534662 , -0.3694743444265859433351 , 0.3601018742104445391483, 0.1530612374027510713681, + 0.6385835932752577104310, - 0.0013906755423099548263, - 0.3368505708673739662551 , 0.1394203608831885433 , -0.2292783363046769218308 , -0.2740379414191142504187, 0.1926279946047058377889 , + - 0.6106238336849327819067, 0.0128604884735820379493, 0.2248434453925002574071, - 0.0955950290268089419854 , 0.6322383898844411431739 , - 0.1362122761803175874373, - 0.0030545591332723984190, + 0.5431360047322275619308, 0.1304324282476526930541, - 0.3713242513274904177401, - 0.2693820083406764376299 , - 0.1431429883314006001882 , 0.0533021313694299267438, 0.0071247423818797811501 , + - 0.156705245229635081738, 0.0034676864415526253982 , - 0.3351413975178426096768 , 0.2927797449896782921996 , 0.5714932440406852443005 , 0.0738366305178744797288, - 0.4509415569247051669422 }; + double resultVectors4I[49]={ 0.0720991445669864616796 , 0.0844739028302603361942 , 0. , 0.0173431366502564965337, -0.0428710162141596462515, 0.0695226101295536302871, 0.0999385617869267273150, + 0.2510960793336660668018 , - 0.1123901435582568414384, 0.0091069807153507792430, 0. , - 0.2545493692188907641771, 0.1149714203529902251111, 0.0762796210842419941667, + 0. , 0.0611827470444509316505, 0.2295643426501567385678, - 0.2950878328821502361024, 0.198556748820033573955, 0.0646801132828138114483, - 0.2660572521172601678785, + 0. , 0.2688905463703794573860, 0.2230635356255223633593 , - 0.2013432448241845862391, - 0.0386922946770884290668, 0.0358963301038670995480, - 0.3593711366897305303780 , + - 0.1386717901043315326337, 0.0600994116374372472356, - 0.1167558596038882207102 , 0.317965599565130263571, 0. , -0.0642522754144960878131, - 0.0853665514099945371695, + 0. , 0.2715431731544318272320, - 0.1184277560110737481658 , 0.3655618467608299226868, - 0.4598766797780974302512 , 0.0188698345957667955319, - 0.1446429340244405892246, + 0.346095581161616094867 , 0.0750882555805542639682, - 0.2494867985551498246188, - 0.2328934592128872882455, 0. , -0.0047307828167728396829, - 0.0078254955461786041004}; + + + + + doubleComplex *in,*in2,*in3,*in4,out1[4],out2[4],out3[16],out4[16],out5[49],out6[49]; + + int i; + + in=DoubleComplexMatrix(inR,inI,4); + in2=DoubleComplexMatrix(in2R,in2I,4); + in3=DoubleComplexMatrix(in3R,in3I,16); + in4=DoubleComplexMatrix(in4R,in4I,49); + zspec2a(in,2,out1,out2); + + + for(i=0;i<4;i++){ + if (zreals(out1[i])>1e-16) assert( fabs(zreals(out1[i])-resultValuesR[i]) / fabs(zreals(out1[i])) <3e-16); + else assert(1); + if (zimags(out1[i])>1e-16) assert( fabs(zimags(out1[i])-resultValuesI[i]) / fabs(zimags(out1[i])) <1e-16); + else assert(1); + } + + for(i=0;i<4;i++){ + if (zreals(out2[i])>1e-16) assert( fabs(zreals(out2[i])-resultVectorsR[i]) / fabs(zreals(out2[i])) <3e-16); + else assert(1); + if (zimags(out2[i])>1e-16) assert( fabs(zimags(out2[i])-resultVectorsI[i]) / fabs(zimags(out2[i])) <1e-16); + else assert(1); + } + + + zspec2a(in2,2,out1,out2); + for(i=0;i<4;i++){ + if (zreals(out1[i])>1e-16) assert( fabs(zreals(out1[i])-resultValues2R[i]) / fabs(zreals(out1[i])) <3e-16); + else assert(1); + if (zimags(out1[i])>1e-16) assert( fabs(zimags(out1[i])-resultValues2I[i]) / fabs(zimags(out1[i])) <3e-15); + else assert(1); + } + + for(i=0;i<4;i++){ + if (zreals(out2[i])>1e-16) assert( fabs(zreals(out2[i])-resultVectors2R[i]) / fabs(zreals(out2[i])) <3e-16); + else assert(1); + if (zimags(out2[i])>1e-16) assert( fabs(zimags(out2[i])-resultVectors2I[i]) / fabs(zimags(out2[i])) <3e-15); + else assert(1); + } + + + + zspec2a(in3,4,out3,out4); + for(i=0;i<16;i++){ + if (zreals(out3[i])>1e-16) assert( fabs(zreals(out3[i])-resultValues3R[i]) / fabs(zreals(out3[i])) <3e-15); + else assert(1); + if (zimags(out3[i])>1e-16) assert( fabs(zimags(out3[i])-resultValues3I[i]) / fabs(zimags(out3[i])) <3e-15); + else assert(1); + } + for(i=0;i<16;i++){ + if (zreals(out4[i])>1e-16) assert( fabs(zreals(out4[i])-resultVectors3R[i]) / fabs(zreals(out4[i])) <3e-15); + else assert(1); + if (zimags(out4[i])>1e-16) assert( fabs(zimags(out4[i])-resultVectors3I[i]) / fabs(zimags(out4[i])) <3e-14); + else assert(1); + } + + /* FIXME : assert : 3e-16 maybe du to little values like 0.001... */ + zspec2a(in4,7,out5,out6); + + for(i=0;i<49;i++){ + if (zreals(out5[i])>1e-16) assert( fabs(zreals(out5[i])-resultValues4R[i]) / fabs(zreals(out5[i])) <3e-15); + else assert(1); + if (zimags(out5[i])>1e-16) assert( fabs(zimags(out5[i])-resultValues4I[i]) / fabs(zimags(out5[i])) <3e-14); + else assert(1); + } + for(i=0;i<49;i++){ + if (zreals(out6[i])>1e-16) assert( fabs(zreals(out6[i])-resultVectors4R[i]) / fabs(zreals(out6[i])) <3e-14); + else assert(1); + if (zimags(out6[i])>1e-16) assert( fabs(zimags(out6[i])-resultVectors4I[i]) / fabs(zimags(out6[i])) <3e-13); + else assert(1); + } + + + +} + + +static int testSpec2(void){ + printf(">>> Double Spec2 Tests <<<\n"); + printf(">>> Double <<<\n"); + dspec2aTest(); + printf(">>> DoubleComplex <<<\n"); + zspec2aTest(); + return 0; +} + + +int main(void){ + assert (testSpec2()==0); + + + return 0; +} diff --git a/src/c/linearAlgebra/spec2/testFloatSpec2.c b/src/c/linearAlgebra/spec2/testFloatSpec2.c new file mode 100644 index 00000000..fb2bc255 --- /dev/null +++ b/src/c/linearAlgebra/spec2/testFloatSpec2.c @@ -0,0 +1,134 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + + +#include "spec.h" +#include "stdio.h" +#include "assert.h" +#include "math.h" + +static void sspec2aTest(void){ + float in[4]={1.0f,1.0f,1.0f,3.0f}; + float resultValuesR[4]={0.5857864376269050765700f,0,0,3.4142135623730949234300f}; + float resultVectorsR[4]={- 0.9238795325112867384831f,0.3826834323650897817792f, + 0.3826834323650897817792f,0.9238795325112867384831f}; + + float in2[4]={1.0f,1.0f,-2.0f,3.0f}; + float resultValues2R[4]={1.9999999999999997779554f,0,0,1.9999999999999997779554f}; + float resultVectors2R[4]={0.8164965809277261454824f,- 0.4082482904638631282523f, + 0.8164965809277261454824f,- 0.4082482904638631282523f}; + float eigenvalues[4],eigenvectors[4]; + + int i; + + sspec2a(in,2,eigenvalues,eigenvectors); + + for(i=0;i<4;i++){ + if (eigenvalues[i]>1e-6) assert( fabs(eigenvalues[i]-resultValuesR[i]) / fabs(eigenvalues[i]) <1e-16); + else assert(1); + } + for(i=0;i<4;i++){ + if (eigenvectors[i]>1e-6) assert( fabs(eigenvectors[i]-resultVectorsR[i]) / fabs(eigenvectors[i]) <1e-16); + else assert(1); + } + + + sspec2a(in2,2,eigenvalues,eigenvectors); + + + + for(i=0;i<4;i++){ + if (eigenvalues[i]>1e-6) assert( fabs(eigenvalues[i]-resultValues2R[i]) / fabs(eigenvalues[i]) <1e-16); + else assert(1); + } + for(i=0;i<4;i++){ + if (eigenvectors[i]>1e-6) assert( fabs(eigenvectors[i]-resultVectors2R[i]) / fabs(eigenvectors[i]) <1e-16); + else assert(1); + } +} + + + + +static void cspec2aTest(void){ + float inR[4]={1.0f,1.0f,1.0f,3.0f}; + float inI[4]={0.0f,0.0f,0.0f,0.0f}; + float resultValuesR[4]={0.5857864376269050765700f,0,0,3.4142135623730949234300f}; + float resultValuesI[4]={0,0,0,0}; + float resultVectorsR[4]={- 0.9238795325112867384831f,0.3826834323650897817792f, + 0.3826834323650897817792f,0.9238795325112867384831f}; + float resultVectorsI[4]={0,0,0,0}; + + float in2R[4]={1.0f,1.0f,-2.0f,3.0f}; + float in2I[4]={0.0f,0.0f,0.0f,0.0f}; + float resultValues2R[4]={1.9999999999999997779554f,0,0,1.9999999999999997779554f}; + float resultValues2I[4]={0.9999999999999997779554f,0,0,-0.9999999999999997779554f}; + float resultVectors2R[4]={0.8164965809277261454824f,- 0.4082482904638631282523f, + 0.8164965809277261454824f,- 0.4082482904638631282523f}; + float resultVectors2I[4]={0,- 0.4082482904638629062077f,0,0.4082482904638629062077f}; + + floatComplex *in,*in2,out1[4],out2[4]; + + int i; + + in=FloatComplexMatrix(inR,inI,4); + in2=FloatComplexMatrix(in2R,in2I,4); + + cspec2a(in,2,out1,out2); + for(i=0;i<4;i++){ + if (creals(out1[i])>1e-16) assert( fabs(creals(out1[i])-resultValuesR[i]) / fabs(creals(out1[i])) <1e-15); + else assert(1); + if (cimags(out1[i])>1e-16) assert( fabs(cimags(out1[i])-resultValuesI[i]) / fabs(cimags(out1[i])) <1e-16); + else assert(1); + } + for(i=0;i<4;i++){ + if (creals(out2[i])>1e-16) assert( fabs(creals(out2[i])-resultVectorsR[i]) / fabs(creals(out2[i])) <1e-15); + else assert(1); + if (cimags(out2[i])>1e-16) assert( fabs(cimags(out2[i])-resultVectorsI[i]) / fabs(cimags(out2[i])) <1e-16); + else assert(1); + } + + + cspec2a(in2,2,out1,out2); + for(i=0;i<4;i++){ + if (creals(out1[i])>1e-16) assert( fabs(creals(out1[i])-resultValues2R[i]) / fabs(creals(out1[i])) <1e-15); + else assert(1); + if (cimags(out1[i])>1e-16) assert( fabs(cimags(out1[i])-resultValues2I[i]) / fabs(cimags(out1[i])) <1e-15); + else assert(1); + } + for(i=0;i<4;i++){ + if (creals(out2[i])>1e-16) assert( fabs(creals(out2[i])-resultVectors2R[i]) / fabs(creals(out2[i])) <1e-15); + else assert(1); + if (cimags(out2[i])>1e-16) assert( fabs(cimags(out2[i])-resultVectors2I[i]) / fabs(cimags(out2[i])) <1e-16); + else assert(1); + } +} + + + + +static int testSpec2(void){ + printf(">>> Float Spec2 Tests <<<\n"); + printf(">>> Float <<<\n"); + sspec2aTest(); + printf(">>> FloatComplex <<<\n"); + cspec2aTest(); + return 0; +} + + +int main(void){ + assert (testSpec2()==0); + + + return 0; +} diff --git a/src/c/linearAlgebra/spec2/test_DoubleSpec2/testDoubleSpec2.vcxproj b/src/c/linearAlgebra/spec2/test_DoubleSpec2/testDoubleSpec2.vcxproj new file mode 100644 index 00000000..7c36943b --- /dev/null +++ b/src/c/linearAlgebra/spec2/test_DoubleSpec2/testDoubleSpec2.vcxproj @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{FD0A4495-C372-41EF-B8EF-0A0939DA6C1E}</ProjectGuid>
+ <RootNamespace>testDoubleSpec2</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testDoubleSpec2.c">
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\type\type.vcxproj">
+ <Project>{9b1bd750-1fef-4d6b-9422-782d16181cee}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\matrixOperations.vcxproj">
+ <Project>{fd335544-52bf-4736-a34e-77f591d158d5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec2/test_DoubleSpec2/testDoubleSpec2.vcxproj.filters b/src/c/linearAlgebra/spec2/test_DoubleSpec2/testDoubleSpec2.vcxproj.filters new file mode 100644 index 00000000..04f409dc --- /dev/null +++ b/src/c/linearAlgebra/spec2/test_DoubleSpec2/testDoubleSpec2.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testDoubleSpec2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec2/test_FloatSpec2/testFloatSpec2.vcxproj b/src/c/linearAlgebra/spec2/test_FloatSpec2/testFloatSpec2.vcxproj new file mode 100644 index 00000000..f4154eb1 --- /dev/null +++ b/src/c/linearAlgebra/spec2/test_FloatSpec2/testFloatSpec2.vcxproj @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{E20D0BC2-B28A-412C-9715-5B93B319A4A3}</ProjectGuid>
+ <RootNamespace>testFloatSpec2</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../../includes;../../../type;../../includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testFloatSpec2.c">
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
+ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\type\type.vcxproj">
+ <Project>{9b1bd750-1fef-4d6b-9422-782d16181cee}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\..\matrixOperations.vcxproj">
+ <Project>{fd335544-52bf-4736-a34e-77f591d158d5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec2/test_FloatSpec2/testFloatSpec2.vcxproj.filters b/src/c/linearAlgebra/spec2/test_FloatSpec2/testFloatSpec2.vcxproj.filters new file mode 100644 index 00000000..0c38d2f2 --- /dev/null +++ b/src/c/linearAlgebra/spec2/test_FloatSpec2/testFloatSpec2.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\testFloatSpec2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/src/c/linearAlgebra/spec2/zspec2a.c b/src/c/linearAlgebra/spec2/zspec2a.c new file mode 100644 index 00000000..e33ed897 --- /dev/null +++ b/src/c/linearAlgebra/spec2/zspec2a.c @@ -0,0 +1,96 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdlib.h> +#include "spec.h" +#include "lapack.h" +#include "zeros.h" +#include "stdio.h" +#include "conj.h" + +void zspec2a(doubleComplex* in, int rows,doubleComplex* eigenvalues, doubleComplex* eigenvectors){ + int i = 0, j = 0; + int hermitian = 0; + int INFO = 0; + int iWorkSize = 0; + doubleComplex* pdblWork; + doubleComplex* pdblLeftvectors; + doubleComplex* pdblRightvectors; + doubleComplex* pdblRWork; + double* pdblRWork2; + double* outReal; + double* outImag; + doubleComplex* inCopy; + + inCopy = (doubleComplex*)malloc((unsigned int)(rows*rows) * sizeof(doubleComplex)); + outReal = (double*)malloc((unsigned int)rows * sizeof(double)); + outImag = (double*)malloc((unsigned int)rows * sizeof(double)); + pdblLeftvectors=NULL; + pdblRightvectors=NULL; + + iWorkSize = 2*rows; + pdblWork = (doubleComplex*)malloc((unsigned int)iWorkSize * sizeof(doubleComplex)); + pdblRWork = NULL; + pdblRWork2 = NULL; + + for(i=0;i<rows*rows;i++) { + inCopy[i]=DoubleComplex(zreals(in[i]),zimags(in[i])); + eigenvectors[i]=DoubleComplex(zreals(in[i]),zimags(in[i])); + } + zzerosa(eigenvalues,1,rows*rows); + + + /* look if the matrix is symmetric */ + for (i=0;i<rows;i++){ + for (j=0;j<rows;j++) + if ( (zreals(in[i*rows+j])!=zreals(zconjs(in[i+j*rows]))) || + (zimags(in[i*rows+j])!=zimags(zconjs(in[i+j*rows]))) ) + break; + if (j!=rows) break; + } + + + /* the matrix is symmetric if the 2 loops goes to end i.e + i==rows and j==rows */ + if ((i==rows)&&(j==rows)) hermitian=1; + + + /* apply lapack function according to symmetry */ + if(hermitian){ + pdblRWork2 = (double*)malloc((unsigned int)(3*rows) * sizeof(double)); + C2F(zheev)( "V", "U", &rows, eigenvectors, &rows, outReal, pdblWork, &iWorkSize, pdblRWork2, &INFO ); + dzerosa(outImag,1,rows); + for (i=0;i<rows;i++) eigenvalues[i+i*rows]=DoubleComplex(outReal[i],outImag[i]); + } + else { + pdblRWork = (doubleComplex*)malloc((unsigned int)(3*rows) * sizeof(doubleComplex)); + C2F(zgeev)( "N", "V", &rows, inCopy, &rows, eigenvalues, + pdblLeftvectors, &rows, eigenvectors, &rows, pdblWork, &iWorkSize, + pdblRWork, &INFO ); + for (i=1;i<rows;i++) { + eigenvalues[i+i*rows]=DoubleComplex(zreals(eigenvalues[i]),zimags(eigenvalues[i])); + eigenvalues[i]=DoubleComplex(0,0); + } + } + + + + + free(inCopy); + free(outReal); + free(outImag); + free(pdblWork); + free(pdblRWork); + free(pdblRWork2); + free(pdblLeftvectors); + free(pdblRightvectors); +} diff --git a/src/c/linearAlgebra/sqroot/dsqroota.c b/src/c/linearAlgebra/sqroot/dsqroota.c new file mode 100644 index 00000000..1ba97268 --- /dev/null +++ b/src/c/linearAlgebra/sqroot/dsqroota.c @@ -0,0 +1,130 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* Function - sqroot of scilab, W*W' hermitian factorization */ + +#include <stdio.h> +#include "stdlib.h" +#include "string.h" +#include <math.h> +#include "matrixTranspose.h" +#include "svd.h" +#include "matrixMultiplication.h" + +#define eps 2.22044604925e-16 + +/*It would be good, if you are doing conversoins for only valid inputs before + running the program, check all the conditions before hand. +*/ + +void dsqroota(double *inp,int row,int col, double *out){ + if(row != col){ + printf("Enter valid inputs only - matrix should be symetric\n"); + return; + } + int i,j; + double *U,*S,*V; + double *A,*B; + int rk; + + U = (double *)malloc((double)row*row*sizeof(double)); + S = (double *)malloc((double)Min(row,col)*Min(row,col)*sizeof(double)); + V = (double *)malloc((double)col*col*sizeof(double)); + A = (double *)malloc(rk*rk*sizeof(double)); + B = (double *)malloc(rk*row*sizeof(double)); + + double *Q1; + Q1 = (double *)malloc(row*col*sizeof(double)); + + dtransposea(inp,row,col,Q1); + + double *Q2; + Q2 = (double *)malloc(col*row*sizeof(double)); + + /* Q2 = (inp+inp1')/2; */ + for(i=0;i<row;i++){ + for(j=0;j<row;j++){ + Q2[i+j*row] = ((inp[i+j*row]+Q1[i+j*row])/2); + } + } + + /* norm(Q2-Q1,1) - finding the max value from sum of columns */ + double sum = 0; + double maxi=0; + for(i=0;i<row;i++){ + sum = 0; + for(j=0;j<col;j++) sum+=(Q2[i*row+j]-inp[i*row+j]); + if(maxi < sum){ + maxi = sum; + } + } + + /* if norm(Q1-Q,1) > 100*%eps then */ + if(maxi > 100*eps){ + printf("Warning: Wrong size for input argument and Symmetric expected\n"); + } + maxi = 0; + for(i=0;i<col;i++){ + sum=0; + for(j=0;j<row;j++) sum+=Q1[i*row+j]; + if(maxi < sum){ + maxi = sum; + } + } + + /*if norm(Q,1) < sqrt(%eps) then S=[];return;end*/ + + if(maxi < sqrt(eps)){ + out = NULL; + } + else{ + rk = dsvda(0,inp,row,col,0,4,U,S,V); + + /*Will be used in complex numbers*/ + //C = (double *)malloc(rk*row*sizeof(double)); + + /*for(i=0;i<row;i++){ + for(j=0;j<row;j++){ + printf("%lf ",S[i*row+j]); + } + printf("\n"); + }*/ + /*sqrt of S*/ + //printf("%d ",rk); + for(i=0;i<rk;i++){ + for(j=0;j<rk;j++){ + A[i*rk+j] = sqrt(S[i*row+j]); + //printf("%lf ",A[i*rk+j]); + } + } + for(i=0;i<col*rk;i++){ + B[i] = V[i]; + //printf("%lf ",B[i]); + } + //printf("\n"); + /*for(i=0;i<rk;i++){ + for(j=0;j<rk;j++){ + //A[i*rk+j] = sqrt(S[i*row+j]); + printf("%lf ",A[i*rk+j]); + } + printf("\n"); + }*/ + /*for(i=0;i<col;i++){ + for(j=0;j<rk;j++){ + //B[i*col+j] = VT[i*col+j]; + printf("%lf ",B[i*col+j]); + } + printf("\n"); + }*/ + dmulma(B,col,rk,A,rk,rk,out); + } +} diff --git a/src/c/linearAlgebra/sva/dsvaa.c b/src/c/linearAlgebra/sva/dsvaa.c new file mode 100644 index 00000000..691694e4 --- /dev/null +++ b/src/c/linearAlgebra/sva/dsvaa.c @@ -0,0 +1,93 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + + */ +#include "sva.h" +#include "svd.h" +#include "lapack.h" +#include <stdio.h> +#include <stdlib.h> +#include "string.h" +#include "matrixTranspose.h" + +#define eps 2.22044604925e-16 + +/* Ref: Scilab source code */ +void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \ + double *out2,double *out3){ + + double tol; + double rk=0; + int N=col,M=row; + if(row == 0 && col == 0) return; + int i,j; + int arow; /*Actual row of given matrix*/ + int acol; /*Actual col of given matrix*/ + + /* Calculation of svd of a given matrix */ + double *U,*S,*V; + U = (double *)malloc((double)row*Min(row,col)*sizeof(double)); + S = (double *)malloc((double)Min(row,col)*Min(row,col)*sizeof(double)); + V = (double *)malloc((double)col*Min(row,col)*sizeof(double)); + + dsvda(0,in1,M,N,1,3,U,S,V); + + if (ninp == 1){ /* [u,s,v] = sva(A) when input is only matrix */ + tol = Max(row,col)*S[0]*eps; + rk = 0; + for(i=0;i<col;i++){ + if(S[i+i*row] > tol){ + rk+=1; + } + } + } + else{ /*[u,s,v] = sva(A,tol) when two input's are there */ + tol = in2; + if(tol > 1){ + rk = tol; + if(rk > Min(row,col)){ + printf("ERROR: Wrong value for input argument !"); + out1 = NULL; + out2 = NULL; + out3 = NULL; + return; + } + } + else{ + rk = 0; + for(i=0;i<col;i++){ + if(S[i+i*row] > tol){ + rk+=1; + } + } + } + } + arow = M; + acol = Min(M,N); /* Copying, the output in required format */ + for(i=0;i<arow;i++){ + for(j=0;j<rk;j++){ + out1[i+j*row]=U[i+j*arow]; + } + } + arow = Min(M,N); + for(i=0;i<rk;i++){ /* Copying, the output in required format */ + for(j=0;j<rk;j++){ + out2[i+j*(int)rk] = S[i+j*arow]; + } + } + arow = N; + acol = Min(M,N); + for(i=0;i<arow;i++){ /* Copying, the output in required format */ + for(j=0;j<rk;j++){ + out3[i+j*arow] = V[i+j*arow]; + } + } +} diff --git a/src/c/linearAlgebra/svd/.1.c.swp b/src/c/linearAlgebra/svd/.1.c.swp Binary files differnew file mode 100644 index 00000000..81d9e9cf --- /dev/null +++ b/src/c/linearAlgebra/svd/.1.c.swp diff --git a/src/c/linearAlgebra/svd/dsvda.c b/src/c/linearAlgebra/svd/dsvda.c new file mode 100644 index 00000000..c3bcfc29 --- /dev/null +++ b/src/c/linearAlgebra/svd/dsvda.c @@ -0,0 +1,184 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + + */ + +/*Funtion to find singular value decomposition of given matrix */ + +#include "lapack.h" +#include <stdio.h> +#include <stdlib.h> +#include "string.h" +#include <math.h> +#include "svd.h" +#include "matrixTranspose.h" + +int min(int a,int b); +int max(int a,int b); + +extern double dgesvd_(char*,char*,int*,int*,double*,int*,double*,double*,int*,\ + double*,int*,double *,int*,int*); + +#define eps 2.22044604925e-16 /* pow(2,-52) */ + +/* DGESVD computes the singular value decomposition (SVD) of a real + M-by-N matrix A, optionally computing the left and/or right singular + vectors. The SVD is written + + A = U * SIGMA * transpose(V) */ + +/*Function support - + +s=svd(X) +[U,S,V]=svd(X) +[U,S,V]=svd(X,0) (obsolete) +[U,S,V]=svd(X,"e") +[U,S,V,rk]=svd(X [,tol]) + +*/ + +double dsvda(double tol,double *in1,int row,int col,double in2,double nout,double *out1, \ + double *out2,double *out3){ + + char JOBU,JOBVT; + int i,j,k; + int LDU=1; /*Leading Dimension of U */ + int LDVT=1; /*Leading Dimension of VT */ + int M = row; + int N = col; + double *buf; + double *S,*U,*VT; + double *WORK; + + int rk; /*Fourth output if needed */ + + /*if((nout > 1 && in2 == 1) && (M != N)){ // [U,S,VT] = svd(x,'e') + if(M > N){ + JOBU = 'S'; + JOBVT = 'A'; + LDVT = N; + } + else{ + JOBU = 'A'; + JOBVT = 'S'; + LDVT = min(M,N); + } + LDU = M; + U = (double*) malloc((double) (LDU)*min(M,N)*sizeof(double)); + VT = (double*) malloc((double) (LDVT)*N*sizeof(double)); + } + else */if(nout > 1){ /* [U,S,VT = svd(x)] */ + JOBU = 'A'; /*If JOBU = 'A', U contains the M-by-M orthogonal matrix U */ + JOBVT = 'A'; /*JOBVT = 'A': all N rows of V**T are returned in the array VT;*/ + LDU = M; + LDVT = N; + U = (double*) malloc((double) M*M*sizeof(double)); + VT = (double*) malloc((double) N*N*sizeof(double)); + } + else{ /* ans = svd(x) */ + JOBU = 'N'; + JOBVT = 'N'; + } + int LDA = max(1,M); + + /* Making a copy of input matrix */ + buf = (double*) malloc((double)M*N*sizeof(double)); + memcpy(buf,in1,M*N*sizeof(double)); + + S = (double*)malloc((double)min(col,row)*sizeof(double)); + + int LWORK = 5*min(M,N); + WORK = (double*)malloc((double)LWORK*sizeof(double)); + int INFO = 0; /*For successful exit */ + + dgesvd_(&JOBU,&JOBVT,&M,&N,buf,&LDA,S,U,&LDU,VT,&LDVT,WORK,&LWORK,&INFO); + /*Subroutine DGESVD from Lapack lib. */ + + if (nout == 1){ /* ans = svd(x)*/ + memcpy(out1,S,min(row,col)*sizeof(double)); + //printf("%lf %lf %lf",*(S),*(S+1),*(S+2)); + } /* [U,S,VT] = svd(x) */ + else if(in2 == 0 && nout > 1){ + memcpy(out1,U,LDU*M*sizeof(double)); + //memcpy(out3,VT,LDVT*min(row,col)*sizeof(double)); + for(j=0;j<M;j++){ + for(k=0;k<N;k++){ + if(j == k) *((out2+j*(min(M,N)))+k) = *(S+j); + else *((out2+j*(min(M,N)))+k) = 0; + } + } + + //dtransposea(VT,LDVT,N,out3); + /*As there is some patch of error in SVD, these lines are added */ + + for(j=1;j<=N;j++){ + for(i=j;i<=N;i++){ + *(out3+i+(j-1)*N-1) = VT[j+(i-1)*N-1]; + *(out3+j+(i-1)*N-1) = VT[i+(j-1)*N-1]; + } + } + /*for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + printf("%lf ",VT[i*row+j]); + } + printf("\n"); + }*/ + } + else{ + memcpy(out1,U,M*min(M,N)*sizeof(double)); + for(j=0;j<min(M,N);j++){ + for(k=0;k<min(M,N);k++){ + if(j == k) *((out2+j*(min(M,N)))+k) = *(S+j); + else *((out2+j*(min(M,N)))+k) = 0; + } + } + //dtransposea(VT,LDVT,N,out3); + /*As there is some patch of error in DGESVD, these lines are added */ + /* out3 first taken in some array then will be copied from it. */ + double *outV; + outV = (double *)malloc(N*N*sizeof(double)); + for(j=1;j<=N;j++){ + for(i=j;i<=N;i++){ + *(outV+i+(j-1)*N-1) = VT[j+(i-1)*N-1]; + *(outV+j+(i-1)*N-1) = VT[i+(j-1)*N-1]; + } + } + + for(j=0;j<min(M,N)*N;j++){ + *(out3+j) = *(outV+j); + } + } + + /* From the fortran file of scilab code - if(tol.eq.0.0d0) tol=dble(max(M,N))*eps*stk(lSV) */ + if(tol == 0){ + tol = (double)max(M,N)*eps*S[0]; + } + if(nout == 4){ /*[U,S,VT,rk] = svd(X,tol) where tol - tolerance*/ + rk = 0; + for(i=0;i<min(M,N);i++){ + if(S[i] > tol){ + rk = i+1; + } + } + return rk; + } + return 0; +} + +int min(int a,int b){ + if(a > b) return b; + return a; +} + +int max(int a,int b){ + if(a > b) return a; + return b; +} diff --git a/src/c/linearAlgebra/svd/zsvda.c b/src/c/linearAlgebra/svd/zsvda.c new file mode 100644 index 00000000..c75cc50c --- /dev/null +++ b/src/c/linearAlgebra/svd/zsvda.c @@ -0,0 +1,183 @@ +/* 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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + + */ +#include "svd.h" +#include "lapack.h" +#include <stdio.h> +#include <stdlib.h> +#include "string.h" +#include "doubleComplex.h" +#include "matrixTranspose.h" +#include "conj.h" + +/* Lapack functions used . */ +extern doubleComplex zgesvd_( char* , char* , int* , int* ,doubleComplex *,\ + int* , double* ,doubleComplex* , int* ,doubleComplex* , int* ,\ + doubleComplex* , int* , double* , int* ); + + +int Min(int a,int b){ + if(a > b) + return b; + return a; +} + +int Max(int a,int b){ + if(a > b) + return a; + else + return b; +} + +void zsvda(doubleComplex *in1,int row,int col,int in2,int nout, doubleComplex *out1,\ + doubleComplex *out2,doubleComplex *out3){ + + /* Allocating memory and copying the input in buf*/ + doubleComplex *buf; + buf = (doubleComplex *)malloc(row*col*sizeof(doubleComplex)); + memcpy(buf,in1,row*col*sizeof(doubleComplex)); + + /* Type of variable used */ + int i,j,k; + char JOBU,JOBVT; + int M = row; + int N = col; + int LDA,LDU,LDVT,LWORK,INFO; + + /*double precision array to store Sigma*/ + double *S; + S = (double *)malloc(Min(M,N)*sizeof(double)); + + /* amount of memory needed for work */ + LWORK = Max(1,2*Min(M,N)+Max(M,N)); + doubleComplex *WORK = malloc(Max(1,2*LWORK)*sizeof(doubleComplex)); + + double *RWORK; + RWORK = (double *)malloc(5*Min(M,N)*sizeof(double)); + + INFO = 0; + + if(nout == 1){ + JOBU = 'N'; + JOBVT = 'N'; + LDA = M; + LDU = M; + LDVT = N; + //doubleComplex *U,*VT; + //U = malloc(sizeof(doubleComplex)); + //VT = malloc(sizeof(doubleComplex)); + zgesvd_(&JOBU,&JOBVT,&M,&N,buf,&LDA,S,NULL,&LDU,NULL,&LDVT,WORK,&LWORK,RWORK,&INFO); + + //memcpy(out2,S,Min(M,N)*sizeof(double)); + for(i=0;i<Min(M,N);i++){ + out2[i] = DoubleComplex(S[i],0); + //out2[i] = S[i]; + //out2[i] = 0; + } + out1 = NULL; + out3 = NULL; + //for(i=0;i<Min(M,N);i++) printf("%lf ",S[i]); + //free(S); + } + else if(nout == 3){ + if(in2 == 0 || M == N){ + JOBU = 'A'; + JOBVT = 'A'; + LDA = M; + LDU = M; + LDVT = N; + doubleComplex *U = malloc(LDU*M*sizeof(doubleComplex)); + doubleComplex *VT = malloc(LDVT*N*sizeof(doubleComplex)); + + /*doubleComplex wopt; + LWORK = -1; + zgesvd_(&JOBU,&JOBVT,&M,&N,buf,&LDA,S,U,&LDU,VT,&LDVT,&wopt,&LWORK,RWORK,&INFO);*/ + + //LWORK = (int)zreals(wopt); + + WORK = (doubleComplex *)malloc(LWORK*sizeof(doubleComplex)); + zgesvd_(&JOBU,&JOBVT,&M,&N,buf,&LDA,S,U,&LDU,VT,&LDVT,WORK,&LWORK,RWORK,&INFO); + + memcpy(out1,U,LDU*Min(M,N)*sizeof(doubleComplex)); + //memcpy(out3,VT,N*N*sizeof(doubleComplex)); + for(i=0;i<N;i++){ + for(j=i;j<N;j++){ + out3[i+j*N] = zconjs(VT[j+i*N]); + out3[j+i*N] = zconjs(VT[i+j*N]); + } + } + /* output from zgesvd is copied to out2 variables in required format*/ + for(j=0;j<M;j++){ + for(k=0;k<N;k++){ + if(j == k) + out2[j*(Min(M,N))+k] = DoubleComplex(S[j],0); + else + out2[j*(Min(M,N))+k] = DoubleComplex(0,0); + } + } + //ztransposea(VT,LDVT,Min(M,N),out3); + /*for(i=0;i<N;i++){ + for(j=0;j<N;j++){ + printf("[ %lf %lf]",zreals(VT[i*N+j]),zimags(VT[i*N+j])); + } + printf("\n"); + }*/ + //free(U); + //free(VT); + } + else{ /*svd(x,'e')*/ + LDA = M; + LDU = M; + if(M > N){ + JOBU = 'S'; + JOBVT = 'A'; + LDVT = N; + } + else{ + JOBU = 'A'; + JOBVT = 'S'; + LDVT = Min(M,N); + } + doubleComplex *U; + U = malloc(LDU*Min(M,N)*sizeof(doubleComplex)); + doubleComplex *VT; + VT = malloc(LDVT*N*sizeof(doubleComplex)); + zgesvd_(&JOBU,&JOBVT,&M,&N,buf,&LDA,S,U,&LDU,VT,&LDVT,WORK,&LWORK,RWORK,&INFO); + memcpy(out1,U,M*Min(M,N)*sizeof(doubleComplex)); + //ztransposea(VT,LDVT,Min(row,col),out3); + + /* These lines are added to patch an error of ZGESVD */ + /* + ij = i+(j-1)*N + ji = j+(i-1)*N + zstk(lV+ij-1) = conjg(zstk(lVT+ji-1)) + zstk(lV+ji-1) = conjg(zstk(lVT+ij-1)) + */ + for(i=0;i<Min(M,N);i++){ + for(j=0;j<N;j++){ + out3[j+i*N] = zconjs(VT[i+j*Min(M,N)]); + } + } + /* output from zgesvd is copied to out2 variables in required format*/ + for(j=0;j<Min(M,N);j++){ + for(k=0;k<Min(M,N);k++){ + if(j == k) + out2[j*(Min(M,N))+k] = DoubleComplex(S[j],0); + else + out2[j*(Min(M,N))+k] = DoubleComplex(0,0); + } + } + //free(U); + //free(VT); + } + } +} diff --git a/src/c/matrixOperations/cat/i16cata.c b/src/c/matrixOperations/cat/i16cata.c new file mode 100644 index 00000000..d7187b4a --- /dev/null +++ b/src/c/matrixOperations/cat/i16cata.c @@ -0,0 +1,63 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cat.h" +/* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(1,A1,A2); +output => y = [1 2 3; 4 5 6;7 8 9;10 11 12] +*/ + +void i16rowcata(int16 *in1,int lines1,int columns1,int16 *in2,int lines2,int columns2,int16* out) +{ + int i = 0; + int j = 0; + for(i = 0;i < columns1 && i < columns2; ++i) + { + for(j = 0;j < lines1; ++j) + { + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; + } + for(j = 0;j < lines2; ++j) + { + out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j]; + } + + } +} + + /* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(2,A1,A2); +output => y = [1 2 3 7 8 9; 4 5 6 10 11 12] +*/ + +void i16columncata(int16 *in1,int lines1,int columns1,int16 *in2,int lines2,int columns2,int16* out) + { + int i = 0; + for(i = 0; i < lines1 * columns1;++i) + { + out[i] = in1[i]; + + } + for(i = 0;i < lines2 * columns2;++i) + { + + out[i + lines1 * columns2] = in2[i]; + + } + + } + + + diff --git a/src/c/matrixOperations/cat/i16cats.c b/src/c/matrixOperations/cat/i16cats.c new file mode 100644 index 00000000..11b24ac6 --- /dev/null +++ b/src/c/matrixOperations/cat/i16cats.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cat.h" + +void i16rowcats(int16 in1,int16 in2,int16 *out) +{ + out[0] = in1; + out[1] = in2; + +} + +void i16columncats(int16 in1,int16 in2,int16 *out) +{ + out[0] = in1; + out[1] = in2; + +} diff --git a/src/c/matrixOperations/cat/i8cata.c b/src/c/matrixOperations/cat/i8cata.c new file mode 100644 index 00000000..47fbfa40 --- /dev/null +++ b/src/c/matrixOperations/cat/i8cata.c @@ -0,0 +1,60 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cat.h" +/* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(1,A1,A2); +output => y = [1 2 3; 4 5 6;7 8 9;10 11 12] +*/ + +void i8rowcata(int8 *in1,int lines1,int columns1,int8 *in2,int lines2,int columns2,int8* out) +{ + int i = 0; + int j = 0; + for(i = 0;i < columns1 && i < columns2; ++i) + { + for(j = 0;j < lines1; ++j) + { + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; + } + for(j = 0;j < lines2; ++j) + { + out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j]; + } + + } +} + /* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(2,A1,A2); +output => y = [1 2 3 7 8 9; 4 5 6 10 11 12] +*/ + +void i8columncata(int8 *in1,int lines1,int columns1,int8 *in2,int lines2,int columns2,int8* out) + { + int i = 0; + for(i = 0; i < lines1 * columns1;++i) + { + out[i] = in1[i]; + + } + for(i = 0;i < lines2 * columns2;++i) + { + + out[i + lines1 * columns2] = in2[i]; + + } + + } + diff --git a/src/c/matrixOperations/cat/i8cats.c b/src/c/matrixOperations/cat/i8cats.c new file mode 100644 index 00000000..51dadd16 --- /dev/null +++ b/src/c/matrixOperations/cat/i8cats.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cat.h" + +void i8rowcats(int8 in1,int8 in2,int8 *out) +{ + out[0] = in1; + out[1] = in2; + +} + +void i8columncats(int8 in1,uint8 in2,int8 *out) +{ + out[0] = in1; + out[1] = in2; + +} diff --git a/src/c/matrixOperations/cat/u16cata.c b/src/c/matrixOperations/cat/u16cata.c new file mode 100644 index 00000000..8c33acb9 --- /dev/null +++ b/src/c/matrixOperations/cat/u16cata.c @@ -0,0 +1,63 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cat.h" +/* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(1,A1,A2); +output => y = [1 2 3; 4 5 6;7 8 9;10 11 12] +*/ + +void u16rowcata(uint16 *in1,int lines1,int columns1,uint16 *in2,int lines2,int columns2,uint16* out) +{ + int i = 0; + int j = 0; + for(i = 0;i < columns1 && i < columns2; ++i) + { + for(j = 0;j < lines1; ++j) + { + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; + } + for(j = 0;j < lines2; ++j) + { + out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j]; + } + + } +} + + /* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(2,A1,A2); +output => y = [1 2 3 7 8 9; 4 5 6 10 11 12] +*/ + +void u16columncata(uint16 *in1,int lines1,int columns1,uint16 *in2,int lines2,int columns2,uint16* out) + { + int i = 0; + for(i = 0; i < lines1 * columns1;++i) + { + out[i] = in1[i]; + + } + for(i = 0;i < lines2 * columns2;++i) + { + + out[i + lines1 * columns2] = in2[i]; + + } + + } + + + diff --git a/src/c/matrixOperations/cat/u16cats.c b/src/c/matrixOperations/cat/u16cats.c new file mode 100644 index 00000000..942ed769 --- /dev/null +++ b/src/c/matrixOperations/cat/u16cats.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cat.h" + +void u16rowcats(uint16 in1,uint16 in2,uint16 *out) +{ + out[0] = in1; + out[1] = in2; + +} + +void u16columncats(uint16 in1,uint16 in2,uint16 *out) +{ + out[0] = in1; + out[1] = in2; + +} diff --git a/src/c/matrixOperations/cat/u8cata.c b/src/c/matrixOperations/cat/u8cata.c new file mode 100644 index 00000000..ab15f42f --- /dev/null +++ b/src/c/matrixOperations/cat/u8cata.c @@ -0,0 +1,60 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cat.h" +/* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(1,A1,A2); +output => y = [1 2 3; 4 5 6;7 8 9;10 11 12] +*/ + +void u8rowcata(uint8 *in1,int lines1,int columns1,uint8 *in2,int lines2,int columns2,uint8* out) +{ + int i = 0; + int j = 0; + for(i = 0;i < columns1 && i < columns2; ++i) + { + for(j = 0;j < lines1; ++j) + { + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; + } + for(j = 0;j < lines2; ++j) + { + out[i*(lines1 + lines2) + lines1 + j] = in2[i*lines2 + j]; + } + + } +} + /* From scilab help cat then the concatenation is done according to the rows +A1 = [1 2 3;4 5 6]; +A2 = [7 8 9;10 11 12]; +y = cat(2,A1,A2); +output => y = [1 2 3 7 8 9; 4 5 6 10 11 12] +*/ + +void u8columncata(uint8 *in1,int lines1,int columns1,uint8 *in2,int lines2,int columns2,uint8* out) + { + int i = 0; + for(i = 0; i < lines1 * columns1;++i) + { + out[i] = in1[i]; + + } + for(i = 0;i < lines2 * columns2;++i) + { + + out[i + lines1 * columns2] = in2[i]; + + } + + } + diff --git a/src/c/matrixOperations/cat/u8cats.c b/src/c/matrixOperations/cat/u8cats.c new file mode 100644 index 00000000..92341f3b --- /dev/null +++ b/src/c/matrixOperations/cat/u8cats.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cat.h" + +void u8rowcats(uint8 in1,uint8 in2,uint8 *out) +{ + out[0] = in1; + out[1] = in2; + +} + +void u8columncats(uint8 in1,uint8 in2,uint8 *out) +{ + out[0] = in1; + out[1] = in2; + +} diff --git a/src/c/matrixOperations/cross/ccrossa.c b/src/c/matrixOperations/cross/ccrossa.c new file mode 100644 index 00000000..5f74bb36 --- /dev/null +++ b/src/c/matrixOperations/cross/ccrossa.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> +#include "floatComplex.h" +#include "stdlib.h" +#include "string.h" +#include "cat.h" + +void ccrossa (floatComplex* inp1, int size1_r, int size1_c, floatComplex* inp2, int size2_r, int size2_c ,floatComplex* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cross/dcrossa.c b/src/c/matrixOperations/cross/dcrossa.c new file mode 100644 index 00000000..203ec24b --- /dev/null +++ b/src/c/matrixOperations/cross/dcrossa.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> + +void dcrossa (double* inp1, int size1_r, int size1_c, double* inp2, int size2_r, int size2_c ,double* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cross/i16crossa.c b/src/c/matrixOperations/cross/i16crossa.c new file mode 100644 index 00000000..91cdb7f0 --- /dev/null +++ b/src/c/matrixOperations/cross/i16crossa.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> +#include "int16.h" + +void i16crossa (int16* inp1, int size1_r, int size1_c, int16* inp2, int size2_r, int size2_c ,int16* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cross/i8crossa.c b/src/c/matrixOperations/cross/i8crossa.c new file mode 100644 index 00000000..adfbd534 --- /dev/null +++ b/src/c/matrixOperations/cross/i8crossa.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> +#include "int8.h" + +void i8crossa (int8* inp1, int size1_r, int size1_c, int8* inp2, int size2_r, int size2_c ,int8* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cross/scrossa.c b/src/c/matrixOperations/cross/scrossa.c new file mode 100644 index 00000000..414b85a4 --- /dev/null +++ b/src/c/matrixOperations/cross/scrossa.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> + +void scrossa (float* inp1, int size1_r, int size1_c, float* inp2, int size2_r, int size2_c ,float* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cross/u16crossa.c b/src/c/matrixOperations/cross/u16crossa.c new file mode 100644 index 00000000..e0a32bcc --- /dev/null +++ b/src/c/matrixOperations/cross/u16crossa.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> +#include "uint16.h" + +void u16crossa (uint16* inp1, int size1_r, int size1_c, uint16* inp2, int size2_r, int size2_c ,uint16* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cross/u8crossa.c b/src/c/matrixOperations/cross/u8crossa.c new file mode 100644 index 00000000..7a8b857f --- /dev/null +++ b/src/c/matrixOperations/cross/u8crossa.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> +#include "uint8.h" + +void u8crossa (uint8* inp1, int size1_r, int size1_c, uint8* inp2, int size2_r, int size2_c ,uint8* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cross/zcrossa.c b/src/c/matrixOperations/cross/zcrossa.c new file mode 100644 index 00000000..85a19607 --- /dev/null +++ b/src/c/matrixOperations/cross/zcrossa.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <cross.h> +#include "doubleComplex.h" +#include "stdlib.h" +#include "string.h" +#include "cat.h" + +void zcrossa (doubleComplex* inp1, int size1_r, int size1_c, doubleComplex* inp2, int size2_r, int size2_c ,doubleComplex* oup) +{ + int i,j; + + if (size1_c == 3 && size1_r == 1) // Calculating the cross product for a 1X3 Matrix + { + oup[0] = inp1[1]*inp2[2] - inp1[2]*inp2[1]; + oup[1] = inp1[2]*inp2[0] - inp1[0]*inp2[2]; + oup[2] = inp1[0]*inp2[1] - inp1[1]*inp2[0]; + printf("%lf ", oup[0]); + printf("%lf ", oup[1]); + printf("%lf \n", oup[2]); + } + else // Calculating the cross product for a 3XN Matrix + { + for(i = 0; i < size1_r; i++) + { + for(j = 0; j < size1_c; j = j+3) + { + oup[j+(i*size1_r)] = inp1[(j+1)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)] - inp1[(j+2)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)]; + oup[(j+1)+(i*size1_r)] = inp1[(j+2)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)] - inp1[(j+0)+(i*size1_r)] * inp2[(j+2)+(i*size1_r)]; + oup[(j+2)+(i*size1_r)] = inp1[(j+0)+(i*size1_r)] * inp2[(j+1)+(i*size1_r)] - inp1[(j+1)+(i*size1_r)] * inp2[(j+0)+(i*size1_r)]; + + } + } + + } +} + diff --git a/src/c/matrixOperations/cumprod/dcolumncumproda.c b/src/c/matrixOperations/cumprod/dcolumncumproda.c new file mode 100644 index 00000000..b64fac48 --- /dev/null +++ b/src/c/matrixOperations/cumprod/dcolumncumproda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void dcolumncumproda(double *in1, int row, int column, double *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/dcumproda.c b/src/c/matrixOperations/cumprod/dcumproda.c new file mode 100644 index 00000000..199880c6 --- /dev/null +++ b/src/c/matrixOperations/cumprod/dcumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void dcumproda(double *in1, int row, int column, double *out) +{ + int row_cnt, col_cnt = 0; + double cumprod = 1; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumprod *= in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumprod; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/drowcumproda.c b/src/c/matrixOperations/cumprod/drowcumproda.c new file mode 100644 index 00000000..21082d0c --- /dev/null +++ b/src/c/matrixOperations/cumprod/drowcumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void drowcumproda(double *in1, int row, int column, double *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/i16columncumproda.c b/src/c/matrixOperations/cumprod/i16columncumproda.c new file mode 100644 index 00000000..e5af54bb --- /dev/null +++ b/src/c/matrixOperations/cumprod/i16columncumproda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + /*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void i16columncumproda(int16 *in1, int row, int column, int16 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/i16cumproda.c b/src/c/matrixOperations/cumprod/i16cumproda.c new file mode 100644 index 00000000..8bee315d --- /dev/null +++ b/src/c/matrixOperations/cumprod/i16cumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void i16cumproda(int16 *in1, int row, int column, int16 *out) +{ + int row_cnt, col_cnt = 0; + int16 cumprod = 1; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumprod *= in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumprod; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/i16rowcumproda.c b/src/c/matrixOperations/cumprod/i16rowcumproda.c new file mode 100644 index 00000000..0c38b5eb --- /dev/null +++ b/src/c/matrixOperations/cumprod/i16rowcumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void i16rowcumproda(int16 *in1, int row, int column, int16 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/i8columncumproda.c b/src/c/matrixOperations/cumprod/i8columncumproda.c new file mode 100644 index 00000000..cf2156dd --- /dev/null +++ b/src/c/matrixOperations/cumprod/i8columncumproda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void i8columncumproda(int8 *in1, int row, int column, int8 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/i8cumproda.c b/src/c/matrixOperations/cumprod/i8cumproda.c new file mode 100644 index 00000000..f0a54043 --- /dev/null +++ b/src/c/matrixOperations/cumprod/i8cumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void i8cumproda(int8 *in1, int row, int column, int8 *out) +{ + int row_cnt, col_cnt = 0; + int8 cumprod = 1; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumprod *= in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumprod; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/i8rowcumproda.c b/src/c/matrixOperations/cumprod/i8rowcumproda.c new file mode 100644 index 00000000..c2ecf199 --- /dev/null +++ b/src/c/matrixOperations/cumprod/i8rowcumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void i8rowcumproda(int8 *in1, int row, int column, int8 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/scolumncumproda.c b/src/c/matrixOperations/cumprod/scolumncumproda.c new file mode 100644 index 00000000..e97ca903 --- /dev/null +++ b/src/c/matrixOperations/cumprod/scolumncumproda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void scolumncumproda(float *in1, int row, int column, float *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/scumproda.c b/src/c/matrixOperations/cumprod/scumproda.c new file mode 100644 index 00000000..fb55a31a --- /dev/null +++ b/src/c/matrixOperations/cumprod/scumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void scumproda(float *in1, int row, int column, float *out) +{ + int row_cnt, col_cnt = 0; + float cumprod = 1; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumprod += in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumprod; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/srowcumproda.c b/src/c/matrixOperations/cumprod/srowcumproda.c new file mode 100644 index 00000000..cab4e443 --- /dev/null +++ b/src/c/matrixOperations/cumprod/srowcumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void srowcumproda(float *in1, int row, int column, float *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/u16columncumproda.c b/src/c/matrixOperations/cumprod/u16columncumproda.c new file mode 100644 index 00000000..7b3c2d87 --- /dev/null +++ b/src/c/matrixOperations/cumprod/u16columncumproda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void u16columncumproda(uint16 *in1, int row, int column, uint16 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/u16cumproda.c b/src/c/matrixOperations/cumprod/u16cumproda.c new file mode 100644 index 00000000..5740e86f --- /dev/null +++ b/src/c/matrixOperations/cumprod/u16cumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void u16cumproda(uint16 *in1, int row, int column, uint16 *out) +{ + int row_cnt, col_cnt = 0; + uint16 cumprod = 1; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumprod *= in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumprod; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/u16rowcumproda.c b/src/c/matrixOperations/cumprod/u16rowcumproda.c new file mode 100644 index 00000000..23b452c4 --- /dev/null +++ b/src/c/matrixOperations/cumprod/u16rowcumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void u16rowcumproda(uint16 *in1, int row, int column, uint16 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/u8columncumproda.c b/src/c/matrixOperations/cumprod/u8columncumproda.c new file mode 100644 index 00000000..3a6ee92c --- /dev/null +++ b/src/c/matrixOperations/cumprod/u8columncumproda.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void u8columncumproda(uint8 *in1, int row, int column, uint8 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/u8cumproda.c b/src/c/matrixOperations/cumprod/u8cumproda.c new file mode 100644 index 00000000..8970f193 --- /dev/null +++ b/src/c/matrixOperations/cumprod/u8cumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void u8cumproda(uint8 *in1, int row, int column, uint8 *out) +{ + int row_cnt, col_cnt = 0; + uint8 cumprod = 1; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumprod *= in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumprod; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumprod/u8rowcumproda.c b/src/c/matrixOperations/cumprod/u8rowcumproda.c new file mode 100644 index 00000000..61b214c3 --- /dev/null +++ b/src/c/matrixOperations/cumprod/u8rowcumproda.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumprod.h" +#include "types.h" + +void u8rowcumproda(uint8 *in1, int row, int column, uint8 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + * out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/dcolumncumsuma.c b/src/c/matrixOperations/cumsum/dcolumncumsuma.c new file mode 100644 index 00000000..daf60134 --- /dev/null +++ b/src/c/matrixOperations/cumsum/dcolumncumsuma.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void dcolumncumsuma(double *in1, int row, int column, double *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/dcumsuma.c b/src/c/matrixOperations/cumsum/dcumsuma.c new file mode 100644 index 00000000..11b0a88f --- /dev/null +++ b/src/c/matrixOperations/cumsum/dcumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void dcumsuma(double *in1, int row, int column, double *out) +{ + int row_cnt, col_cnt = 0; + double cumsum = 0; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumsum += in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumsum; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/drowcumsuma.c b/src/c/matrixOperations/cumsum/drowcumsuma.c new file mode 100644 index 00000000..4bb3f320 --- /dev/null +++ b/src/c/matrixOperations/cumsum/drowcumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void drowcumsuma(double *in1, int row, int column, double *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/i16columncumsuma.c b/src/c/matrixOperations/cumsum/i16columncumsuma.c new file mode 100644 index 00000000..ae84428b --- /dev/null +++ b/src/c/matrixOperations/cumsum/i16columncumsuma.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void i16columncumsuma(int16 *in1, int row, int column, int16 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/i16cumsuma.c b/src/c/matrixOperations/cumsum/i16cumsuma.c new file mode 100644 index 00000000..4e2fb591 --- /dev/null +++ b/src/c/matrixOperations/cumsum/i16cumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void i16cumsuma(int16 *in1, int row, int column, int16 *out) +{ + int row_cnt, col_cnt = 0; + int16 cumsum = 0; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumsum += in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumsum; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/i16rowcumsuma.c b/src/c/matrixOperations/cumsum/i16rowcumsuma.c new file mode 100644 index 00000000..67cb9c7f --- /dev/null +++ b/src/c/matrixOperations/cumsum/i16rowcumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void i16rowcumsuma(int16 *in1, int row, int column, int16 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/i8columncumsuma.c b/src/c/matrixOperations/cumsum/i8columncumsuma.c new file mode 100644 index 00000000..67f72bcc --- /dev/null +++ b/src/c/matrixOperations/cumsum/i8columncumsuma.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void i8columncumsuma(int8 *in1, int row, int column, int8 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/i8cumsuma.c b/src/c/matrixOperations/cumsum/i8cumsuma.c new file mode 100644 index 00000000..8aa92871 --- /dev/null +++ b/src/c/matrixOperations/cumsum/i8cumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void i8cumsuma(int8 *in1, int row, int column, int8 *out) +{ + int row_cnt, col_cnt = 0; + int8 cumsum = 0; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumsum += in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumsum; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/i8rowcumsuma.c b/src/c/matrixOperations/cumsum/i8rowcumsuma.c new file mode 100644 index 00000000..a9e7da81 --- /dev/null +++ b/src/c/matrixOperations/cumsum/i8rowcumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void i8rowcumsuma(int8 *in1, int row, int column, int8 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/scolumncumsuma.c b/src/c/matrixOperations/cumsum/scolumncumsuma.c new file mode 100644 index 00000000..a7e8a851 --- /dev/null +++ b/src/c/matrixOperations/cumsum/scolumncumsuma.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void scolumncumsuma(float *in1, int row, int column, float *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/scumsuma.c b/src/c/matrixOperations/cumsum/scumsuma.c new file mode 100644 index 00000000..122e165d --- /dev/null +++ b/src/c/matrixOperations/cumsum/scumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void scumsuma(float *in1, int row, int column, float *out) +{ + int row_cnt, col_cnt = 0; + float cumsum = 0; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumsum += in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumsum; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/srowcumsuma.c b/src/c/matrixOperations/cumsum/srowcumsuma.c new file mode 100644 index 00000000..3af5d367 --- /dev/null +++ b/src/c/matrixOperations/cumsum/srowcumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void srowcumsuma(float *in1, int row, int column, float *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/u16columncumsuma.c b/src/c/matrixOperations/cumsum/u16columncumsuma.c new file mode 100644 index 00000000..aa16a582 --- /dev/null +++ b/src/c/matrixOperations/cumsum/u16columncumsuma.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void u16columncumsuma(uint16 *in1, int row, int column, uint16 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/u16cumsuma.c b/src/c/matrixOperations/cumsum/u16cumsuma.c new file mode 100644 index 00000000..d403571a --- /dev/null +++ b/src/c/matrixOperations/cumsum/u16cumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void u16cumsuma(uint16 *in1, int row, int column, uint16 *out) +{ + int row_cnt, col_cnt = 0; + uint16 cumsum = 0; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumsum += in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumsum; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/u16rowcumsuma.c b/src/c/matrixOperations/cumsum/u16rowcumsuma.c new file mode 100644 index 00000000..0ef0945c --- /dev/null +++ b/src/c/matrixOperations/cumsum/u16rowcumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void u16rowcumsuma(uint16 *in1, int row, int column, uint16 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/u8columncumsuma.c b/src/c/matrixOperations/cumsum/u8columncumsuma.c new file mode 100644 index 00000000..890a0bee --- /dev/null +++ b/src/c/matrixOperations/cumsum/u8columncumsuma.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void u8columncumsuma(uint8 *in1, int row, int column, uint8 *out) +{ + int row_cnt, col_cnt = 0; + + /*Assign elements in first column as it is*/ + for(row_cnt = 0; row_cnt < row; row_cnt++) + { + out[row_cnt] = in1[row_cnt]; + } + + /*For second column onwards*/ + for (row_cnt = 0; row_cnt < row; row_cnt++) + { + for ( col_cnt = 1; col_cnt < column; col_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[(col_cnt-1)*row+row_cnt]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/u8cumsuma.c b/src/c/matrixOperations/cumsum/u8cumsuma.c new file mode 100644 index 00000000..4f2acfe6 --- /dev/null +++ b/src/c/matrixOperations/cumsum/u8cumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void u8cumsuma(uint8 *in1, int row, int column, uint8 *out) +{ + int row_cnt, col_cnt = 0; + uint8 cumsum = 0; + for (col_cnt = 0; col_cnt < row; col_cnt++) + { + for ( row_cnt = 0; row_cnt < column; row_cnt++) + { + cumsum += in1[col_cnt*column+row_cnt]; + out[col_cnt*column+row_cnt] = cumsum; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/cumsum/u8rowcumsuma.c b/src/c/matrixOperations/cumsum/u8rowcumsuma.c new file mode 100644 index 00000000..1204d83e --- /dev/null +++ b/src/c/matrixOperations/cumsum/u8rowcumsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "cumsum.h" +#include "types.h" + +void u8rowcumsuma(uint8 *in1, int row, int column, uint8 *out) +{ + int row_cnt, col_cnt = 0; + + /*assign elements in first row as it is*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + out[col_cnt*row] = in1[col_cnt*row]; + } + /*For second row onwards*/ + for (col_cnt = 0; col_cnt < column; col_cnt++) + { + for ( row_cnt = 1; row_cnt < row; row_cnt++) + { + + out[col_cnt*row+row_cnt] = in1[col_cnt*row+row_cnt] \ + + out[col_cnt*row+row_cnt -1]; + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/determ/i16determa.c b/src/c/matrixOperations/determ/i16determa.c new file mode 100644 index 00000000..97ec948b --- /dev/null +++ b/src/c/matrixOperations/determ/i16determa.c @@ -0,0 +1,92 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +int16 i16determa(int16 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + int16 out=0; + int16 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(int16*)malloc((unsigned int)(size*size)*sizeof(int16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + int16 out=0, pivot=0; + int16 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(int16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/src/c/matrixOperations/determ/i8determa.c b/src/c/matrixOperations/determ/i8determa.c new file mode 100644 index 00000000..cf436a00 --- /dev/null +++ b/src/c/matrixOperations/determ/i8determa.c @@ -0,0 +1,92 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +int8 i8determa(int8 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + int8 out=0; + int8 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(int8*)malloc((unsigned int)(size*size)*sizeof(int8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + int8 out=0, pivot=0; + int8 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(int8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/src/c/matrixOperations/determ/u16determa.c b/src/c/matrixOperations/determ/u16determa.c new file mode 100644 index 00000000..5e859d44 --- /dev/null +++ b/src/c/matrixOperations/determ/u16determa.c @@ -0,0 +1,92 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +uint16 u16determa(uint16 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + uint16 out=0; + uint16 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(uint16*)malloc((unsigned int)(size*size)*sizeof(uint16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + uint16 out=0, pivot=0; + uint16 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(uint16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/src/c/matrixOperations/determ/u8determa.c b/src/c/matrixOperations/determ/u8determa.c new file mode 100644 index 00000000..f226af20 --- /dev/null +++ b/src/c/matrixOperations/determ/u8determa.c @@ -0,0 +1,92 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +uint8 u8determa(uint8 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + uint8 out=0; + uint8 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(uint8*)malloc((unsigned int)(size*size)*sizeof(uint8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + uint8 out=0, pivot=0; + uint8 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(uint8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/src/c/matrixOperations/diag/ddiaga.c b/src/c/matrixOperations/diag/ddiaga.c new file mode 100644 index 00000000..983e8ff9 --- /dev/null +++ b/src/c/matrixOperations/diag/ddiaga.c @@ -0,0 +1,40 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void ddiaga(double in, int size,int insert_post,double *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/src/c/matrixOperations/diag/ddiagexa.c b/src/c/matrixOperations/diag/ddiagexa.c new file mode 100644 index 00000000..0e6c314c --- /dev/null +++ b/src/c/matrixOperations/diag/ddiagexa.c @@ -0,0 +1,130 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void ddiagexa(double *in, int _row,int _column,int extract_post,double *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/src/c/matrixOperations/diag/ddiagexs.c b/src/c/matrixOperations/diag/ddiagexs.c new file mode 100644 index 00000000..4e9ca5e4 --- /dev/null +++ b/src/c/matrixOperations/diag/ddiagexs.c @@ -0,0 +1,53 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +double ddiagexs(double *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/src/c/matrixOperations/diag/ddiagina.c b/src/c/matrixOperations/diag/ddiagina.c new file mode 100644 index 00000000..243aba10 --- /dev/null +++ b/src/c/matrixOperations/diag/ddiagina.c @@ -0,0 +1,59 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void ddiagina(double *in, int _row,int _column,int insert_post,double *out) +{ + + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/src/c/matrixOperations/diag/ddiagins.c b/src/c/matrixOperations/diag/ddiagins.c new file mode 100644 index 00000000..09cc921e --- /dev/null +++ b/src/c/matrixOperations/diag/ddiagins.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void ddiagins(double *in, int size,double *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/src/c/matrixOperations/diag/ddiags.c b/src/c/matrixOperations/diag/ddiags.c new file mode 100644 index 00000000..bab21867 --- /dev/null +++ b/src/c/matrixOperations/diag/ddiags.c @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +double ddiags(double in) +{ + + return in; + +} + diff --git a/src/c/matrixOperations/diag/i16diaga.c b/src/c/matrixOperations/diag/i16diaga.c new file mode 100644 index 00000000..6078ada7 --- /dev/null +++ b/src/c/matrixOperations/diag/i16diaga.c @@ -0,0 +1,40 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void i16diaga(int16 in, int size,int insert_post,int16 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/src/c/matrixOperations/diag/i16diagexa.c b/src/c/matrixOperations/diag/i16diagexa.c new file mode 100644 index 00000000..b51e0ae1 --- /dev/null +++ b/src/c/matrixOperations/diag/i16diagexa.c @@ -0,0 +1,130 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void i16diagexa(int16 *in, int _row,int _column,int extract_post,int16 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/src/c/matrixOperations/diag/i16diagexs.c b/src/c/matrixOperations/diag/i16diagexs.c new file mode 100644 index 00000000..1071c504 --- /dev/null +++ b/src/c/matrixOperations/diag/i16diagexs.c @@ -0,0 +1,53 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +int16 i16diagexs(int16 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/src/c/matrixOperations/diag/i16diagina.c b/src/c/matrixOperations/diag/i16diagina.c new file mode 100644 index 00000000..a785003e --- /dev/null +++ b/src/c/matrixOperations/diag/i16diagina.c @@ -0,0 +1,58 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void i16diagina(int16 *in, int _row,int _column,int insert_post,int16 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/src/c/matrixOperations/diag/i16diagins.c b/src/c/matrixOperations/diag/i16diagins.c new file mode 100644 index 00000000..f7f8612d --- /dev/null +++ b/src/c/matrixOperations/diag/i16diagins.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void i16diagins(int16 *in, int size,int16 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/src/c/matrixOperations/diag/i16diags.c b/src/c/matrixOperations/diag/i16diags.c new file mode 100644 index 00000000..d6d89f5b --- /dev/null +++ b/src/c/matrixOperations/diag/i16diags.c @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +int16 i16diags(int16 in) +{ + + return in; + +} + diff --git a/src/c/matrixOperations/diag/i8diaga.c b/src/c/matrixOperations/diag/i8diaga.c new file mode 100644 index 00000000..d4322278 --- /dev/null +++ b/src/c/matrixOperations/diag/i8diaga.c @@ -0,0 +1,40 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void i8diaga(int8 in, int size,int insert_post,int8 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/src/c/matrixOperations/diag/i8diagexa.c b/src/c/matrixOperations/diag/i8diagexa.c new file mode 100644 index 00000000..8d5513b6 --- /dev/null +++ b/src/c/matrixOperations/diag/i8diagexa.c @@ -0,0 +1,130 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void i8diagexa(int8 *in, int _row,int _column,int extract_post,int8 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/src/c/matrixOperations/diag/i8diagexs.c b/src/c/matrixOperations/diag/i8diagexs.c new file mode 100644 index 00000000..5d936618 --- /dev/null +++ b/src/c/matrixOperations/diag/i8diagexs.c @@ -0,0 +1,53 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +int8 i8diagexs(int8 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/src/c/matrixOperations/diag/i8diagina.c b/src/c/matrixOperations/diag/i8diagina.c new file mode 100644 index 00000000..b1bd1bac --- /dev/null +++ b/src/c/matrixOperations/diag/i8diagina.c @@ -0,0 +1,58 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void i8diagina(int8 *in, int _row,int _column,int insert_post,int8 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/src/c/matrixOperations/diag/i8diagins.c b/src/c/matrixOperations/diag/i8diagins.c new file mode 100644 index 00000000..dc6df972 --- /dev/null +++ b/src/c/matrixOperations/diag/i8diagins.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void i8diagins(int8 *in, int size,int8 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/src/c/matrixOperations/diag/i8diags.c b/src/c/matrixOperations/diag/i8diags.c new file mode 100644 index 00000000..55eea1b1 --- /dev/null +++ b/src/c/matrixOperations/diag/i8diags.c @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +int8 i8diags(int8 in) +{ + + return in; + +} + diff --git a/src/c/matrixOperations/diag/u16diaga.c b/src/c/matrixOperations/diag/u16diaga.c new file mode 100644 index 00000000..ee27e53c --- /dev/null +++ b/src/c/matrixOperations/diag/u16diaga.c @@ -0,0 +1,40 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void u16diaga(uint16 in, int size,int insert_post,uint16 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/src/c/matrixOperations/diag/u16diagexa.c b/src/c/matrixOperations/diag/u16diagexa.c new file mode 100644 index 00000000..ac996b7b --- /dev/null +++ b/src/c/matrixOperations/diag/u16diagexa.c @@ -0,0 +1,130 @@ +/* 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: Mushir + rganization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void u16diagexa(uint16 *in, int _row,int _column,int extract_post,uint16 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/src/c/matrixOperations/diag/u16diagexs.c b/src/c/matrixOperations/diag/u16diagexs.c new file mode 100644 index 00000000..dd04c5d2 --- /dev/null +++ b/src/c/matrixOperations/diag/u16diagexs.c @@ -0,0 +1,53 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +uint16 u16diagexs(uint16 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/src/c/matrixOperations/diag/u16diagina.c b/src/c/matrixOperations/diag/u16diagina.c new file mode 100644 index 00000000..97f5139c --- /dev/null +++ b/src/c/matrixOperations/diag/u16diagina.c @@ -0,0 +1,58 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void u16diagina(uint16 *in, int _row,int _column,int insert_post,uint16 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/src/c/matrixOperations/diag/u16diagins.c b/src/c/matrixOperations/diag/u16diagins.c new file mode 100644 index 00000000..65590bd1 --- /dev/null +++ b/src/c/matrixOperations/diag/u16diagins.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void u16diagins(uint16 *in, int size,uint16 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/src/c/matrixOperations/diag/u16diags.c b/src/c/matrixOperations/diag/u16diags.c new file mode 100644 index 00000000..1e9b4519 --- /dev/null +++ b/src/c/matrixOperations/diag/u16diags.c @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +uint16 u16diags(uint16 in) +{ + + return in; + +} + diff --git a/src/c/matrixOperations/diag/u8diaga.c b/src/c/matrixOperations/diag/u8diaga.c new file mode 100644 index 00000000..e6641aff --- /dev/null +++ b/src/c/matrixOperations/diag/u8diaga.c @@ -0,0 +1,40 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void u8diaga(uint8 in, int size,int insert_post,uint8 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/src/c/matrixOperations/diag/u8diagexa.c b/src/c/matrixOperations/diag/u8diagexa.c new file mode 100644 index 00000000..17b873b2 --- /dev/null +++ b/src/c/matrixOperations/diag/u8diagexa.c @@ -0,0 +1,130 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void u8diagexa(uint8 *in, int _row,int _column,int extract_post,uint8 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/src/c/matrixOperations/diag/u8diagexs.c b/src/c/matrixOperations/diag/u8diagexs.c new file mode 100644 index 00000000..fb800fda --- /dev/null +++ b/src/c/matrixOperations/diag/u8diagexs.c @@ -0,0 +1,53 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +uint8 u8diagexs(uint8 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/src/c/matrixOperations/diag/u8diagina.c b/src/c/matrixOperations/diag/u8diagina.c new file mode 100644 index 00000000..178d0f65 --- /dev/null +++ b/src/c/matrixOperations/diag/u8diagina.c @@ -0,0 +1,58 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" + +void u8diagina(uint8 *in, int _row,int _column,int insert_post,uint8 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/src/c/matrixOperations/diag/u8diagins.c b/src/c/matrixOperations/diag/u8diagins.c new file mode 100644 index 00000000..787cd644 --- /dev/null +++ b/src/c/matrixOperations/diag/u8diagins.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +void u8diagins(uint8 *in, int size,uint8 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/src/c/matrixOperations/diag/u8diags.c b/src/c/matrixOperations/diag/u8diags.c new file mode 100644 index 00000000..d3d2e468 --- /dev/null +++ b/src/c/matrixOperations/diag/u8diags.c @@ -0,0 +1,20 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "diag.h" +uint8 u8diags(uint8 in) +{ + + return in; + +} + diff --git a/src/c/matrixOperations/division/i16ldivma.c b/src/c/matrixOperations/division/i16ldivma.c new file mode 100644 index 00000000..decb8f39 --- /dev/null +++ b/src/c/matrixOperations/division/i16ldivma.c @@ -0,0 +1,111 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i16ldivma (int16* in1, int lines1, int columns1 , + int16* in2, int lines2, int columns2 , + int16* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int16 dblRcond = 0; + + int16 dblEps = 0; + int16 dblAnorm = 0; + + int16 *pAf = NULL; + int16 *pXb = NULL; + int16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (int16*)malloc(sizeof(int16) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (int16*)malloc(sizeof(int16) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (int16*)malloc(sizeof(int16) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/src/c/matrixOperations/division/i16rdivma.c b/src/c/matrixOperations/division/i16rdivma.c new file mode 100644 index 00000000..7cdebe55 --- /dev/null +++ b/src/c/matrixOperations/division/i16rdivma.c @@ -0,0 +1,129 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i16rdivma ( int16 * in1, int lines1, int columns1, + int16 * in2, int lines2, int columns2, + int16 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int16 dblRcond = 0; + + int16 dblEps = 0; + int16 dblAnorm = 0; + + int16 *pAf = NULL; + int16 *pAt = NULL; + int16 *pBt = NULL; + int16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (int16*)malloc(sizeof(int16) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (int16*)malloc(sizeof(int16) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (int16*)malloc(sizeof(int16) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (int16*)malloc(sizeof(int16) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/src/c/matrixOperations/division/i16rdivv.c b/src/c/matrixOperations/division/i16rdivv.c new file mode 100644 index 00000000..ebbdf580 --- /dev/null +++ b/src/c/matrixOperations/division/i16rdivv.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "matrixDivision.h" + +int16 i16rdivv(int16 *in1, int16 *in2, int size){ + + int16 out[1] = { 0.0} ; + i16rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/src/c/matrixOperations/division/i8ldivma.c b/src/c/matrixOperations/division/i8ldivma.c new file mode 100644 index 00000000..d7ca2fd0 --- /dev/null +++ b/src/c/matrixOperations/division/i8ldivma.c @@ -0,0 +1,111 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i8ldivma (int8* in1, int lines1, int columns1 , + int8* in2, int lines2, int columns2 , + int8* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int8 dblRcond = 0; + + int8 dblEps = 0; + int8 dblAnorm = 0; + + int8 *pAf = NULL; + int8 *pXb = NULL; + int8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (int8*)malloc(sizeof(int8) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (int8*)malloc(sizeof(int8) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (int8*)malloc(sizeof(int8) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/src/c/matrixOperations/division/i8rdivma.c b/src/c/matrixOperations/division/i8rdivma.c new file mode 100644 index 00000000..0048c036 --- /dev/null +++ b/src/c/matrixOperations/division/i8rdivma.c @@ -0,0 +1,129 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i8rdivma ( int8 * in1, int lines1, int columns1, + int8 * in2, int lines2, int columns2, + int8 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int8 dblRcond = 0; + + int8 dblEps = 0; + int8 dblAnorm = 0; + + int8 *pAf = NULL; + int8 *pAt = NULL; + int8 *pBt = NULL; + int8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (int8*)malloc(sizeof(int8) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (int8*)malloc(sizeof(int8) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (int8*)malloc(sizeof(int8) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (int8*)malloc(sizeof(int8) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/src/c/matrixOperations/division/i8rdivv.c b/src/c/matrixOperations/division/i8rdivv.c new file mode 100644 index 00000000..7d262afa --- /dev/null +++ b/src/c/matrixOperations/division/i8rdivv.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "matrixDivision.h" + +int8 i8rdivv(int8 *in1, int8 *in2, int size){ + + int8 out[1] = { 0.0} ; + i8rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/src/c/matrixOperations/division/u16ldivma.c b/src/c/matrixOperations/division/u16ldivma.c new file mode 100644 index 00000000..d7901f38 --- /dev/null +++ b/src/c/matrixOperations/division/u16ldivma.c @@ -0,0 +1,111 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u16ldivma (uint16* in1, int lines1, int columns1 , + uint16* in2, int lines2, int columns2 , + uint16* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint16 dblRcond = 0; + + uint16 dblEps = 0; + uint16 dblAnorm = 0; + + uint16 *pAf = NULL; + uint16 *pXb = NULL; + uint16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (uint16*)malloc(sizeof(uint16) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (uint16*)malloc(sizeof(uint16) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (uint16*)malloc(sizeof(uint16) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/src/c/matrixOperations/division/u16rdivma.c b/src/c/matrixOperations/division/u16rdivma.c new file mode 100644 index 00000000..d6642074 --- /dev/null +++ b/src/c/matrixOperations/division/u16rdivma.c @@ -0,0 +1,129 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u16rdivma ( uint16 * in1, int lines1, int columns1, + uint16 * in2, int lines2, int columns2, + uint16 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint16 dblRcond = 0; + + uint16 dblEps = 0; + uint16 dblAnorm = 0; + + uint16 *pAf = NULL; + uint16 *pAt = NULL; + uint16 *pBt = NULL; + uint16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (uint16*)malloc(sizeof(uint16) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (uint16*)malloc(sizeof(uint16) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (uint16*)malloc(sizeof(uint16) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (uint16*)malloc(sizeof(uint16) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/src/c/matrixOperations/division/u16rdivv.c b/src/c/matrixOperations/division/u16rdivv.c new file mode 100644 index 00000000..66dc2144 --- /dev/null +++ b/src/c/matrixOperations/division/u16rdivv.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "matrixDivision.h" + +uint16 u16rdivv(uint16 *in1, uint16 *in2, int size){ + + uint16 out[1] = { 0.0} ; + u16rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/src/c/matrixOperations/division/u8ldivma.c b/src/c/matrixOperations/division/u8ldivma.c new file mode 100644 index 00000000..ce491b4f --- /dev/null +++ b/src/c/matrixOperations/division/u8ldivma.c @@ -0,0 +1,111 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u8ldivma (uint8* in1, int lines1, int columns1 , + uint8* in2, int lines2, int columns2 , + uint8* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint8 dblRcond = 0; + + uint8 dblEps = 0; + uint8 dblAnorm = 0; + + uint8 *pAf = NULL; + uint8 *pXb = NULL; + uint8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (uint8*)malloc(sizeof(uint8) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (uint8*)malloc(sizeof(uint8) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (uint8*)malloc(sizeof(uint8) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/src/c/matrixOperations/division/u8rdivma.c b/src/c/matrixOperations/division/u8rdivma.c new file mode 100644 index 00000000..6ff4b17a --- /dev/null +++ b/src/c/matrixOperations/division/u8rdivma.c @@ -0,0 +1,129 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u8rdivma ( uint8 * in1, int lines1, int columns1, + uint8 * in2, int lines2, int columns2, + uint8 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint8 dblRcond = 0; + + uint8 dblEps = 0; + uint8 dblAnorm = 0; + + uint8 *pAf = NULL; + uint8 *pAt = NULL; + uint8 *pBt = NULL; + uint8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (uint8*)malloc(sizeof(uint8) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (uint8*)malloc(sizeof(uint8) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (uint8*)malloc(sizeof(uint8) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (uint8*)malloc(sizeof(uint8) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/src/c/matrixOperations/division/u8rdivv.c b/src/c/matrixOperations/division/u8rdivv.c new file mode 100644 index 00000000..92e5762e --- /dev/null +++ b/src/c/matrixOperations/division/u8rdivv.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "matrixDivision.h" + +uint8 u8rdivv(uint8 *in1, uint8 *in2, int size){ + + uint8 out[1] = { 0.0} ; + u8rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/src/c/matrixOperations/eye/i16eyea.c b/src/c/matrixOperations/eye/i16eyea.c new file mode 100644 index 00000000..a769061c --- /dev/null +++ b/src/c/matrixOperations/eye/i16eyea.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "eye.h" + +void i16eyea(int16* in, int _iRows, int _iCols) +{ + int i, j ; + + for ( i = 0 ; i < _iCols ; i++ ) + for ( j = 0 ; j < _iRows ; j++ ) + in[i*_iRows + j] = (i == j)?(int16)1:(int16)0 ; +} + diff --git a/src/c/matrixOperations/eye/i8eyea.c b/src/c/matrixOperations/eye/i8eyea.c new file mode 100644 index 00000000..d69ac052 --- /dev/null +++ b/src/c/matrixOperations/eye/i8eyea.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "eye.h" + +void i8eyea(int8* in, int _iRows, int _iCols) +{ + int i, j ; + + for ( i = 0 ; i < _iCols ; i++ ) + for ( j = 0 ; j < _iRows ; j++ ) + in[i*_iRows + j] = (i == j)?(int8)1:(int8)0 ; +} + diff --git a/src/c/matrixOperations/eye/u16eyea.c b/src/c/matrixOperations/eye/u16eyea.c new file mode 100644 index 00000000..bb011986 --- /dev/null +++ b/src/c/matrixOperations/eye/u16eyea.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "eye.h" + +void u16eyea(uint16* in, int _iRows, int _iCols) +{ + int i, j ; + + for ( i = 0 ; i < _iCols ; i++ ) + for ( j = 0 ; j < _iRows ; j++ ) + in[i*_iRows + j] = (i == j)?(uint16)1:(uint16)0 ; +} + diff --git a/src/c/matrixOperations/eye/u8eyea.c b/src/c/matrixOperations/eye/u8eyea.c new file mode 100644 index 00000000..018fc3c9 --- /dev/null +++ b/src/c/matrixOperations/eye/u8eyea.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "eye.h" + +void u8eyea(uint8* in, int _iRows, int _iCols) +{ + int i, j ; + + for ( i = 0 ; i < _iCols ; i++ ) + for ( j = 0 ; j < _iRows ; j++ ) + in[i*_iRows + j] = (i == j)?(uint8)1:(uint8)0 ; +} + diff --git a/src/c/matrixOperations/flipdim/dflipdima.c b/src/c/matrixOperations/flipdim/dflipdima.c new file mode 100644 index 00000000..b510c445 --- /dev/null +++ b/src/c/matrixOperations/flipdim/dflipdima.c @@ -0,0 +1,81 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function flips the input matrix along given dimension*/ + +#include "flipdim.h" + +void dflipdima (double *in, int row, int col, int dim, int blk_size, double *out) +{ + int col_count = 0, row_count = 0, blk_count = 0, count = 0; + if(dim == 1) /*flip rows*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)]; + } + } + } + else /*block size is more than 1*/ + { + for(col_count = 0; col_count < col; col_count++) + { + count = blk_size; + blk_count = 0; + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)]; + if(--count == 0) + { + blk_count += 1; + count = blk_size; + } + } + } + + } + } + else if(dim == 2) /*flip columns*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count]; + } + } + } + else + { + count = blk_size; + blk_count = 0; + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count]; + } + if(--count == 0) + { + count = blk_size; + blk_count += 1; + } + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/flipdim/i16flipdima.c b/src/c/matrixOperations/flipdim/i16flipdima.c new file mode 100644 index 00000000..eb51221f --- /dev/null +++ b/src/c/matrixOperations/flipdim/i16flipdima.c @@ -0,0 +1,81 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function flips the input matrix along given dimension*/ + +#include "flipdim.h" + +void i16flipdima (int16 *in, int row, int col, int dim, int blk_size, int16 *out) +{ + int col_count = 0, row_count = 0, blk_count = 0, count = 0; + if(dim == 1) /*flip rows*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)]; + } + } + } + else /*block size is more than 1*/ + { + for(col_count = 0; col_count < col; col_count++) + { + count = blk_size; + blk_count = 0; + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)]; + if(--count == 0) + { + blk_count += 1; + count = blk_size; + } + } + } + + } + } + else if(dim == 2) /*flip columns*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count]; + } + } + } + else + { + count = blk_size; + blk_count = 0; + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count]; + } + if(--count == 0) + { + count = blk_size; + blk_count += 1; + } + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/flipdim/i8flipdima.c b/src/c/matrixOperations/flipdim/i8flipdima.c new file mode 100644 index 00000000..1c23a5ea --- /dev/null +++ b/src/c/matrixOperations/flipdim/i8flipdima.c @@ -0,0 +1,81 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function flips the input matrix along given dimension*/ + +#include "flipdim.h" + +void i8flipdima (int8 *in, int row, int col, int dim, int blk_size, int8 *out) +{ + int col_count = 0, row_count = 0, blk_count = 0, count = 0; + if(dim == 1) /*flip rows*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)]; + } + } + } + else /*block size is more than 1*/ + { + for(col_count = 0; col_count < col; col_count++) + { + count = blk_size; + blk_count = 0; + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)]; + if(--count == 0) + { + blk_count += 1; + count = blk_size; + } + } + } + + } + } + else if(dim == 2) /*flip columns*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count]; + } + } + } + else + { + count = blk_size; + blk_count = 0; + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count]; + } + if(--count == 0) + { + count = blk_size; + blk_count += 1; + } + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/flipdim/sflipdima.c b/src/c/matrixOperations/flipdim/sflipdima.c new file mode 100644 index 00000000..85746996 --- /dev/null +++ b/src/c/matrixOperations/flipdim/sflipdima.c @@ -0,0 +1,81 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function flips the input matrix along given dimension*/ + +#include "flipdim.h" + +void sflipdima (float *in, int row, int col, int dim, int blk_size, float *out) +{ + int col_count = 0, row_count = 0, blk_count = 0, count = 0; + if(dim == 1) /*flip rows*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)]; + } + } + } + else /*block size is more than 1*/ + { + for(col_count = 0; col_count < col; col_count++) + { + count = blk_size; + blk_count = 0; + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)]; + if(--count == 0) + { + blk_count += 1; + count = blk_size; + } + } + } + + } + } + else if(dim == 2) /*flip columns*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count]; + } + } + } + else + { + count = blk_size; + blk_count = 0; + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count]; + } + if(--count == 0) + { + count = blk_size; + blk_count += 1; + } + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/flipdim/u16flipdima.c b/src/c/matrixOperations/flipdim/u16flipdima.c new file mode 100644 index 00000000..3689b944 --- /dev/null +++ b/src/c/matrixOperations/flipdim/u16flipdima.c @@ -0,0 +1,81 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function flips the input matrix along given dimension*/ + +#include "flipdim.h" + +void u16flipdima (uint16 *in, int row, int col, int dim, int blk_size, uint16 *out) +{ + int col_count = 0, row_count = 0, blk_count = 0, count = 0; + if(dim == 1) /*flip rows*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)]; + } + } + } + else /*block size is more than 1*/ + { + for(col_count = 0; col_count < col; col_count++) + { + count = blk_size; + blk_count = 0; + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)]; + if(--count == 0) + { + blk_count += 1; + count = blk_size; + } + } + } + + } + } + else if(dim == 2) /*flip columns*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count]; + } + } + } + else + { + count = blk_size; + blk_count = 0; + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count]; + } + if(--count == 0) + { + count = blk_size; + blk_count += 1; + } + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/flipdim/u8flipdima.c b/src/c/matrixOperations/flipdim/u8flipdima.c new file mode 100644 index 00000000..bae8c12f --- /dev/null +++ b/src/c/matrixOperations/flipdim/u8flipdima.c @@ -0,0 +1,80 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +/*Function flips the input matrix along given dimension*/ + +#include "flipdim.h" + +void u8flipdima (uint8 *in, int row, int col, int dim, int blk_size, uint8 *out) +{ + int col_count = 0, row_count = 0, blk_count = 0, count = 0; + if(dim == 1) /*flip rows*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - row_count - 1)]; + } + } + } + else /*block size is more than 1*/ + { + for(col_count = 0; col_count < col; col_count++) + { + count = blk_size; + blk_count = 0; + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[col_count*row+(row - blk_count*blk_size - count)]; + if(--count == 0) + { + blk_count += 1; + count = blk_size; + } + } + } + + } + } + else if(dim == 2) /*flip columns*/ + { + if(blk_size == 1) + { + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col- col_count - 1)*row+row_count]; + } + } + } + else + { + count = blk_size; + blk_count = 0; + for(col_count = 0; col_count < col; col_count++) + { + for(row_count = 0; row_count< row;row_count++) + { + out[col_count*row+row_count] = in[(col - blk_count*blk_size - count)*row+row_count]; + } + if(--count == 0) + { + count = blk_size; + blk_count += 1; + } + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/includes/cat.h b/src/c/matrixOperations/includes/cat.h index 9f64a157..dde6b9bd 100644 --- a/src/c/matrixOperations/includes/cat.h +++ b/src/c/matrixOperations/includes/cat.h @@ -12,7 +12,7 @@ #ifndef __CAT_H__ #define __CAT_H__ - +#include "types.h" #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" @@ -98,6 +98,63 @@ EXTERN_MATOPS void ccolumncata(floatComplex *in1, int lines1, int columns1, flo EXTERN_MATOPS void zrowcata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex* out); EXTERN_MATOPS void zcolumncata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex* out); +/* +** \brief Concat uint8 arrays +** \param in1 the uint8 array to process +** \param lines1 +** \param columns1 +** \param in2 the uint8 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void u8rowcata(uint8 *in1, int lines1, int columns1, uint8 *in2, int lines2, int columns2, uint8* out); +EXTERN_MATOPS void u8columncata(uint8 *in1, int lines1, int columns1, uint8 *in2, int lines2, int columns2, uint8* out); + +/* +** \brief Concat uint16 arrays +** \param in1 the uint16 array to process +** \param lines1 +** \param columns1 +** \param in2 the uint16 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void u16rowcata(uint16 *in1, int lines1, int columns1, uint16 *in2, int lines2, int columns2, uint16* out); +EXTERN_MATOPS void u16columncata(uint16 *in1, int lines1, int columns1, uint16 *in2, int lines2, int columns2, uint16* out); + + +/* +** \brief Concat int8 arrays +** \param in1 the int8 array to process +** \param lines1 +** \param columns1 +** \param in2 the int8 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void i8rowcata(int8 *in1, int lines1, int columns1, int8 *in2, int lines2, int columns2, int8* out); +EXTERN_MATOPS void i8columncata(int8 *in1, int lines1, int columns1, int8 *in2, int lines2, int columns2, int8* out); + +/* +** \brief Concat int16 arrays +** \param in1 the int16 array to process +** \param lines1 +** \param columns1 +** \param in2 the int16 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void i16rowcata(int16 *in1, int lines1, int columns1, int16 *in2, int lines2, int columns2, int16* out); +EXTERN_MATOPS void i16columncata(int16 *in1, int lines1, int columns1, int16 *in2, int lines2, int columns2, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/cross.h b/src/c/matrixOperations/includes/cross.h new file mode 100644 index 00000000..0abd0019 --- /dev/null +++ b/src/c/matrixOperations/includes/cross.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 __CROSS_H__ +#define __CROSS_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcrossa (double* inp1, int size1_r, int size1_c, double* inp2, int size2_r, int size2_c ,double* oup); +void zcrossa (doubleComplex* inp1, int size1_r, int size1_c, doubleComplex* inp2, int size2_r, int size2_c ,doubleComplex* oup); +void ccrossa (floatComplex* inp1, int size1_r, int size1_c, floatComplex* inp2, int size2_r, int size2_c ,floatComplex* oup); +void scrossa (float* inp1, int size1_r, int size1_c, float* inp2, int size2_r, int size2_c ,float* oup); +void u8crossa (uint8* inp1, int size1_r, int size1_c, uint8* inp2, int size2_r, int size2_c ,uint8* oup); +void u16crossa (uint16* inp1, int size1_r, int size1_c, uint16* inp2, int size2_r, int size2_c ,uint16* oup); +void i8crossa (int8* inp1, int size1_r, int size1_c, int8* inp2, int size2_r, int size2_c ,int8* oup); +void i16crossa (int16* inp1, int size1_r, int size1_c, int16* inp2, int size2_r, int size2_c ,int16* oup); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CROSS_H__*/ diff --git a/src/c/matrixOperations/includes/cumprod.h b/src/c/matrixOperations/includes/cumprod.h new file mode 100644 index 00000000..f47fd77a --- /dev/null +++ b/src/c/matrixOperations/includes/cumprod.h @@ -0,0 +1,53 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CUMPROD_H__ +#define __CUMPROD_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcumproda(double *in1, int row, int column, double *out); +void drowcumproda(double *in1, int row, int column, double *out); +void dcolumncumproda(double *in1, int row, int column, double *out); + +void scumproda(float *in1, int row, int column, float *out); +void srowcumproda(float *in1, int row, int column, float *out); +void scolumncumproda(float *in1, int row, int column, float *out); + +void u8cumproda(uint8 *in1, int row, int column, uint8 *out); +void u8rowcumproda(uint8 *in1, int row, int column, uint8 *out); +void u8columncumproda(uint8 *in1, int row, int column, uint8 *out); + +void i8cumproda(int8 *in1, int row, int column, int8 *out); +void i8rowcumproda(int8 *in1, int row, int column, int8 *out); +void i8columncumproda(int8 *in1, int row, int column, int8 *out); + +void u16cumproda(uint16 *in1, int row, int column, uint16 *out); +void u16rowcumproda(uint16 *in1, int row, int column, uint16 *out); +void u16columncumproda(uint16 *in1, int row, int column, uint16 *out); + +void i16cumproda(int16 *in1, int row, int column, int16 *out); +void i16rowcumproda(int16 *in1, int row, int column, int16 *out); +void i16columncumproda(int16 *in1, int row, int column, int16 *out); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CUMPROD_H__*/ diff --git a/src/c/matrixOperations/includes/cumsum.h b/src/c/matrixOperations/includes/cumsum.h new file mode 100644 index 00000000..24d81bdf --- /dev/null +++ b/src/c/matrixOperations/includes/cumsum.h @@ -0,0 +1,53 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CUMSUM_H__ +#define __CUMSUM_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcumsuma(double *in1, int row, int column, double *out); +void drowcumsuma(double *in1, int row, int column, double *out); +void dcolumncumsuma(double *in1, int row, int column, double *out); + +void scumsuma(float *in1, int row, int column, float *out); +void srowcumsuma(float *in1, int row, int column, float *out); +void scolumncumsuma(float *in1, int row, int column, float *out); + +void u8cumsuma(uint8 *in1, int row, int column, uint8 *out); +void u8rowcumsuma(uint8 *in1, int row, int column, uint8 *out); +void u8columncumsuma(uint8 *in1, int row, int column, uint8 *out); + +void i8cumsuma(int8 *in1, int row, int column, int8 *out); +void i8rowcumsuma(int8 *in1, int row, int column, int8 *out); +void i8columncumsuma(int8 *in1, int row, int column, int8 *out); + +void u16cumsuma(uint16 *in1, int row, int column, uint16 *out); +void u16rowcumsuma(uint16 *in1, int row, int column, uint16 *out); +void u16columncumsuma(uint16 *in1, int row, int column, uint16 *out); + +void i16cumsuma(int16 *in1, int row, int column, int16 *out); +void i16rowcumsuma(int16 *in1, int row, int column, int16 *out); +void i16columncumsuma(int16 *in1, int row, int column, int16 *out); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CUMSUM_H__*/ diff --git a/src/c/matrixOperations/includes/diag.h b/src/c/matrixOperations/includes/diag.h new file mode 100644 index 00000000..5f97923d --- /dev/null +++ b/src/c/matrixOperations/includes/diag.h @@ -0,0 +1,97 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __DIAG_H__ +#define __DIAG_H__ + +#include "dynlib_matrixoperations.h" +#include "types.h" +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS double ddiags(double in ); + +EXTERN_MATOPS void ddiaga(double in, int size,int insert_post,double *out); + +EXTERN_MATOPS void ddiagina(double *in, int _row,int _column,int insert_post,double *out); + +EXTERN_MATOPS void ddiagins(double* in, int size, double* out ); + +EXTERN_MATOPS void ddiagexa(double* in,int row,int column,int insert_pos,double* out); + +EXTERN_MATOPS double ddiagexs(double* in,int row,int column,int extract_pos); + +EXTERN_MATOPS uint8 u8diags(uint8 in ); + +EXTERN_MATOPS void u8diaga(uint8 in, int size,int insert_post,uint8 *out); + +EXTERN_MATOPS void u8diagina(uint8 *in, int _row,int _column,int insert_post,uint8 *out); + +EXTERN_MATOPS void u8diagins(uint8* in, int size, uint8* out ); + +EXTERN_MATOPS void u8diagexa(uint8* in,int row,int column,int insert_pos,uint8* out); + +EXTERN_MATOPS uint8 u8diagexs(uint8* in,int row,int column,int extract_pos); + +EXTERN_MATOPS uint16 u16diags(uint16 in ); + +EXTERN_MATOPS void u16diaga(uint16 in, int size,int insert_post,uint16 *out); + +EXTERN_MATOPS void u16diagina(uint16 *in, int _row,int _column,int insert_post,uint16 *out); + +EXTERN_MATOPS void u16diagins(uint16* in, int size, uint16* out ); + +EXTERN_MATOPS void u16diagexa(uint16* in,int row,int column,int insert_pos,uint16* out); + +EXTERN_MATOPS uint16 u16diagexs(uint16* in,int row,int column,int extract_pos); + +EXTERN_MATOPS int8 i8diags(int8 in ); + +EXTERN_MATOPS void i8diaga(int8 in, int size,int insert_post,int8 *out); + +EXTERN_MATOPS void i8diagina(int8 *in, int _row,int _column,int insert_post,int8 *out); + +EXTERN_MATOPS void i8diagins(int8* in, int size, int8* out ); + +EXTERN_MATOPS void i8diagexa(int8* in,int row,int column,int insert_pos,int8* out); + +EXTERN_MATOPS int8 i8diagexs(int8* in,int row,int column,int extract_pos); + +EXTERN_MATOPS int16 i16diags(int16 in ); + +EXTERN_MATOPS void i16diaga(int16 in, int size,int insert_post,int16 *out); + +EXTERN_MATOPS void i16diagina(int16 *in, int _row,int _column,int insert_post,int16 *out); + +EXTERN_MATOPS void i16diagins(int16* in, int size, int16* out ); + +EXTERN_MATOPS void i16diagexa(int16* in,int row,int column,int insert_pos,int16* out); + +EXTERN_MATOPS int16 i16diagexs(int16* in,int row,int column,int extract_pos); + + + + + + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__DIAG_H__ */ + diff --git a/src/c/matrixOperations/includes/eye.h b/src/c/matrixOperations/includes/eye.h index f7f2ef2f..95bdd797 100644 --- a/src/c/matrixOperations/includes/eye.h +++ b/src/c/matrixOperations/includes/eye.h @@ -16,6 +16,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "ones.h" #ifdef __cplusplus extern "C" { @@ -42,6 +43,26 @@ extern "C" { #define zeyes(in) DoubleComplex(1, 0) /* +** \brief create a Uint8 Eye value +*/ +#define u8eyes(in) (uint8)1 + +/* +** \brief create a int8 Eye value +*/ +#define i8eyes(in) (int8)1 + +/* +** \brief create a Uint16 Eye value +*/ +#define u16eyes(in) (uint16)1 + +/* +** \brief create a int16 Eye value +*/ +#define i16eyes(in) (int16)1 + +/* ** \brief create a float Eye matrix */ EXTERN_MATOPS void seyea(float* in, int _iRows, int _iCols); @@ -61,6 +82,26 @@ EXTERN_MATOPS void ceyea(floatComplex* in, int _iRows, int _iCols); */ EXTERN_MATOPS void zeyea(doubleComplex* in, int _iRows, int _iCols); +/* +** \brief create a uint8 Eye matrix +*/ +EXTERN_MATOPS void u8eyea(uint8* in, int _iRows, int _iCols); + +/* +** \brief create a int8 Eye matrix +*/ +EXTERN_MATOPS void i8eyea(int8* in, int _iRows, int _iCols); + +/* +** \brief create a uint16 Eye matrix +*/ +EXTERN_MATOPS void u16eyea(uint16* in, int _iRows, int _iCols); + +/* +** \brief create a int16 Eye matrix +*/ +EXTERN_MATOPS void i16eyea(int16* in, int _iRows, int _iCols); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/flipdim.h b/src/c/matrixOperations/includes/flipdim.h new file mode 100644 index 00000000..bdf4a688 --- /dev/null +++ b/src/c/matrixOperations/includes/flipdim.h @@ -0,0 +1,40 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __FLIPDIM_H__ +#define __FLIPDIM_H__ + +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void dflipdima (double *in, int row, int col, int dim, int blk_size, double *out); + +void sflipdima (float *in, int row, int col, int dim, int blk_size, float *out); + +void u8flipdima (uint8 *in, int row, int col, int dim, int blk_size, uint8 *out); + +void i8flipdima (int8 *in, int row, int col, int dim, int blk_size, int8 *out); + +void u16flipdima (uint16 *in, int row, int col, int dim, int blk_size, uint16 *out); + +void i16flipdima (int16 *in, int row, int col, int dim, int blk_size, int16 *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__FLIPDIM_H__*/ diff --git a/src/c/matrixOperations/includes/kron.h b/src/c/matrixOperations/includes/kron.h new file mode 100644 index 00000000..e4cff2dc --- /dev/null +++ b/src/c/matrixOperations/includes/kron.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __KRON_H__ +#define __KRON_H__ + +#include "kron.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dkrona (double *in1, int row1, int col1, double *in2, int row2, \ + int col2, double *out); +void skrona (float *in1, int row1, int col1, float *in2, int row2, \ + int col2, float *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__KRON_H__*/ diff --git a/src/c/matrixOperations/includes/matrix.h b/src/c/matrixOperations/includes/matrix.h new file mode 100644 index 00000000..582fd221 --- /dev/null +++ b/src/c/matrixOperations/includes/matrix.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __MATRIX_H__ +#define __MATRIX_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void dmatrixa(double* , int , int , int , int , double*); +void smatrixa( float* , int , int , int , int , float*); +void u16matrixa(uint16 *, int , int , int , int ,uint16 *out); +void zmatrixa(doubleComplex *, int , int , int , int ,doubleComplex *); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MATRIX_H__*/ diff --git a/src/c/matrixOperations/includes/matrixInversion.h b/src/c/matrixOperations/includes/matrixInversion.h index 90312459..e547bb97 100644 --- a/src/c/matrixOperations/includes/matrixInversion.h +++ b/src/c/matrixOperations/includes/matrixInversion.h @@ -16,6 +16,7 @@ #include "abs.h" #include "dynlib_matrixoperations.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -59,6 +60,43 @@ EXTERN_MATOPS void cinverma ( floatComplex* in, floatComplex* out, int leadDimIn EXTERN_MATOPS void zinverma ( doubleComplex* in, doubleComplex* out, int leadDimIn ); +/* +** \brief Compute the matrix inverse for uint8. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void u8inverma ( uint8* in, float* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for int8. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void i8inverma ( int8* in, float* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for uint16. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void u16inverma ( uint16* in, float* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for int16. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void i16inverma ( int16* in, float* out, int leadDimIn ); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/matrixMagnitude.h b/src/c/matrixOperations/includes/matrixMagnitude.h index 7b65c6d9..a9f4e71c 100644 --- a/src/c/matrixOperations/includes/matrixMagnitude.h +++ b/src/c/matrixOperations/includes/matrixMagnitude.h @@ -17,6 +17,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -34,6 +35,18 @@ EXTERN_MATOPS float cmagna(floatComplex* in, int rows, int cols); EXTERN_MATOPS double zmagns(doubleComplex in); EXTERN_MATOPS double zmagna(doubleComplex* in, int rows, int cols); +EXTERN_MATOPS uint8 u8magns(uint8 in); +EXTERN_MATOPS uint8 u8magna(uint8* in, int rows, int cols); + +EXTERN_MATOPS uint16 u16magns(uint16 in); +EXTERN_MATOPS uint16 u16magna(uint16* in, int rows, int cols); + +EXTERN_MATOPS int8 i8magns(int8 in); +EXTERN_MATOPS int8 i8magna(int8* in, int rows, int cols); + +EXTERN_MATOPS int16 i16magns(int16 in); +EXTERN_MATOPS int16 i16magna(int16* in, int rows, int cols); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/matrixMultiplication.h b/src/c/matrixOperations/includes/matrixMultiplication.h index 228dd163..c2235c8b 100644 --- a/src/c/matrixOperations/includes/matrixMultiplication.h +++ b/src/c/matrixOperations/includes/matrixMultiplication.h @@ -16,6 +16,7 @@ #include "dynlib_matrixoperations.h" #include "multiplication.h" #include "addition.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -84,6 +85,64 @@ EXTERN_MATOPS void zmulma(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex *out); +/* +** \brief Compute a multiplication for uint8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void u8mulma(uint8 *in1, int lines1, int columns1, + uint8 *in2, int lines2, int columns2, + uint8 *out); + +/* +** \brief Compute a multiplication for uint16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void u16mulma(uint16 *in1, int lines1, int columns1, + uint16 *in2, int lines2, int columns2, + uint16 *out); + +/* +** \brief Compute a multiplication for int8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void i8mulma(int8 *in1, int lines1, int columns1, + int8 *in2, int lines2, int columns2, + int8 *out); + +/* +** \brief Compute a multiplication for int16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void i16mulma(int16 *in1, int lines1, int columns1, + int16 *in2, int lines2, int columns2, + int16 *out); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/matrixTrace.h b/src/c/matrixOperations/includes/matrixTrace.h index 76b77454..80f895df 100644 --- a/src/c/matrixOperations/includes/matrixTrace.h +++ b/src/c/matrixOperations/includes/matrixTrace.h @@ -16,6 +16,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -63,6 +64,44 @@ EXTERN_MATOPS floatComplex ctracea ( floatComplex* in ,int lines ) ; */ EXTERN_MATOPS doubleComplex ztracea ( doubleComplex* in ,int lines ) ; + +/* +** \brief Compute the trace of a uint8 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : uint8 containing the trace. +*/ +EXTERN_MATOPS uint8 u8tracea ( uint8* in ,int lines ) ; + + +/* +** \brief Compute the trace of a uint16 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : uint16 containing the trace. +*/ +EXTERN_MATOPS uint16 u16tracea ( uint16* in ,int lines ) ; + + +/* +** \brief Compute the trace of a int8 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : int8 containing the trace. +*/ +EXTERN_MATOPS int8 i8tracea ( int8* in ,int lines ) ; + + +/* +** \brief Compute the trace of a int16 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : int16 containing the trace. +*/ +EXTERN_MATOPS int16 i16tracea ( int16* in ,int lines ) ; + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/matrixTranspose.h b/src/c/matrixOperations/includes/matrixTranspose.h index 122b618d..7e2acbf1 100644 --- a/src/c/matrixOperations/includes/matrixTranspose.h +++ b/src/c/matrixOperations/includes/matrixTranspose.h @@ -16,6 +16,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #include <math.h> #ifdef __cplusplus @@ -54,6 +55,45 @@ EXTERN_MATOPS void ctransposea ( floatComplex* in , int lines1 , int column1, fl */ EXTERN_MATOPS void ztransposea ( doubleComplex* in , int lines1 , int column1, doubleComplex* out ); + +/* +** \brief Compute the transpose of a uint8 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed uint8 matrix. +*/ +EXTERN_MATOPS void u8transposea ( uint8* in , int lines1 , int column1, uint8* out ); + +/* +** \brief Compute the transpose of a uint16 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed uint16 matrix. +*/ +EXTERN_MATOPS void u16transposea ( uint16* in , int lines1 , int column1, uint16* out ); + +/* +** \brief Compute the transpose of a int8 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed int8 matrix. +*/ +EXTERN_MATOPS void i8transposea ( int8* in , int lines1 , int column1, int8* out ); + +/* +** \brief Compute the transpose of a int16 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed int16 matrix. +*/ +EXTERN_MATOPS void i16transposea ( int16* in , int lines1 , int column1, int16* out ); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/ndgrid.h b/src/c/matrixOperations/includes/ndgrid.h new file mode 100644 index 00000000..2c6f9cfb --- /dev/null +++ b/src/c/matrixOperations/includes/ndgrid.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 __NDGRID_H__ +#define __NDGRID_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "ndgrid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dndgrida(double* inp1, int size1, double* inp2, int size2, double* out1, double* out2); +void sndgrida(float* inp1, int size1, float* inp2, int size2, float* out1, float* out2); +void zndgrida(doubleComplex* inp1, int size1, doubleComplex* inp2, int size2, doubleComplex* out1, doubleComplex* out2); +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NDGRID_H__*/ diff --git a/src/c/matrixOperations/includes/nnz.h b/src/c/matrixOperations/includes/nnz.h new file mode 100644 index 00000000..c7d2d491 --- /dev/null +++ b/src/c/matrixOperations/includes/nnz.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __NNZ_H__ +#define __NNZ_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 dnnza(double* , int , int); +uint16 dnnzs(double); +uint16 snnza( float* , int , int); +uint16 snnzs( float); +uint16 znnza(doubleComplex *, int , int); +uint16 znnzs(doubleComplex); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NNZ_H__*/ diff --git a/src/c/matrixOperations/includes/norm.h b/src/c/matrixOperations/includes/norm.h new file mode 100644 index 00000000..4fe3872c --- /dev/null +++ b/src/c/matrixOperations/includes/norm.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __NORM_H__ +#define __NORM_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +double dnormv (double *in, int size, int norm); + +double dnorma (double *in, int row, int col, int norm); + +float snormv (float *in, int size, int norm); + +float snorma (float *in, int row, int col, int norm); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NORM_H__*/ diff --git a/src/c/matrixOperations/includes/ones.h b/src/c/matrixOperations/includes/ones.h index 63d8bd4b..6734017d 100644 --- a/src/c/matrixOperations/includes/ones.h +++ b/src/c/matrixOperations/includes/ones.h @@ -17,6 +17,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus @@ -43,25 +44,67 @@ extern "C" { */ #define zoness(in) DoubleComplex(1, 0) +/* +** \brief create a uint8 one value +*/ +#define u8oness(in) (uint8)1 + +/* +** \brief create a int8 one value +*/ +#define i8oness(in) (int8)1 + +/* +** \brief create a uint16 one value +*/ +#define u16oness(in) (uint16)1 + +/* +** \brief create a int16 one value +*/ +#define i16oness(in) (int16)1 /* ** \brief create a float matrix full of one */ EXTERN_MATOPS void sonesa ( float* in , int rows , int cols ); + /* ** \brief create a float complex matrix full of one */ EXTERN_MATOPS void conesa ( floatComplex* in , int rows ,int cols ); + /* ** \brief create a double matrix full of one */ EXTERN_MATOPS void donesa ( double* in , int rows ,int cols ); + /* ** \brief create a double complex matrix full of one */ EXTERN_MATOPS void zonesa ( doubleComplex* in , int rows ,int cols ); +/* +** \brief create a uint8 matrix full of one +*/ +EXTERN_MATOPS void u8onesa ( uint8* in , int rows , int cols ); + +/* +** \brief create a int8 matrix full of one +*/ +EXTERN_MATOPS void i8onesa ( int8* in , int rows , int cols ); + +/* +** \brief create a uint16 matrix full of one +*/ +EXTERN_MATOPS void u16onesa ( uint16* in , int rows , int cols ); + +/* +** \brief create a int16 matrix full of one +*/ +EXTERN_MATOPS void i16onesa ( int16* in , int rows , int cols ); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/pertrans.h b/src/c/matrixOperations/includes/pertrans.h new file mode 100644 index 00000000..2c385ace --- /dev/null +++ b/src/c/matrixOperations/includes/pertrans.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __PERTRANS_H__ +#define __PERTRANS_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dpertransa(double *in, int row, int col, double* out); +double dpertranss(double in); + +void spertransa(float *in, int row, int col, float* out); +float spertranss(float in); + +void zpertransa(doubleComplex *in, int row, int col, doubleComplex* out); +doubleComplex zpertranss(doubleComplex in); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__PERTRANS_H__*/ diff --git a/src/c/matrixOperations/includes/toeplitz.h b/src/c/matrixOperations/includes/toeplitz.h new file mode 100644 index 00000000..7384b43c --- /dev/null +++ b/src/c/matrixOperations/includes/toeplitz.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 __TOEPLITZ_H__ +#define __TOEPLITZ_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dtoeplitza(double* inp1,int size1,double* inp2,int size2,double* oup); +void u8toeplitza(uint8* inp1,int size1,uint8* inp2,int size2,uint8* oup); +void u16toeplitza(uint16* inp1,int size1,uint16* inp2,int size2,uint16* oup); +void ztoeplitza(doubleComplex* inp1,int size1,doubleComplex* inp2,int size2,doubleComplex* oup); +void gtoeplitza(char* inp1,int size1,char* inp2,int size2,char* oup); +void stoeplitza(float* inp1,int size1,float* inp2,int size2,float* oup); +void ctoeplitza(floatComplex* inp1,int size1,floatComplex* inp2,int size2,floatComplex* oup); +void i8toeplitza(int8* inp1,int size1,int8* inp2,int size2,int8* oup); +void i16toeplitza(int16* inp1,int size1,int16* inp2,int size2,int16* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__TOEPLITZ_H__*/ diff --git a/src/c/matrixOperations/includes/tril.h b/src/c/matrixOperations/includes/tril.h new file mode 100644 index 00000000..486e81f9 --- /dev/null +++ b/src/c/matrixOperations/includes/tril.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __TRIL_H__ +#define __TRIL_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dtrila (double *in, int row, int column, double diag, double *out); +void strila (float *in, int row, int column, double diag, float *out); +void u8trila (uint8 *in, int row, int column, double diag, uint8 *out); +void u16trila (uint16 *in, int row, int column, double diag, uint16 *out); +void i8trila (int8 *in, int row, int column, double diag, int8 *out); +void i16trila (int16 *in, int row, int column, double diag, int16 *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__TRIL_H__*/ diff --git a/src/c/matrixOperations/includes/triu.h b/src/c/matrixOperations/includes/triu.h new file mode 100644 index 00000000..2b62e22b --- /dev/null +++ b/src/c/matrixOperations/includes/triu.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __TRIU_H__ +#define __TRIU_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dtriua (double *in, int row, int column, double diag, double *out); +void striua (float *in, int row, int column, double diag, float *out); +void u8triua (uint8 *in, int row, int column, double diag, uint8 *out); +void u16triua (uint16 *in, int row, int column, double diag, uint16 *out); +void i8triua (int8 *in, int row, int column, double diag, int8 *out); +void i16triua (int16 *in, int row, int column, double diag, int16 *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__TRIU_H__*/ diff --git a/src/c/matrixOperations/includes/zeros.h b/src/c/matrixOperations/includes/zeros.h index 06b2e5a5..993940fc 100644 --- a/src/c/matrixOperations/includes/zeros.h +++ b/src/c/matrixOperations/includes/zeros.h @@ -17,6 +17,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -43,6 +44,25 @@ extern "C" { #define zzeross(in) DoubleComplex(0, 0) +/* +** \brief create a single uint8 zero +*/ +#define u8zerosu8(in) (uint8)0 + +/* +** \brief create a single int8 zero +*/ +#define i8zerosi8(in) (int8)0 + +/* +** \brief create a single uint8 zero +*/ +#define u16zerosu16(in) (uint16)0 + +/* +** \brief create a single int8 zero +*/ +#define i16zerosi16(in) (int16)0 /* ** \brief create a float matrix full of one @@ -66,6 +86,26 @@ EXTERN_MATOPS void zzerosa ( doubleComplex* in , int rows ,int cols ); */ EXTERN_MATOPS void dzerosh ( double* in , int rows ,int cols , int levels); +/* +** \brief create a uint8 matrix full of zero +*/ +EXTERN_MATOPS void u8zerosa ( uint8* in , int rows , int cols ); + +/* +** \brief create a int8 matrix full of zero +*/ +EXTERN_MATOPS void i8zerosa ( int8* in , int rows , int cols ); + +/* +** \brief create a uint16 matrix full of zero +*/ +EXTERN_MATOPS void u16zerosa ( uint16* in , int rows , int cols ); + +/* +** \brief create a int16 matrix full of zero +*/ +EXTERN_MATOPS void i16zerosa ( int16* in , int rows , int cols ); + #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/matrixOperations/interfaces/int_OpStar.h b/src/c/matrixOperations/interfaces/int_OpStar.h index 400918a4..f922b319 100644 --- a/src/c/matrixOperations/interfaces/int_OpStar.h +++ b/src/c/matrixOperations/interfaces/int_OpStar.h @@ -23,6 +23,14 @@ #define c2c2OpStarc2(in1,size1,in2,size2,out) cmulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define u82u82OpStaru82(in1,size1,in2,size2,out) u8mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + +#define u162u162OpStaru162(in1,size1,in2,size2,out) u16mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + +#define i82i82OpStari82(in1,size1,in2,size2,out) i8mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + +#define i162i162OpStari162(in1,size1,in2,size2,out) i16mulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + #define c2s2OpStarc2(in1,size1,in2,size2,out) cmulma(in1,size1[0],size1[1],FloatComplexMatrix(in2,0,size2[0]*size2[1]),size2[0],size2[1],out) #define s2c2OpStarc2(in1,size1,in2,size2,out) cmulma(FloatComplexMatrix(in1,0,size1[0]*size1[1]),size1[0],size1[1],in2,size2[0],size2[1],out) diff --git a/src/c/matrixOperations/interfaces/int_cat.h b/src/c/matrixOperations/interfaces/int_cat.h new file mode 100644 index 00000000..db80bec9 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_cat.h @@ -0,0 +1,359 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CAT_H +#define __INT_CAT_H + +/* Column Cat */ + +/* Same input elements */ + +#define s0s0cats2(in1,in2,out) scolumncats(in1,in2,out) + +#define d0d0catd2(in1,in2,out) dcolumncats(in1,in2,out) + +#define c0c0catc2(in1,in2,out) ccolumncats(in1,in2,out) + +#define z0z0catz2(in1,in2,out) zcolumncats(in1,in2,out) + +#define u80u80catu82(in1,in2,out) u8columncats(in1,in2,out) + +#define u160u160catu162(in1,in2,out) u16columncats(in1,in2,out) + +#define i80i80cati82(in1,in2,out) i8columnscats(in1,in2,out) + +#define i160i160cati162(in1,in2,out) i16columnscats(in1,in2,out) + +#define s2s2cats2(in1,size1,in2,size2,out) scolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define d2d2catd2(in1,size1,in2,size2,out) dcolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +/* ROW COLUMN SUPPORT for cat, If First argument in cat command is 1 then it will concatenate the element ROW WISE else COLUMN WISE */ + +#define d0d2d2catd2(in1,in2,size2,in3,size3,out) (in1 == 1) ? drowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : dcolumncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out) + +#define d0u82u82catu82(in1,in2,size2,in3,size3,out) (in1 == 1) ? u8rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : u8columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out) + +#define d0u162u162catu162(in1,in2,size2,in3,size3,out) (in1 == 1) ? u16rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : u16columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out) + + +#define d0i82i82cati82(in1,in2,size2,in3,size3,out) (in1 == 1) ? i8rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : i8columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out) + +#define d0i162i162cati162(in1,in2,size2,in3,size3,out) (in1 == 1) ? i16rowcata(in2, size2[0], size2[1], in3, size3[0], size3[1], out) : i16columncata(in2, size2[0],size2[1],in3,size3[0],size3[1],out) + + +#define c2c2catc2(in1,size1,in2,size2,out) ccolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define z2z2catz2(in1,size1,in2,size2,out) zcolumncata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define u82u82catu82(in1,size1,in2,size2,out) u8columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out) + +#define u162u162catu162(in1,size1,in2,size2,out) u16columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out) + +#define i82i82cati82(in1,size1,in2,size2,out) i8columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out) + +#define i162i162cati162(in1,size1,in2,size2,out) i16columncata(in1,size1[0], size1[1], in2, size2[0], size2[1], out) + + + +/* Differents input elements */ +#define s0c0catc2(in1,in2,out) c0c0OpRcc2(FloatComplex(in1,0),in2,out) + +#define d0z0catz2(in1,in2,out) z0z0OpRcz2(DoubleComplex(in1,0),in2,out) + +#define c0s0catc2(in1,in2,out) c0c0OpRcc2(in1,FloatComplex(in2,0),out) + +#define z0d0catz2(in1,in2,out) z0z0OpRcz2(in1,DoubleComplex(in2,0),out) + +#define s2c2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size1[0],size1[1],0); \ + c2c2OpRcc2(FloatComplexMatrix(in1,(float*)out,size1[0]*size1[1]), size1, in2, size2, out) + +#define d2z2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size1[0],size1[1],0); \ + z2z2OpRcz2(DoubleComplexMatrix(in1,(double*)out,size1[0]*size1[1]), size1, in2, size2, out) + +#define c2s2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size2[0],size2[1],0); \ + c2c2OpRcc2(in1, size1, FloatComplexMatrix(in2,(float*)out,size2[0]*size2[1]), size2, out) + +#define z2d2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size2[0],size2[1],0); \ + z2z2OpRcz2(in1, size1, DoubleComplexMatrix(in2,(double*)out,size2[0]*size2[1]), size2, out) + +/* Matrix-Scalar */ + +/* Same type */ + +#define s2s0cats2(in1,size,in2,out) { float temp=in2; \ + scolumncata(in1, size[0], size[1],&temp, 1, 1, out); \ + } + +#define d2d0catd2(in1,size,in2,out) { double temp=in2; \ + dcolumncata(in1, size[0], size[1],&temp, 1, 1, out); \ + } + +#define c2c0catc2(in1,size,in2,out) { floatComplex temp=in2; \ + ccolumncata(in1, size[0], size[1], &temp, 1, 1, out); \ + } + +#define z2z0catz2(in1,size,in2,out) { doubleComplex temp=in2; \ + zcolumncata(in1, size[0], size[1], &temp, 1, 1, out); \ + } + +#define u82u80catu82(in1,size,in2,out) { uint8 temp=in2; \ + u8columncata(in1,size[0],size[1],&temp,1,1,out); \ + } +#define u162u160catu162(in1,size,in2,out) { uint16 temp=in2; \ + u16columncata(in1,size[0],size[1],&temp,1,1,out); \ + } +#define i82i80cati82(in1,size,in2,out) { int8 temp=in2; \ + i8columncata(in1,size[0],size[1],&temp,1,1,out); \ + } +#define i162i160cati162(in1,size,in2,out) { int16 temp=in2; \ + i16columncata(in1,size[0],size[1],&temp,1,1,out); \ + } + + +/* Different type */ +#define s2c0catc2(in1,size,in2,out) { floatComplex temp=in2; \ + sfilla((float *)out,size[0],size[1],0); \ + scolumncata(FloatComplexMatrix(in1,(float*)out,size[0]*size[1]), size[0], size[1], &temp , 1, 1, out); \ + } + +#define d2z0catz2(in1,size,in2,out) { doubleComplex temp=in2; \ + dfilla((double *)out,size[0],size[1],0); \ + zcolumncata(DoubleComplexMatrix(in1,(double *)out,size[0]*size[1]), size[0], size[1], &temp , 1, 1, out); \ + } + +#define c2s0catc2(in1,size,in2,out) { floatComplex temp = FloatComplex(in2,0); \ + ccolumncata(in1, size[0], size[1], &temp, 1, 1, out); \ + } + +#define z2d0catz2(in1,size,in2,out) { doubleComplex temp = DoubleComplex(in2,0); \ + zcolumncata(in1, size[0], size[1], &temp, 1, 1, out); \ + } + +/* Scalar-Matrix */ + +/* Same type */ +#define s0s2cats2(in1,in2,size,out) { \ + float __tmp1 = in1 ;\ + scolumncata(&__tmp1 , 1, 1, in2, size[0], size[1], out);\ +} +#define d0d2catd2(in1,in2,size,out) {\ + double __tmp1 = in1 ;\ + dcolumncata(&__tmp1 , 1, 1, in2, size[0], size[1], out); \ +} + +#define c0c2catc2(in1,in2,size,out) { \ + floatComplex __tmp1 = in1 ;\ + ccolumncata(&__tmp1, 1, 1, in2, size[0], size[1], out);\ +} + +#define z0z2catz2(in1,in2,size,out) { \ + doubleComplex __tmp1 = in1 ;\ + zcolumncata(&__tmp1, 1, 1, in2, size[0], size[1], out);\ +} + +#define u80u82catu82(in1,in2,size,out) {\ + uint8 __tmp1 = in1 ;\ + u8columncata(&__tmp1,1,1,in2,size[0],size[1],out);\ +} + +#define u160u162catu162(in1,in2,size,out) {\ + uint16 __tmp1 = in1 ;\ + u16columncata(&__tmp1,1,1,in2,size[0],size[1],out);\ +} + +#define i80i82cati82(in1,in2,size,out) {\ + int8 __tmp1 = in1 ;\ + i8columncata(&__tmp1,1,1,in2,size[0],size[1],out);\ +} + +#define i160i162cati162(in1,in2,size,out) {\ + int16 __tmp1 = in1 ;\ + i16columncata(&__tmp1,1,1,in2,size[0],size[1],out);\ +} + + +/* Different type */ +#define s0c2catc2(in1,in2,size,out) c0c2OpRcc2(FloatComplex(in1,0),in2,size,out) + +#define d0z2catz2(in1,in2,size,out) z0z2OpRcz2(DoubleComplex(in1,0),in2,size,out) + +#define c0s2catc2(in1,in2,size,out) sfilla((float*)out,size[0],size[1],0); \ + c0c2OpRcc2(in1,FloatComplexMatrix(in2,(float*)out,size[0]*size[1]),size,out) + +#define z0d2catz2(in1,in2,size,out) dfilla((double*)out,size[0],size[1],0); \ + z0z2OpRcz2(in1,DoubleComplexMatrix(in2,(double*)out,size[0]*size[1]),size,out) + + +/* Column Cat */ + +/* Same input elements */ + +#define s0s0cats2(in1,in2,out) srowcats(in1,in2,out) + +#define d0d0catd2(in1,in2,out) drowcats(in1,in2,out) + +#define c0c0catc2(in1,in2,out) crowcats(in1,in2,out) + +#define z0z0catz2(in1,in2,out) zrowcats(in1,in2,out) + +#define u80u80catu82(in1,in2,out) u8rowcats(in1,in2,out) + +#define u160u160catu162(in1,in2,out) u16rowcats(in1,in2,out) + +#define i80i80cati82(in1,in2,out) i8rowcats(in1,in2,out) + +#define i160i160cati162(in1,in2,out) i16rowcats(in1,in2,out) + +#define s2s2cats2(in1,size1,in2,size2,out) srowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define d2d2catd2(in1,size1,in2,size2,out) drowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define c2c2catc2(in1,size1,in2,size2,out) crowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define z2z2catz2(in1,size1,in2,size2,out) zrowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define u82u82catu82(in1,size1,in2,size2,out) u8rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define u162u162catu162(in1,size1,in2,size2,out) u16rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define i82i82cati82(in1,size1,in2,size2,out) i8rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +#define i162i162cati162(in1,size1,in2,size2,out) i16rowcata(in1, size1[0], size1[1], in2, size2[0], size2[1], out) + +/* Differents input elements */ +#define s0c0catc2(in1,in2,out) c0c0OpCcc2(FloatComplex(in1,0),in2,out) + +#define d0z0catz2(in1,in2,out) z0z0OpCcz2(DoubleComplex(in1,0),in2,out) + +#define c0s0catc2(in1,in2,out) c0c0OpCcc2(in1,FloatComplex(in2,0),out) + +#define z0d0catz2(in1,in2,out) z0z0OpCcz2(in1,DoubleComplex(in2,0),out) + +#define s2c2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size1[0],size1[1],0); \ + c2c2OpCcc2(FloatComplexMatrix(in1,(float*)out,size1[0]*size1[1]), size1, in2, size2, out) + +#define d2z2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size1[0],size1[1],0); \ + z2z2OpCcz2(DoubleComplexMatrix(in1,(double*)out,size1[0]*size1[1]), size1, in2, size2, out) + +#define c2s2catc2(in1,size1,in2,size2,out) sfilla((float*)out,size2[0],size2[1],0); \ + c2c2OpCcc2(in1, size1, FloatComplexMatrix(in2,(float*)out,size2[0]*size2[1]), size2, out) + +#define z2d2catz2(in1,size1,in2,size2,out) dfilla((double*)out,size2[0],size2[1],0); \ + z2z2OpCcz2(in1, size1, DoubleComplexMatrix(in2,(double*)out,size2[0]*size2[1]), size2, out) + +/* Matrix-Scalar */ + +/* Same type */ + +#define s2s0cats2(in1,size,in2,out) { float temp=in2; \ + srowcata(in1, size[0], size[1],&temp, 1, 1, out); \ + } + +#define d2d0catd2(in1,size,in2,out) { double temp=in2; \ + drowcata(in1, size[0], size[1],&temp, 1, 1, out); \ + } + +#define c2c0catc2(in1,size,in2,out) { floatComplex temp = in2; \ + crowcata(in1, size[0], size[1],&temp, 1, 1, out);\ + } + +#define z2z0catz2(in1,size,in2,out) { doubleComplex temp =in2; \ + zrowcata(in1, size[0], size[1],&temp, 1, 1, out);\ + } + +#define u82u80catu82(in1,size,in2,out) { uint8 temp=in2; \ + u8rowcata(in1, size[0], size[1],&temp, 1,1,out);\ + } +#define u162u160catu162(in1,size,in2,out) { uint16 temp=in2; \ + u16rowcata(in1, size[0], size[1],&temp, 1,1,out);\ + } + +#define i82i80cati82(in1,size,in2,out) { int8 temp=in2; \ + i8rowcata(in1, size[0], size[1],&temp, 1,1,out);\ + } +#define i162i160cati162(in1,size,in2,out) { int16 temp=in2; \ + i16rowcata(in1, size[0], size[1],&temp, 1,1,out);\ + } + + + +/* Different type */ +#define s2c0catc2(in1,size,in2,out) sfilla((float *)out,size[0],size[1],0); \ + c2c0OpCcc2(FloatComplexMatrix(in1,(float*)out,size[0]*size[1]),size,in2,out) + +#define d2z0catz2(in1,size,in2,out) dfilla((double *)out,size[0],size[1],0); \ + z2z0OpCcz2(DoubleComplexMatrix(in1,(double *)out,size[0]*size[1]),size,in2,out) + +#define c2s0catc2(in1,size,in2,out) { floatComplex temp = FloatComplex(in2, 0); c2c0OpCcc2(in1, size, temp, out)} + +#define z2d0catz2(in1,size,in2,out) { doubleComplex temp = DoubleComplex(in2, 0); z2z0OpCcz2(in1, size, temp, out)} + + +/* Scalar-Matrix */ + +/* Same type */ +#define s0s2cats2(in1,in2,size,out) { \ + float __tmp1 = in1 ;\ + srowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\ +} + +#define d0d2catd2(in1,in2,size,out) { \ + double __tmp1 = in1 ;\ + drowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\ +} + +#define c0c2catc2(in1,in2,size,out) { \ + floatComplex __tmp1 = in1 ;\ + crowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\ +} + +#define z0z2catz2(in1,in2,size,out) { \ + doubleComplex __tmp1 = in1 ;\ + zrowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\ +} + +#define u80u82catu82(in1,in2,size,out) { \ + uint8 __tmp1 = in1;\ + u8rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\ +} + +#define u160u162catu162(in1,in2,size,out) { \ + uint16 __tmp1 = in1;\ + u16rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\ +} + +#define i80i82cati82(in1,in2,size,out) { \ + int8 __tmp1 = in1;\ + i8rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\ +} + +#define i160i162cati162(in1,in2,size,out) { \ + int16 __tmp1 = in1;\ + i16rowcata(&__tmp1, 1,1, in2, size[0], size[1], out);\ +} + + +/* Different type */ +#define s0c2catc2(in1,in2,size,out) c0c2OpCcc2(FloatComplex(in1,0),in2,size,out) + +#define d0z2catz2(in1,in2,size,out) z0z2OpCcz2(DoubleComplex(in1,0),in2,size,out) + +#define c0s2catc2(in1,in2,size,out) sfilla((float*)out,size[0],size[1],0); \ + c0c2OpCcc2(in1,FloatComplexMatrix(in2,(float*)out,size[0]*size[1]),size,out) + +#define z0d2catz2(in1,in2,size,out) dfilla((double*)out,size[0],size[1],0); \ + z0z2OpCcz2(in1,DoubleComplexMatrix(in2,(double*)out,size[0]*size[1]),size,out) + + +#endif /* !__INT_CAT__H */ + diff --git a/src/c/matrixOperations/interfaces/int_cross.h b/src/c/matrixOperations/interfaces/int_cross.h new file mode 100644 index 00000000..8f4e7824 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_cross.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 __INT_CROSS_H__ +#define __INT_CROSS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define d2d2crossd2(in1,size1,in2,size2,out) dcrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define z2z2crossz2(in1,size1,in2,size2,out) zcrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define c2c2crossc2(in1,size1,in2,size2,out) ccrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define s2s2crosss2(in1,size1,in2,size2,out) scrossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define u82u82crossu82(in1,size1,in2,size2,out) u8crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define i82i82crossi82(in1,size1,in2,size2,out) i8crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define u162u162crossu162(in1,size1,in2,size2,out) u16crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) +#define i162i162crossi162(in1,size1,in2,size2,out) i16crossa(in1,size1[0],size1[1],in2,size2[0],size2[1],out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CROSS_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_cumprod.h b/src/c/matrixOperations/interfaces/int_cumprod.h new file mode 100644 index 00000000..5ba3cc7a --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_cumprod.h @@ -0,0 +1,54 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CUMPROD_H__ +#define __INT_CUMPROD_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0cumprodd0(in) in +#define s0cumprods0(in) in +#define u80cumprodu80(in) in +#define u160cumprodu160(in) in +#define i80cumprodi80(in) in +#define i160cumprodi160(in) in + +#define d2cumprodd2(in1, size1, out) dcumproda(in1, size1[0], size1[1], out) +#define s2cumprods2(in1, size1, out) scumproda(in1, size1[0], size1[1], out) +#define u82cumprodu82(in1, size1, out) u8cumproda(in1, size1[0], size1[1], out) +#define u162cumprodu162(in1, size1, out) u16cumproda(in1, size1[0], size1[1], out) +#define i82cumprodi82(in1, size1, out) i8cumproda(in1, size1[0], size1[1], out) +#define i162cumprodi162(in1, size1, out) i16cumproda(in1, size1[0], size1[1], out) + +#define d2g2cumprodd2(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + drowcumproda(in1,size1[0],size1[1],out) : dcolumncumproda(in1,size1[0],size1[1],out) +#define s2g2cumprods2(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + srowcumproda(in1,size1[0],size1[1],out) : scolumncumproda(in1,size1[0],size1[1],out) +#define u82g2cumprodu82(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + u8rowcumproda(in1,size1[0],size1[1],out) : u8columncumproda(in1,size1[0],size1[1],out) +#define i82g2cumprodi82(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + i8rowcumproda(in1,size1[0],size1[1],out) : i8columncumproda(in1,size1[0],size1[1],out) +#define u162g2cumprodu162(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + u16rowcumproda(in1,size1[0],size1[1],out) : u16columncumproda(in1,size1[0],size1[1],out) +#define i162g2cumprodi162(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + i16rowcumproda(in1,size1[0],size1[1],out) : i16columncumproda(in1,size1[0],size1[1],out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CUMPROD_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_cumsum.h b/src/c/matrixOperations/interfaces/int_cumsum.h new file mode 100644 index 00000000..0eda0ac9 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_cumsum.h @@ -0,0 +1,54 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CUMSUM_H__ +#define __INT_CUMSUM_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0cumsumd0(in) in +#define s0cumsums0(in) in +#define u80cumsumu80(in) in +#define u160cumsumu160(in) in +#define i80cumsumi80(in) in +#define i160cumsumi160(in) in + +#define d2cumsumd2(in1, size1, out) dcumsuma(in1, size1[0], size1[1], out) +#define s2cumsums2(in1, size1, out) scumsuma(in1, size1[0], size1[1], out) +#define u82cumsumu82(in1, size1, out) u8cumsuma(in1, size1[0], size1[1], out) +#define u162cumsumu162(in1, size1, out) u16cumsuma(in1, size1[0], size1[1], out) +#define i82cumsumi82(in1, size1, out) i8cumsuma(in1, size1[0], size1[1], out) +#define i162cumsumi162(in1, size1, out) i16cumsuma(in1, size1[0], size1[1], out) + +#define d2g2cumsumd2(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + drowcumsuma(in1,size1[0],size1[1],out) : dcolumncumsuma(in1,size1[0],size1[1],out) +#define s2g2cumsums2(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + srowcumsuma(in1,size1[0],size1[1],out) : scolumncumsuma(in1,size1[0],size1[1],out) +#define u82g2cumsumu82(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + u8rowcumsuma(in1,size1[0],size1[1],out) : u8columncumsuma(in1,size1[0],size1[1],out) +#define i82g2cumsumi82(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + i8rowcumsuma(in1,size1[0],size1[1],out) : i8columncumsuma(in1,size1[0],size1[1],out) +#define u162g2cumsumu162(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + u16rowcumsuma(in1,size1[0],size1[1],out) : u16columncumsuma(in1,size1[0],size1[1],out) +#define i162g2cumsumi162(in1, size1, in2, size2, out) (in2[0]=='r') ? \ + i16rowcumsuma(in1,size1[0],size1[1],out) : i16columncumsuma(in1,size1[0],size1[1],out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CUMSUM_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_diag.h b/src/c/matrixOperations/interfaces/int_diag.h new file mode 100644 index 00000000..339831b1 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_diag.h @@ -0,0 +1,85 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_DIAG_H__ +#define __INT_DIAG_H__ + + + +#define d0diagd0(in1) ddiags(in1) + +#define d0d0diagd0(in1,in2) ddiags(in1) + +#define d0d0diagd2(in1,in2,out) ddiaga(in1,1,in2,out) + +#define d2diagd2(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? ddiagins(in1,size[1],out) : ddiagins(in1,size[0],out); } else {ddiagexa(in1,size[0],size[1],0,out) ;} + +#define d2d0diagd2(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { ddiagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {ddiagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? ddiagins(in1,size[1],out) : ddiagins(in1,size[0],out); };} + +#define d2d0diagd0(in1,size,in2) ddiagexs(in1,size[0],size[1],in2) + + + +#define u80diagu80(in1) u8diags(in1) + +#define u80d0diagu80(in1,in2) u8diags(in1) + +#define u80d0diagu82(in1,in2,out) u8diaga(in1,1,in2,out) + +#define u82diagu82(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? u8diagins(in1,size[1],out) : u8diagins(in1,size[0],out); } else {u8diagexa(in1,size[0],size[1],0,out) ;} + +#define u82d0diagu82(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { u8diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {u8diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? u8diagins(in1,size[1],out) : u8diagins(in1,size[0],out); };} + +#define u82d0diagu80(in1,size,in2) u8diagexs(in1,size[0],size[1],in2) + +#define u160diagu160(in1) u16diags(in1) + +#define u160d0diagu160(in1,in2) u16diags(in1) + +#define u160d0diagu162(in1,in2,out) u16diaga(in1,1,in2,out) + +#define u162diagu162(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? u16diagins(in1,size[1],out) : u16diagins(in1,size[0],out); } else {u16diagexa(in1,size[0],size[1],0,out) ;} + +#define u162d0diagu162(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { u16diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {u16diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? u16diagins(in1,size[1],out) : u16diagins(in1,size[0],out); };} + +#define u162d0diagu160(in1,size,in2) u16diagexs(in1,size[0],size[1],in2) + + + +#define i80diagi80(in1) i8diags(in1) + +#define i80d0diagi80(in1,in2) i8diags(in1) + +#define i80d0diagi82(in1,in2,out) i8diaga(in1,1,in2,out) + +#define i82diagi82(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? i8diagins(in1,size[1],out) : i8diagins(in1,size[0],out); } else {i8diagexa(in1,size[0],size[1],0,out) ;} + +#define i82d0diagi82(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { i8diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {i8diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? i8diagins(in1,size[1],out) : i8diagins(in1,size[0],out); };} + +#define i82d0diagi80(in1,size,in2) i8diagexs(in1,size[0],size[1],in2) + +#define i160diagi160(in1) i16diags(in1) + +#define i160d0diagi160(in1,in2) i16diags(in1) + +#define i160d0diagi162(in1,in2,out) i16diaga(in1,1,in2,out) + + +#define i162diagi162(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? i16diagins(in1,size[1],out) : i16diagins(in1,size[0],out); } else {i16diagexa(in1,size[0],size[1],0,out) ;} + +#define i162d0diagi162(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { i16diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {i16diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? i16diagins(in1,size[1],out) : i16diagins(in1,size[0],out); };} + +#define i162d0diagi160(in1,size,in2) i16diagexs(in1,size[0],size[1],in2) + + + +#endif /* !__INT_DIAG_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_eye.h b/src/c/matrixOperations/interfaces/int_eye.h index 81ed7fdd..1e10eb83 100644 --- a/src/c/matrixOperations/interfaces/int_eye.h +++ b/src/c/matrixOperations/interfaces/int_eye.h @@ -20,7 +20,13 @@ #define eyed0() 1 +#define eyeu80() (uint8)1 +#define eyei80() (int8)1 + +#define eyeu160() (uint16)1 + +#define eyei160() (int16)1 #define s0eyes0(in) seyes(in) @@ -30,16 +36,37 @@ #define z0eyez0(in) zeyes(in) +#define u80eyeu80(in) u8eyes(in) + +#define i80eyei80(in) i8eyes(in) + +#define u160eyeu160(in) u16eyes(in) + +#define i160eyei160(in) i16eyes(in) #define s0s0eyes0(in1,in2) 1.0f #define d0d0eyed0(in,in2) 1 +#define u80u80eyeu80(in1,in2) (uint8)1 + +#define i80i80eyei80(in1,in2) (int8)1 + +#define u160u160eyeu160(in1,in2) (uint16)1 + +#define i160i160eyei160(in1,in2) (int16)1 #define s0s0eyes2(in1,in2,out) seyea(out, in1, in2) #define d0d0eyed2(in1,in2,out) deyea(out, in1, in2) +#define u80u80eyeu82(in1,in2,out) u8eyea(out, in1, in2) + +#define i80i80eyei82(in1,in2,out) i8eyea(out, in1, in2) + +#define u160u160eyeu162(in1,in2,out) u16eyea(out, in1, in2) + +#define i160i160eyei162(in1,in2,out) i16eyea(out, in1, in2) #define s2eyes2(in,size,out) seyea(out, size[0], size[1]) @@ -49,5 +76,13 @@ #define z2eyez2(in,size,out) zeyea(out, size[0], size[1]) +#define u82eyeu82(in,size,out) u8eyea(out, size[0], size[1]) + +#define i82eyei82(in,size,out) i8eyea(out, size[0], size[1]) + +#define u162eyeu162(in,size,out) u16eyea(out, size[0], size[1]) + +#define i162eyei162(in,size,out) i16eyea(out, size[0], size[1]) + #endif /* !__INT_EYE_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_flipdim.h b/src/c/matrixOperations/interfaces/int_flipdim.h new file mode 100644 index 00000000..0c27181f --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_flipdim.h @@ -0,0 +1,109 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_FLIPDIM_H__ +#define __INT_FLIPDIM_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0flipdimd0(in1, in2) in1 +#define s0s0flipdims0(in1, in2) in1 +#define u80u80flipdimu80(in1, in2) in1 +#define i80i80flipdimi80(in1, in2) in1 +#define u160u160flipdimu160(in1, in2) in1 +#define i160i160flipdimi160(in1, in2) in1 +#define u80d0flipdimu80(in1, in2) in1 +#define i80d0flipdimi80(in1, in2) in1 +#define u160d0flipdimu160(in1, in2) in1 +#define i160d0flipdimi160(in1, in2) in1 + +#define d0d0d0flipdimd0(in1, in2, in3) in1 +#define s0s0s0flipdims0(in1, in2, in3) in1 +#define u80u80u80flipdimu80(in1, in2, in3) in1 +#define i80i80i80flipdimi80(in1, in2, in3) in1 +#define u160u160u160flipdimu160(in1, in2, in3) in1 +#define i160i160i160flipdimi160(in1, in2, in3) in1 +#define u80d0d0flipdimu80(in1, in2, in3) in1 +#define i80d0d0flipdimi80(in1, in2, in3) in1 +#define u160d0d0flipdimu160(in1, in2, in3) in1 +#define i160d0d0flipdimi160(in1, in2, in3) in1 + + +#define d2d0flipdimd2(in1, size1, in2, out) dflipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define s2s0flipdims2(in1, size1, in2, out) sflipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define u82u80flipdimu82(in1, size1, in2, out) u8flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define i82i80flipdimi82(in1, size1, in2, out) i8flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define u162u160flipdimu162(in1, size1, in2, out) u16flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define i162i160flipdimi162(in1, size1, in2, out) i16flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define u82d0flipdimu82(in1, size1, in2, out) u8flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define i82d0flipdimi82(in1, size1, in2, out) i8flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define u162d0flipdimu162(in1, size1, in2, out) u16flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define i162d0flipdimi162(in1, size1, in2, out) i16flipdima (in1, size1[0], size1[1], \ + in2, 1, out); + +#define d2d0d0flipdimd2(in1, size1, in2, in3, out) dflipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define s2s0s0flipdims2(in1, size1, in2, in3, out) sflipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define u82u80u80flipdimu82(in1, size1, in2, in3, out) u8flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define i82i80i80flipdimi82(in1, size1, in2, in3, out) i8flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define u162u160u160flipdimu162(in1, size1, in2, in3, out) u16flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define i162i160i160flipdimi162(in1, size1, in2, in3, out) i16flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define u82d0d0flipdimu82(in1, size1, in2, in3, out) u8flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define i82d0d0flipdimi82(in1, size1, in2, in3, out) i8flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define u162d0d0flipdimu162(in1, size1, in2, in3, out) u16flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + +#define i162d0d0flipdimi162(in1, size1, in2, in3, out) i16flipdima(in1, size1[0], size1[1], \ + in2, in3, out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_FLIPDIM_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_invert.h b/src/c/matrixOperations/interfaces/int_invert.h index d31481b6..285a0f4a 100644 --- a/src/c/matrixOperations/interfaces/int_invert.h +++ b/src/c/matrixOperations/interfaces/int_invert.h @@ -23,6 +23,14 @@ #define z0invz0(in) zrdivs(DoubleComplex(1,0),in) +#define u80invs0(in) 1.0f/(float)in + +#define i80invs0(in) 1.0f/(float)in + +#define u160invs0(in) 1.0f/(float)in + +#define i160invs0(in) 1.0f/(float)in + #define s2invs2(in,size,out) sinverma(in, out, size[0]) #define d2invd2(in,size,out) dinverma(in, out, size[0]) @@ -31,4 +39,12 @@ #define z2invz2(in,size,out) zinverma(in, out, size[0]) +#define u82invs2(in,size,out) u8inverma(in, out, size[0]) + +#define i82invs2(in,size,out) i8inverma(in, out, size[0]) + +#define u162invs2(in,size,out) u16inverma(in, out, size[0]) + +#define i162invs2(in,size,out) i16inverma(in, out, size[0]) + #endif /* !__INT_INV_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_kron.h b/src/c/matrixOperations/interfaces/int_kron.h new file mode 100644 index 00000000..a6fbaab1 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_kron.h @@ -0,0 +1,43 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_KRON_H__ +#define __INT_KRON_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0krond0(in1, in2) in1*in2 +#define s0s0krons0(in1, in2) in1*in2 + +#define d0d2krond2(in1, in2, size2, out) {int i; \ + for(i=0;i < size2[0]*size2[1];i++) out[i] = in2[i]*in1;} +#define s0s2krons2(in1, in2, size2, out) {int i; \ + for(i=0;i < size2[0]*size2[1];i++) out[i] = in2[i]*in1;} + +#define d2d0krond2(in1, size1, in2, out) {int i; \ + for(i=0;i < size1[0]*size1[1];i++) out[i] = in1[i]*in2;} +#define s2s0krons2(in1, in2, size2, out) {int i; \ + for(i=0;i < size2[0]*size2[1];i++) out[i] = in2[i]*in1;} + +#define d2d2krond2(in1, size1, in2, size2, out) dkrona(in1, size1[0], size1[1], \ + in2, size2[0], size2[1], out); +#define s2s2krons2(in1, size1, in2, size2, out) skrona(in1, size1[0], size1[1], \ + in2, size2[0], size2[1], out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_KRON_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_matrix.h b/src/c/matrixOperations/interfaces/int_matrix.h new file mode 100644 index 00000000..5935f4a3 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_matrix.h @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_MATRIX_H__ +#define __INT_MATRIX_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2d0d0matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out) +#define d2s0s0matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out) +//#define d2u160u160matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out) +//#define d2u80u80matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out) + +#define s2d0d0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +#define s2s0s0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + +#define u162d0d0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out) +#define u162s0s0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + +#define z2d0d0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out) +#define z2s0s0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) +//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out) + + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MATRIX_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_ndgrid.h b/src/c/matrixOperations/interfaces/int_ndgrid.h new file mode 100644 index 00000000..b7fd0a65 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_ndgrid.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_NDGRID_H__ +#define __INT_NDGRID_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2d2ndgridd2d2(in1,size1,in2,size2,out1,out2) dndgrida(in1,size1[0]*size1[1],in2,size2[0]*size2[1],out1,out2) +#define s2s2ndgrids2s2(in1,size1,in2,size2,out1,out2) sndgrida(in1,size1[0]*size1[1],in2,size2[0]*size2[1],out1,out2) +#define z2z2ndgridz2z2(in1,size1,in2,size2,out1,out2) zndgrida(in1,size1[0]*size1[1],in2,size2[0]*size2[1],out1,out2) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NDGRID_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_nnz.h b/src/c/matrixOperations/interfaces/int_nnz.h new file mode 100644 index 00000000..0ef39536 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_nnz.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_NNZ_H__ +#define __INT_NNZ_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2nnzu160(in1, size) dnnza(in1, size[0], size[1]) +#define d0nnzu160(in) dnnzs(in) + +#define s2nnzu160(in1, size) snnza(in1, size[0], size[1]) +#define s0nnzu160(in) snnzs(in) + +#define z2nnzu160(in1, size) znnza(in1, size[0], size[1]) +#define z0nnzu160(in) znnzs(in) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NNZ_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_norm.h b/src/c/matrixOperations/interfaces/int_norm.h new file mode 100644 index 00000000..a42a6754 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_norm.h @@ -0,0 +1,53 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_NORM_H__ +#define __INT_NORM_H__ + +#include "statMax.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0normd0(in) in +#define s0norms0(in) in + +#define d2normd0(in,size,out) ((size[0] == 1) || (size[1]==1))? \ + dnormv(in, size[0]*size[1], 2): \ + dnorma(in, size[0], size[1], 2) + +#define s2norms0(in,size,out) ((size[0] == 1) || (size[1]==1))? \ + snormv(in, size[0]*size[1], 2): \ + snorma(in, size[0], size[1], 2) + +#define d2d0normd0(in,size,norm) ((size[0] == 1) || (size[1]==1))? \ + dnormv(in,size[0]*size[1],norm) : \ + dnorma(in,size[0],size[1],norm) + +#define s2s0norms0(in,size,norm) ((size[0] == 1) || (size[1]==1))? \ + snormv(in,size[0]*size[1],norm) : \ + snorma(in,size[0],size[1],norm) + +#define d2g2normd0(in,size,norm,normsize) ((size[0] == 1) || (size[1]==1))? \ + (norm[0]=='i') ? dmaxa(in,size[0]*size[1]) : dnormv(in,size[0]*size[1],2) : \ + (norm[0]=='i') ? dnorma(in,size[0],size[1],3) : dnorma(in,size[0],size[1],4) + +#define s2g2norms0(in,size,norm,normsize) ((size[0] == 1) || (size[1]==1))? \ + (norm[0]=='i') ? smaxa(in,size[0]*size[1]) : snormv(in,size[0]*size[1],2) : \ + (norm[0]=='i') ? snorma(in,size[0],size[1],3) : snorma(in,size[0],size[1],4) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_NORM_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_ones.h b/src/c/matrixOperations/interfaces/int_ones.h index 0259b4c6..e266ee52 100644 --- a/src/c/matrixOperations/interfaces/int_ones.h +++ b/src/c/matrixOperations/interfaces/int_ones.h @@ -20,7 +20,13 @@ #define onesd0() 1 +#define onesu80() (uint8)1 +#define onesi80() (int8)1 + +#define onesu160() (uint16)1 + +#define onesi160() (int16)1 #define s0oness0(in) soness(in) @@ -30,16 +36,37 @@ #define z0onesz0(in) zoness(in) +#define u80onesu80(in) u8oness(in) + +#define i80onesi80(in) i8oness(in) + +#define u160onesu160(in) u16oness(in) + +#define i160onesi160(in) i16oness(in) #define s0s0oness0(in1,in2) 1.0f #define d0d0onesd0(in,in2) 1 +#define u80u80onesu80(in1,in2) (uint8)1 + +#define i80i80onesi80(in1,in2) (int8)1 + +#define u160u160onesu160(in1,in2) (uint16)1 + +#define i160i160onesi160(in1,in2) (int16)1 #define s0s0oness2(in1,in2,out) sonesa(out, in1, in2) #define d0d0onesd2(in1,in2,out) donesa(out, in1, in2) +#define u80u80onesu82(in1,in2,out) u8onesa(out, in1, in2) + +#define i80i80onesi82(in1,in2,out) i8onesa(out, in1, in2) + +#define u160u160onesu162(in1,in2,out) u16onesa(out, in1, in2) + +#define i160i160onesi162(in1,in2,out) i16onesa(out, in1, in2) #define s2oness2(in,size,out) sonesa(out, size[0], size[1]) @@ -49,5 +76,12 @@ #define z2onesz2(in,size,out) zonesa(out, size[0], size[1]) +#define u82onesu82(in,size,out) u8onesa(out, size[0], size[1]) + +#define i82onesi82(in,size,out) i8onesa(out, size[0], size[1]) + +#define u162onesu162(in,size,out) u16onesa(out, size[0], size[1]) + +#define i162onesi162(in,size,out) i16onesa(out, size[0], size[1]) #endif /* !__INT_ONES_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_permute.h b/src/c/matrixOperations/interfaces/int_permute.h new file mode 100644 index 00000000..66049aca --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_permute.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_PERMUTE_H__ +#define __INT_PERMUTE_H__ + + +#ifdef __cplusplus +#extern "C" { +#endif + +#define d2d2permuted2(in1, size1, in2, size2, out) (if(in2[0]==1)?in1: \ + dtransposea(in1, size1[0],size1[1],out)) + +#ifdef __cplusplus +#} /* extern "C" */ +#endif + +#endif /*__INT_FLIPDIM_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_pertrans.h b/src/c/matrixOperations/interfaces/int_pertrans.h new file mode 100644 index 00000000..8aa8ec5e --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_pertrans.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_PERTRANS_H__ +#define __INT_PERTRANS_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2pertransd2(in1, size, out) dpertransa(in1, size[0], size[1], out) +#define d0pertransd0(in1) dpertranss(in1) + +#define s2pertranss2(in1, size, out) spertransa(in1, size[0], size[1], out) +#define s0pertranss0(in1) spertranss(in1) + +#define z2pertransz2(in1, size, out) zpertransa(in1, size[0], size[1], out) +#define z0pertransz0(in1) zpertranss(in1) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_PERTRANS_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_toeplitz.h b/src/c/matrixOperations/interfaces/int_toeplitz.h new file mode 100644 index 00000000..b602e9a8 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_toeplitz.h @@ -0,0 +1,50 @@ + /* 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_TOEPLITZ_H__ +#define __INT_TOEPLITZ_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2d2toeplitzd2(in1,size1,in2,size2,out) dtoeplitza(in1,size1[1],in2,size2[1],out) +#define d2toeplitzd2(in1,size1,out) dtoeplitza(in1,size1[1],in1,size1[1],out) + +#define u82u82toeplitzu82(in1,size1,in2,size2,out) u8toeplitza(in1,size1[1],in2,size2[1],out) +#define u82toeplitzu82(in1,size1,out) u8toeplitza(in1,size1[1],in1,size1[1],out) + +#define u162u162toeplitzu162(in1,size1,in2,size2,out) u16toeplitza(in1,size1[1],in2,size2[1],out) +#define u162toeplitzu162(in1,size1,out) u16toeplitza(in1,size1[1],in1,size1[1],out) + +#define g2g2toeplitzg2(in1,size1,in2,size2,out) gtoeplitza(in1,size1[1],in2,size2[1],out) +#define g2toeplitzg2(in1,size1,out) gtoeplitza(in1,size1[1],in1,size1[1],out) + +#define z2z2toeplitzz2(in1,size1,in2,size2,out) ztoeplitza(in1,size1[1],in2,size2[1],out) +#define z2toeplitzz2(in1,size1,out) ztoeplitza(in1,size1[1],in1,size1[1],out) + +#define s2s2toeplitzs2(in1,size1,in2,size2,out) stoeplitza(in1,size1[1],in2,size2[1],out) +#define s2toeplitzs2(in1,size1,out) stoeplitza(in1,size1[1],in1,size1[1],out) + +#define c2c2toeplitzc2(in1,size1,in2,size2,out) ctoeplitza(in1,size1[1],in2,size2[1],out) +#define c2toeplitzc2(in1,size1,out) ctoeplitza(in1,size1[1],in1,size1[1],out) + +#define i82i82toeplitzi82(in1,size1,in2,size2,out) i8toeplitza(in1,size1[1],in2,size2[1],out) +#define i82toeplitzi82(in1,size1,out) i8toeplitza(in1,size1[1],in1,size1[1],out) + +#define i162i162toeplitzi162(in1,size1,in2,size2,out) i16toeplitza(in1,size1[1],in2,size2[1],out) +#define i162toeplitzi162(in1,size1,out) i16toeplitza(in1,size1[1],in1,size1[1],out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_TOEPLITZ_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_trace.h b/src/c/matrixOperations/interfaces/int_trace.h index 8bfea860..58c42991 100644 --- a/src/c/matrixOperations/interfaces/int_trace.h +++ b/src/c/matrixOperations/interfaces/int_trace.h @@ -21,7 +21,13 @@ #define c0tracec0(in) in -#define z0tracez0(in) in +#define u80traceu80(in) (uint8)in + +#define u160traceu160(in) (uint16)in + +#define i80tracei80(in) (int8)in + +#define i160tracei160(in) (int16)in #define s2traces0(in,size) stracea(in, size[0]) @@ -31,4 +37,12 @@ #define z2tracez0(in,size) ztracea(in, size[0]) +#define u82traceu80(in,size) u8tracea(in, size[0]) + +#define u162traceu160(in,size) u16tracea(in, size[0]) + +#define i82tracei80(in,size) i8tracea(in, size[0]) + +#define i162tracei160(in,size) i16trace(in,size[0]) + #endif /* !__INT_TRACE_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_transpose.h b/src/c/matrixOperations/interfaces/int_transpose.h index 250d565f..3fd328f6 100644 --- a/src/c/matrixOperations/interfaces/int_transpose.h +++ b/src/c/matrixOperations/interfaces/int_transpose.h @@ -23,6 +23,14 @@ #define z0transposez0(in) in +#define u80transposeu80(in) (uint8)in + +#define u160transposeu160(in) (uint16)in + +#define i80transposei80(in) (int8)in + +#define i160transposei160(in) (int16)in + #define s2transposes2(in,size,out) stransposea(in, size[0], size[1], out) #define d2transposed2(in,size,out) dtransposea(in, size[0], size[1], out) @@ -31,4 +39,13 @@ #define z2transposez2(in,size,out) ztransposea(in, size[0], size[1], out) + +#define u82transposeu82(in,size,out) u8transposea(in, size[0], size[1], out) + +#define u162transposeu162(in,size,out) u16transposea(in, size[0], size[1], out) + +#define i82transposei82(in,size,out) i8transposea(in, size[0], size[1], out) + +#define i162transposei162(in,size,out) i16transposea(in, size[0], size[1], out) + #endif /* !__INT_TRANSPOSE_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_tril.h b/src/c/matrixOperations/interfaces/int_tril.h new file mode 100644 index 00000000..6d694519 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_tril.h @@ -0,0 +1,62 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_TRIL_H__ +#define __INT_TRIL_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0trild0(in) in +#define s0trils0(in) in +#define u80trilu80(in) in +#define u160trilu160(in) in +#define i80trili80(in) in +#define i160trili160(in) in + +#define d0d0trild0(in1, in2) (in2 == 0 ? in1 : 0) +#define s0s0trils0(in1, in2) (in2 == 0 ? in1 : 0) +#define u80u80trilu80(in1, in2) (in2 == 0 ? in1 : 0) +#define i80i80trili80(in1, in2) (in2 == 0 ? in1 : 0) +#define u160u160trilu160(in1, in2) (in2 == 0 ? in1 : 0) +#define i160i160trili160(in1, in2) (in2 == 0 ? in1 : 0) +#define u80d0trilu80(in1, in2) (in2 == 0 ? in1 : 0) +#define i80d0trili80(in1, in2) (in2 == 0 ? in1 : 0) +#define u160d0trilu160(in1, in2) (in2 == 0 ? in1 : 0) +#define i160d0trili160(in1, in2) (in2 == 0 ? in1 : 0) + +#define d2trild2(in, size, out) dtrila(in, size[0], size[1], 0, out); +#define s2trils2(in, size, out) strila(in, size[0], size[1], 0, out); +#define u82trilu82(in, size, out) u8trila(in, size[0], size[1], 0, out); +#define u162trilu162(in, size, out) u16trila(in, size[0], size[1], 0, out); +#define i82trili82(in, size, out) i8trila(in, size[0], size[1], 0, out); +#define i162trili162(in, size, out) i16trila(in, size[0], size[1], 0, out); + +#define d2d0trild2(in1, size1, in2, out) dtrila(in1, size1[0], size1[1], in2, out); +#define s2s0trils2(in1, size1, in2, out) strila(in1, size1[0], size1[1], in2, out); +#define u82u80trilu82(in1, size1, in2, out) u8trila(in1, size1[0], size1[1], (double)in2, out); +#define i82i80trili82(in1, size1, in2, out) i8trila(in1, size1[0], size1[1], (double)in2, out); +#define u162u160trilu162(in1, size1, in2, out) u16trila(in1, size1[0], size1[1], (double)in2, out); +#define i162i160trili162(in1, size1, in2, out) i16trila(in1, size1[0], size1[1], (double)in2, out); +#define u82d0trilu82(in1, size1, in2, out) u8trila(in1, size1[0], size1[1], in2, out); +#define i82d0trili82(in1, size1, in2, out) i8trila(in1, size1[0], size1[1], in2, out); +#define u162d0trilu162(in1, size1, in2, out) u16trila(in1, size1[0], size1[1], in2, out); +#define i162d0trili162(in1, size1, in2, out) i16trila(in1, size1[0], size1[1], in2, out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_TRIL_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_triu.h b/src/c/matrixOperations/interfaces/int_triu.h new file mode 100644 index 00000000..1aef3115 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_triu.h @@ -0,0 +1,62 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_TRIU_H__ +#define __INT_TRIU_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0triud0(in) in +#define s0trius0(in) in +#define u80triuu80(in) in +#define u160triuu160(in) in +#define i80triui80(in) in +#define i160triui160(in) in + +#define d0d0triud0(in1, in2) (in2 == 0 ? in1 : 0) +#define s0s0trius0(in1, in2) (in2 == 0 ? in1 : 0) +#define u80u80triuu80(in1, in2) (in2 == 0 ? in1 : 0) +#define i80i80triui80(in1, in2) (in2 == 0 ? in1 : 0) +#define u160u160triuu160(in1, in2) (in2 == 0 ? in1 : 0) +#define i160i160triui160(in1, in2) (in2 == 0 ? in1 : 0) +#define u80d0triuu80(in1, in2) (in2 == 0 ? in1 : 0) +#define i80d0triui80(in1, in2) (in2 == 0 ? in1 : 0) +#define u160d0triuu160(in1, in2) (in2 == 0 ? in1 : 0) +#define i160d0triui160(in1, in2) (in2 == 0 ? in1 : 0) + +#define d2triud2(in, size, out) dtriua(in, size[0], size[1], 0, out); +#define s2trius2(in, size, out) striua(in, size[0], size[1], 0, out); +#define u82triuu82(in, size, out) u8triua(in, size[0], size[1], 0, out); +#define u162triuu162(in, size, out) u16triua(in, size[0], size[1], 0, out); +#define i82triui82(in, size, out) i8triua(in, size[0], size[1], 0, out); +#define i162triui162(in, size, out) i16triua(in, size[0], size[1], 0, out); + +#define d2d0triud2(in1, size1, in2, out) dtriua(in1, size1[0], size1[1], in2, out); +#define s2s0trius2(in1, size1, in2, out) striua(in1, size1[0], size1[1], in2, out); +#define u82u80triuu82(in1, size1, in2, out) u8triua(in1, size1[0], size1[1], (double)in2, out); +#define i82i80triui82(in1, size1, in2, out) i8triua(in1, size1[0], size1[1], (double)in2, out); +#define u162u160triuu162(in1, size1, in2, out) u16triua(in1, size1[0], size1[1], (double)in2, out); +#define i162i160triui162(in1, size1, in2, out) i16triua(in1, size1[0], size1[1], (double)in2, out); +#define u82d0triuu82(in1, size1, in2, out) u8triua(in1, size1[0], size1[1], in2, out); +#define i82d0triui82(in1, size1, in2, out) i8triua(in1, size1[0], size1[1], in2, out); +#define u162d0triuu162(in1, size1, in2, out) u16triua(in1, size1[0], size1[1], in2, out); +#define i162d0triui162(in1, size1, in2, out) i16triua(in1, size1[0], size1[1], in2, out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_TRIU_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_vmagn.h b/src/c/matrixOperations/interfaces/int_vmagn.h index 8a51755e..a8647aa2 100644 --- a/src/c/matrixOperations/interfaces/int_vmagn.h +++ b/src/c/matrixOperations/interfaces/int_vmagn.h @@ -24,6 +24,14 @@ #define z0vmagnz0(in) zmagns(in) +#define u80vmagnu80(in) u8magns(in) + +#define u160vmagnu160(in) u16magns(in) + +#define i80vmagni80(in) i8magns(in) + +#define i160vmagni160(in) i16magns(in) + #define s2vmagns2(in,size) smagna(in, size[0], size[1]) #define d2vmagnd2(in,size) dmagna(in, size[0], size[1]) @@ -32,4 +40,12 @@ #define z2vmagnz2(in,size) zmagna(in, size[0], size[1]) +#define u82vmagnu82(in,size) u8magna(in, size[0], size[1]) + +#define u162vmagnu162(in,size) u16magna(in, size[0], size[1]) + +#define i82vmagni82(in,size) i8magna(in, size[0], size[1]) + +#define i162vmagni162(in,size) i16magna(in, size[0], size[1]) + #endif /* !__INT_VMAGN_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_zeros.h b/src/c/matrixOperations/interfaces/int_zeros.h index 4bc32138..ac7e020e 100644 --- a/src/c/matrixOperations/interfaces/int_zeros.h +++ b/src/c/matrixOperations/interfaces/int_zeros.h @@ -21,7 +21,13 @@ #define zerosd0() 0 +#define zerosu80() (uint8)0 +#define zerosi80() (int8)0 + +#define zerosu160() (uint16)0 + +#define zerosi160() (int16)0 #define s0zeross0(in) szeross(in) @@ -31,16 +37,37 @@ #define z0zerosz0(in) zzeross(in) +#define u80zerosu80(in) u8zeross(in) + +#define i80zerosi80(in) i8zeross(in) + +#define u160zerosu160(in) u16zeross(in) + +#define i160zerosi160(in) i16zeross(in) #define s0s0zeross0(in1,in2) 0.0f -#define d0d0zerosd0(in,in2) 0 +#define d0d0zerosd0(in1,in2) 0 + +#define u80u80zerosu80(in1,in2) (uint8)0 + +#define i80i80zerosi80(in1,in2) (int8)0 + +#define u160u160zerosu160(in1,in2) (uint16)0 +#define i160i160zerosi160(in1,in2) (int16)0 #define s0s0zeross2(in1,in2,out) szerosa(out, in1, in2) #define d0d0zerosd2(in1,in2,out) dzerosa(out, in1, in2) +#define u80u80zerosu82(in1,in2,out) u8zerosa(out, in1, in2) + +#define i80i80zerosi82(in1,in2,out) i8zerosa(out, in1, in2) + +#define u160u160zerosu162(in1,in2,out) u16zerosa(out, in1, in2) + +#define i160i160zerosi162(in1,in2,out) i16zerosa(out, in1, in2) #define s2zeross2(in,size,out) szerosa(out, size[0], size[1]) @@ -50,5 +77,13 @@ #define z2zerosz2(in,size,out) zzerosa(out, size[0], size[1]) +#define u82zerosu82(in,size,out) u8zerosa(out, size[0], size[1]) + +#define i82zerosi82(in,size,out) i8zerosa(out, size[0], size[1]) + +#define u162zerosu162(in,size,out) u16zerosa(out, size[0], size[1]) + +#define i162zerosi162(in,size,out) i16zerosa(out, size[0], size[1]) + #define d0d0d0zerosd3(in1, in2, in3, out) dzerosh(out, in1, in2, in3); #endif /* !__INT_ZEROS_H__ */ diff --git a/src/c/matrixOperations/interfaces/interface.sh b/src/c/matrixOperations/interfaces/interface.sh index 8c7f073b..8c7f073b 100755..100644 --- a/src/c/matrixOperations/interfaces/interface.sh +++ b/src/c/matrixOperations/interfaces/interface.sh diff --git a/src/c/matrixOperations/inversion/i16inverma.c b/src/c/matrixOperations/inversion/i16inverma.c new file mode 100644 index 00000000..0dd18509 --- /dev/null +++ b/src/c/matrixOperations/inversion/i16inverma.c @@ -0,0 +1,55 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include <stdlib.h> +#include "matrixInversion.h" +#include "lapack.h" + +void i16inverma ( int16* in, float* out, int leadDimIn ) +{ + + int i = 0 ; + /* these 3 variable are created to permit to use the value in the fortran functions + because they need double matrix as arguments and we can't cast directly the pointers + without having problems , i know that's ugly */ + double *dblin = NULL; + double *dblout = NULL; + + + + /* Array allocations*/ + dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + + + + /*copy and cast all the float value into double value */ + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ ) + { + dblin[i] = (double) in[i] ; + } + + dinverma ( dblin, dblout, leadDimIn ); + + + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ ) + { + out[i] =(float) dblout[i] ; + + } + + free ( dblin); + free ( dblout); + +} diff --git a/src/c/matrixOperations/inversion/i8inverma.c b/src/c/matrixOperations/inversion/i8inverma.c new file mode 100644 index 00000000..66c66e2f --- /dev/null +++ b/src/c/matrixOperations/inversion/i8inverma.c @@ -0,0 +1,55 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include <stdlib.h> +#include "matrixInversion.h" +#include "lapack.h" + +void i8inverma ( int8* in, float* out, int leadDimIn ) +{ + + int i = 0 ; + /* these 3 variable are created to permit to use the value in the fortran functions + because they need double matrix as arguments and we can't cast directly the pointers + without having problems , i know that's ugly */ + double *dblin = NULL; + double *dblout = NULL; + + + + /* Array allocations*/ + dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + + + + /*copy and cast all the float value into double value */ + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ ) + { + dblin[i] = (double) in[i] ; + } + + dinverma ( dblin, dblout, leadDimIn ); + + + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ ) + { + out[i] =(float) dblout[i] ; + + } + + free ( dblin); + free ( dblout); + +} diff --git a/src/c/matrixOperations/inversion/u16inverma.c b/src/c/matrixOperations/inversion/u16inverma.c new file mode 100644 index 00000000..917c9af8 --- /dev/null +++ b/src/c/matrixOperations/inversion/u16inverma.c @@ -0,0 +1,55 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include <stdlib.h> +#include "matrixInversion.h" +#include "lapack.h" + +void u16inverma ( uint16* in, float* out, int leadDimIn ) +{ + + int i = 0 ; + /* these 3 variable are created to permit to use the value in the fortran functions + because they need double matrix as arguments and we can't cast directly the pointers + without having problems , i know that's ugly */ + double *dblin = NULL; + double *dblout = NULL; + + + + /* Array allocations*/ + dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + + + + /*copy and cast all the float value into double value */ + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ ) + { + dblin[i] = (double) in[i] ; + } + + dinverma ( dblin, dblout, leadDimIn ); + + + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ ) + { + out[i] =(float) dblout[i] ; + + } + + free ( dblin); + free ( dblout); + +} diff --git a/src/c/matrixOperations/inversion/u8inverma.c b/src/c/matrixOperations/inversion/u8inverma.c new file mode 100644 index 00000000..2fab6597 --- /dev/null +++ b/src/c/matrixOperations/inversion/u8inverma.c @@ -0,0 +1,55 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include <stdlib.h> +#include "matrixInversion.h" +#include "lapack.h" + +void u8inverma ( uint8* in, float* out, int leadDimIn ) +{ + + int i = 0 ; + /* these 3 variable are created to permit to use the value in the fortran functions + because they need double matrix as arguments and we can't cast directly the pointers + without having problems , i know that's ugly */ + double *dblin = NULL; + double *dblout = NULL; + + + + /* Array allocations*/ + dblin = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + dblout = (double*)malloc(sizeof(double) * (unsigned int)(leadDimIn * leadDimIn)); + + + + /*copy and cast all the float value into double value */ + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i ++ ) + { + dblin[i] = (double) in[i] ; + } + + dinverma ( dblin, dblout, leadDimIn ); + + + for ( i = 0 ; i < (leadDimIn * leadDimIn) ; i++ ) + { + out[i] =(float) dblout[i] ; + + } + + free ( dblin); + free ( dblout); + +} diff --git a/src/c/matrixOperations/kron/dkrona.c b/src/c/matrixOperations/kron/dkrona.c new file mode 100644 index 00000000..31e0a52e --- /dev/null +++ b/src/c/matrixOperations/kron/dkrona.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for kroneker product of two matrices*/ + +#include "kron.h" + +void dkrona (double *in1, int row1, int col1, double *in2, int row2, \ + int col2, double *out) +{ + int row1_count, col1_count,row2_count, col2_count; + int row = row1*row2; + int temp = 0; + + for(col1_count = 0;col1_count < col1; col1_count++) + { + for(row1_count = 0;row1_count < row1; row1_count++) + { + for(col2_count = 0;col2_count < col2; col2_count++) + { + for(row2_count = 0;row2_count < row2; row2_count++) + { + temp = (col1_count*col2+col2_count)*row+(row1_count*row2+row2_count); + out[temp] = in1[col1_count*row1+row1_count]*in2[col2_count*row2+row2_count]; + } + } + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/kron/skrona.c b/src/c/matrixOperations/kron/skrona.c new file mode 100644 index 00000000..1e0daaf1 --- /dev/null +++ b/src/c/matrixOperations/kron/skrona.c @@ -0,0 +1,39 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function for kroneker product of two matrices*/ + +#include "kron.h" + +void skrona (float *in1, int row1, int col1, float *in2, int row2, \ + int col2, float *out) +{ + int row1_count, col1_count,row2_count, col2_count; + int row = row1*row2; + int temp = 0; + + for(col1_count = 0;col1_count < col1; col1_count++) + { + for(row1_count = 0;row1_count < row1; row1_count++) + { + for(col2_count = 0;col2_count < col2; col2_count++) + { + for(row2_count = 0;row2_count < row2; row2_count++) + { + temp = (col1_count*col2+col2_count)*row+(row1_count*row2+row2_count); + out[temp] = in1[col1_count*row1+row1_count]*in2[col2_count*row2+row2_count]; + } + } + } + } + +}
\ No newline at end of file diff --git a/src/c/matrixOperations/magnitude/i16magna.c b/src/c/matrixOperations/magnitude/i16magna.c new file mode 100644 index 00000000..193d2377 --- /dev/null +++ b/src/c/matrixOperations/magnitude/i16magna.c @@ -0,0 +1,43 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#include "matrixMagnitude.h" + +int16 i16magna(int16* in, int rows, int cols){ + int i=0,j=0; + int16 out=0, colSum=0; + + /* Other method : + drowsuma(in,rows,cols,temp); + out=max(temp,cols); + but we have to malloc a array */ + + if ((rows==1)||(cols==1)){ + for(i=0;i<cols*rows;i++){ + out += dmagns(in[i]); + } + } + else{ + for(i=0;i<cols;i++){ + colSum = 0; + for(j=0;j<rows;j++){ + colSum += dmagns(in[i*rows+j]); + } + if (colSum>out) out=colSum; + } + } + return out; +} + + diff --git a/src/c/matrixOperations/magnitude/i16magns.c b/src/c/matrixOperations/magnitude/i16magns.c new file mode 100644 index 00000000..44800ca6 --- /dev/null +++ b/src/c/matrixOperations/magnitude/i16magns.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#include "matrixMagnitude.h" +#include "abs.h" + +int16 i16magns(int16 in){ + return i16abss(in); +} + + diff --git a/src/c/matrixOperations/magnitude/i8magna.c b/src/c/matrixOperations/magnitude/i8magna.c new file mode 100644 index 00000000..8de96b74 --- /dev/null +++ b/src/c/matrixOperations/magnitude/i8magna.c @@ -0,0 +1,43 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#include "matrixMagnitude.h" + +int8 i8magna(int8* in, int rows, int cols){ + int i=0,j=0; + int8 out=0, colSum=0; + + /* Other method : + drowsuma(in,rows,cols,temp); + out=max(temp,cols); + but we have to malloc a array */ + + if ((rows==1)||(cols==1)){ + for(i=0;i<cols*rows;i++){ + out += dmagns(in[i]); + } + } + else{ + for(i=0;i<cols;i++){ + colSum = 0; + for(j=0;j<rows;j++){ + colSum += dmagns(in[i*rows+j]); + } + if (colSum>out) out=colSum; + } + } + return out; +} + + diff --git a/src/c/matrixOperations/magnitude/i8magns.c b/src/c/matrixOperations/magnitude/i8magns.c new file mode 100644 index 00000000..a13ae3d6 --- /dev/null +++ b/src/c/matrixOperations/magnitude/i8magns.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#include "matrixMagnitude.h" +#include "abs.h" + +int8 i8magns(int8 in){ + return i8abss(in); +} + + diff --git a/src/c/matrixOperations/magnitude/u16magna.c b/src/c/matrixOperations/magnitude/u16magna.c new file mode 100644 index 00000000..10680c77 --- /dev/null +++ b/src/c/matrixOperations/magnitude/u16magna.c @@ -0,0 +1,33 @@ +/* SCilab2C FOSSEE IIT BOMBAY */ + + + +#include "matrixMagnitude.h" + +uint16 u16magna(uint16* in, int rows, int cols){ + int i=0,j=0; + uint16 out=0, colSum=0; + + /* Other method : + drowsuma(in,rows,cols,temp); + out=max(temp,cols); + but we have to malloc a array */ + + if ((rows==1)||(cols==1)){ + for(i=0;i<cols*rows;i++){ + out += dmagns(in[i]); + } + } + else{ + for(i=0;i<cols;i++){ + colSum = 0; + for(j=0;j<rows;j++){ + colSum += dmagns(in[i*rows+j]); + } + if (colSum>out) out=colSum; + } + } + return out; +} + + diff --git a/src/c/matrixOperations/magnitude/u16magns.c b/src/c/matrixOperations/magnitude/u16magns.c new file mode 100644 index 00000000..78853edc --- /dev/null +++ b/src/c/matrixOperations/magnitude/u16magns.c @@ -0,0 +1,13 @@ + +/* SCilab2C FOSSEE IIT BOMBAY */ + + + +#include "matrixMagnitude.h" +#include "abs.h" + +uint16 u16magns(uint16 in){ + return u16abss(in); +} + + diff --git a/src/c/matrixOperations/magnitude/u8magna.c b/src/c/matrixOperations/magnitude/u8magna.c new file mode 100644 index 00000000..7f5df582 --- /dev/null +++ b/src/c/matrixOperations/magnitude/u8magna.c @@ -0,0 +1,33 @@ +/* SCilab2C FOSSEE IIT BOMBAY */ + + + +#include "matrixMagnitude.h" + +uint8 u8magna(uint8* in, int rows, int cols){ + int i=0,j=0; + uint8 out=0, colSum=0; + + /* Other method : + drowsuma(in,rows,cols,temp); + out=max(temp,cols); + but we have to malloc a array */ + + if ((rows==1)||(cols==1)){ + for(i=0;i<cols*rows;i++){ + out += dmagns(in[i]); + } + } + else{ + for(i=0;i<cols;i++){ + colSum = 0; + for(j=0;j<rows;j++){ + colSum += dmagns(in[i*rows+j]); + } + if (colSum>out) out=colSum; + } + } + return out; +} + + diff --git a/src/c/matrixOperations/magnitude/u8magns.c b/src/c/matrixOperations/magnitude/u8magns.c new file mode 100644 index 00000000..e6d789ca --- /dev/null +++ b/src/c/matrixOperations/magnitude/u8magns.c @@ -0,0 +1,13 @@ + +/* SCilab2C FOSSEE IIT BOMBAY */ + + + +#include "matrixMagnitude.h" +#include "abs.h" + +uint8 u8magns(uint8 in){ + return u8abss(in); +} + + diff --git a/src/c/matrixOperations/matrix/dmatrixa.c b/src/c/matrixOperations/matrix/dmatrixa.c new file mode 100644 index 00000000..649dbc34 --- /dev/null +++ b/src/c/matrixOperations/matrix/dmatrixa.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "matrix.h" +#include "types.h" +#include "uint16.h" + +void dmatrixa(double *in, int irow, int icolumn, int orow, int ocolumn ,double *out) +{ + int i; + if(irow*icolumn==orow*ocolumn) + { + for(i=0;i<irow*icolumn ; i++) + { + out[i]=in[i]; + } + } + else + { + printf("The given dimensions are not valid for matrix reshaping"); + } +} diff --git a/src/c/matrixOperations/matrix/smatrixa.c b/src/c/matrixOperations/matrix/smatrixa.c new file mode 100644 index 00000000..f432023a --- /dev/null +++ b/src/c/matrixOperations/matrix/smatrixa.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "matrix.h" +#include "types.h" +#include "uint16.h" + +void smatrixa(float *in, int irow, int icolumn, int orow, int ocolumn ,float *out) +{ + int i; + if(irow*icolumn==orow*ocolumn) + { + for(i=0;i<irow*icolumn ; i++) + { + out[i]=in[i]; + } + } + else + { + printf("The given dimensions are not valid for matrix reshaping"); + } +} diff --git a/src/c/matrixOperations/matrix/u16matrixa.c b/src/c/matrixOperations/matrix/u16matrixa.c new file mode 100644 index 00000000..e60d880d --- /dev/null +++ b/src/c/matrixOperations/matrix/u16matrixa.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "matrix.h" +#include "types.h" +#include "uint16.h" + +void u16matrixa(uint16 *in, int irow, int icolumn, int orow, int ocolumn ,uint16 *out) +{ + int i; + if(irow*icolumn==orow*ocolumn) + { + for(i=0;i<irow*icolumn ; i++) + { + out[i]=in[i]; + } + } + else + { + printf("The given dimensions are not valid for matrix reshaping"); + } +} diff --git a/src/c/matrixOperations/matrix/zmatrixa.c b/src/c/matrixOperations/matrix/zmatrixa.c new file mode 100644 index 00000000..5e5651b1 --- /dev/null +++ b/src/c/matrixOperations/matrix/zmatrixa.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "matrix.h" +#include "types.h" +#include "doubleComplex.h" + +void zmatrixa(doubleComplex *in, int irow, int icolumn, int orow, int ocolumn ,doubleComplex *out) +{ + int i; + if(irow*icolumn==orow*ocolumn) + { + for(i=0;i<irow*icolumn ; i++) + { + out[i]=in[i]; + } + } + else + { + printf("The given dimensions are not valid for matrix reshaping"); + } +} diff --git a/src/c/matrixOperations/multiplication/i16mulma.c b/src/c/matrixOperations/multiplication/i16mulma.c new file mode 100644 index 00000000..ba46e8e6 --- /dev/null +++ b/src/c/matrixOperations/multiplication/i16mulma.c @@ -0,0 +1,54 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +** \brief Compute a multiplication for int16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + +/* dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed*/ + +#include "matrixMultiplication.h" + +void i16mulma(int16 *in1,int lines1,int columns1, + int16 *in2,int lines2,int columns2, + int16 *out) +{ + + /* Do Not Use Any BLAS Function*/ + int i = 0; + int k = 0; + int16 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} diff --git a/src/c/matrixOperations/multiplication/i8mulma.c b/src/c/matrixOperations/multiplication/i8mulma.c new file mode 100644 index 00000000..88f192d7 --- /dev/null +++ b/src/c/matrixOperations/multiplication/i8mulma.c @@ -0,0 +1,54 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +** \brief Compute a multiplication for int8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + +/* dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed*/ + +#include "matrixMultiplication.h" + +void i8mulma(int8 *in1,int lines1,int columns1, + int8 *in2,int lines2,int columns2, + int8 *out) +{ + + /* Do Not Use Any BLAS Function*/ + int i = 0; + int k = 0; + int8 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} diff --git a/src/c/matrixOperations/multiplication/u16mulma.c b/src/c/matrixOperations/multiplication/u16mulma.c new file mode 100644 index 00000000..b15d8441 --- /dev/null +++ b/src/c/matrixOperations/multiplication/u16mulma.c @@ -0,0 +1,54 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +** \brief Compute a multiplication for uint16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + +/* dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed*/ + +#include "matrixMultiplication.h" + +void u16mulma(uint16 *in1,int lines1,int columns1, + uint16 *in2,int lines2,int columns2, + uint16 *out) +{ + + /* Do Not Use Any BLAS Function*/ + int i = 0; + int k = 0; + uint16 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} diff --git a/src/c/matrixOperations/multiplication/u8mulma.c b/src/c/matrixOperations/multiplication/u8mulma.c new file mode 100644 index 00000000..fa4f8518 --- /dev/null +++ b/src/c/matrixOperations/multiplication/u8mulma.c @@ -0,0 +1,54 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* +** \brief Compute a multiplication for uint8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ + + +/* dgemm function of lapack library does not support uint8,uint16,int8 and int16 datatype so removed*/ + +#include "matrixMultiplication.h" + +void u8mulma(uint8 *in1,int lines1,int columns1, + uint8 *in2,int lines2,int columns2, + uint8 *out) +{ + + int i = 0; + int k = 0; + uint8 accu = 0; + + /* How to convert 2 index matrixes to one. + ** #define in1(a,b) in1[a+b*lines1] + ** #define in2(c,d) in2[c+d*lines2] + */ + for(i=0;i < lines1 * columns2; ++i) + { + accu = 0; + for(k=0;k < columns1; ++k) + { + accu += in1[i % lines1 + k * lines1] * in2[k + (i / lines1) * lines2]; + + } + out[i] = accu; + + } + +} diff --git a/src/c/matrixOperations/ndgrid/dndgrida.c b/src/c/matrixOperations/ndgrid/dndgrida.c new file mode 100644 index 00000000..d0c1ee0a --- /dev/null +++ b/src/c/matrixOperations/ndgrid/dndgrida.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ndgrid.h" + +void dndgrida(double* inp1, int size1, double* inp2, int size2, double* out1, double* out2) +{ + for(int i = 0; i < size2; i++) + { + for(int j = 0; j < size1; j++) + out1[j + i*size1] = inp1[j]; + } + + for(int i = 0; i < size2; i++) + { + for(int j = 0; j < size1; j++) + out2[j + i*size1] = inp2[i]; + } +} diff --git a/src/c/matrixOperations/ndgrid/sndgrida.c b/src/c/matrixOperations/ndgrid/sndgrida.c new file mode 100644 index 00000000..355d85e9 --- /dev/null +++ b/src/c/matrixOperations/ndgrid/sndgrida.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ndgrid.h" + +void sndgrida(float* inp1, int size1, float* inp2, int size2, float* out1, float* out2) +{ + for(int i = 0; i < size2; i++) + { + for(int j = 0; j < size1; j++) + out1[j + i*size1] = inp1[j]; + } + + for(int i = 0; i < size2; i++) + { + for(int j = 0; j < size1; j++) + out2[j + i*size1] = inp2[i]; + } + +} diff --git a/src/c/matrixOperations/ndgrid/zndgrida.c b/src/c/matrixOperations/ndgrid/zndgrida.c new file mode 100644 index 00000000..28360e20 --- /dev/null +++ b/src/c/matrixOperations/ndgrid/zndgrida.c @@ -0,0 +1,39 @@ +/* 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 "ndgrid.h" +#include "doubleComplex.h" + +void zndgrida(doubleComplex* inp1, int size1, doubleComplex* inp2, int size2, doubleComplex* out1, doubleComplex* out2) +{ + for(int i = 0; i < size2; i++) + { + for(int j = 0; j < size1; j++) + { + (out1[j + i*size1]) = (inp1[j]); + (out1[j + i*size1]) = (inp1[j]); + } + } + + for(int i = 0; i < size2; i++) + { + for(int j = 0; j < size1; j++) + { + (out2[j + i*size1]) = (inp2[i]); + (out2[j + i*size1]) = (inp2[i]); + } + } + +} diff --git a/src/c/matrixOperations/nnz/dnnza.c b/src/c/matrixOperations/nnz/dnnza.c new file mode 100644 index 00000000..b4d40bd8 --- /dev/null +++ b/src/c/matrixOperations/nnz/dnnza.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 dnnza(double *in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if( in[i] != 0) + { + final++; + + } + + } +return final; +} diff --git a/src/c/matrixOperations/nnz/dnnzs.c b/src/c/matrixOperations/nnz/dnnzs.c new file mode 100644 index 00000000..c878d331 --- /dev/null +++ b/src/c/matrixOperations/nnz/dnnzs.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 dnnzs(double in) +{ + if(in !=0) + return 1; + else + return 0; +} diff --git a/src/c/matrixOperations/nnz/snnza.c b/src/c/matrixOperations/nnz/snnza.c new file mode 100644 index 00000000..df27f0fe --- /dev/null +++ b/src/c/matrixOperations/nnz/snnza.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 snnza(float*in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if( in[i] != 0) + { + final++; + + } + + } +return final; +} diff --git a/src/c/matrixOperations/nnz/snnzs.c b/src/c/matrixOperations/nnz/snnzs.c new file mode 100644 index 00000000..674d4fac --- /dev/null +++ b/src/c/matrixOperations/nnz/snnzs.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" + +uint16 snnzs(float in) +{ + if(in !=0) + return 1; + else + return 0; +} diff --git a/src/c/matrixOperations/nnz/znnza.c b/src/c/matrixOperations/nnz/znnza.c new file mode 100644 index 00000000..3b913e8b --- /dev/null +++ b/src/c/matrixOperations/nnz/znnza.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +uint16 znnza(doubleComplex* in, int irow, int icolumn) +{ + int i; + uint16 final=0; + for(i=0; i< irow*icolumn ; i++) + { + if(( zreals(in[i]) !=0 )||( zimags(in[i])!=0)) + { + final++; + + } + + } +return final; +} diff --git a/src/c/matrixOperations/nnz/znnzs.c b/src/c/matrixOperations/nnz/znnzs.c new file mode 100644 index 00000000..2907afcf --- /dev/null +++ b/src/c/matrixOperations/nnz/znnzs.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "nnz.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +uint16 znnzs(doubleComplex in) +{ + if((zreals(in)== 0 ) && (zimags(in)==0)) + return 0; + else + return 1; +} diff --git a/src/c/matrixOperations/norm/dnorma.c b/src/c/matrixOperations/norm/dnorma.c new file mode 100644 index 00000000..2bb9b8b7 --- /dev/null +++ b/src/c/matrixOperations/norm/dnorma.c @@ -0,0 +1,80 @@ + /* 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: Siddhesh Wani + + Edited by: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + + /*This function calculates norms for matrices*/ + /*Acceptable norms are: 1, 2, 'inf', 'fro', */ + +#include "norm.h" +#include "svd.h" +#include <math.h> +#include <stdio.h> +#include<stdlib.h> + +double dnorma (double *in, int row, int col, int norm) +{ + double res = 0, sum = 0; + int col_count, row_count; + double *S; + S = (double *)malloc(min(row,col)*sizeof(double)); + switch (norm) + { + case 1: /*largest column sum*/ + for(col_count = 0; col_count < col; col_count++) + { + sum = 0; + for(row_count = 0; row_count < row; row_count++) + { + sum += in[col_count*row+row_count]; + } + if (sum >= res) + res = sum; + } + break; + + case 2: /*Largest singular value of the matrix*/ + dsvda(0,in,row,col,0,1,S,NULL,NULL); + res = S[0]; + break; + + case 3: /*inf: largest row sum*/ + + for(row_count = 0; row_count < row; row_count++) + { + sum = 0; + for(col_count = 0; col_count < col; col_count++) + { + sum += in[col_count*row + row_count]; + } + if(sum >= res) + res = sum; + } + break; + + case 4: /*Frobenius norm*/ + + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col; col_count++) + { + sum += in[col_count*row + row_count] * in[col_count*row + row_count]; + } + } + res = sqrt(sum); + + break; + } + + + return res; +} diff --git a/src/c/matrixOperations/norm/dnormv.c b/src/c/matrixOperations/norm/dnormv.c new file mode 100644 index 00000000..5d20d606 --- /dev/null +++ b/src/c/matrixOperations/norm/dnormv.c @@ -0,0 +1,60 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + + /*This function calculates norms for vectors (row or column)*/ + +#include "norm.h" +#include <math.h> + +double dnormv (double *in, int size, int norm) +{ + double sum = 0; + double res = 0; + int counter = 0; + + switch (norm) + { + case 0: + res = INFINITY; + break; + case 1: /*Addition of all elements*/ + for (counter=0; counter < size; counter++) + { + sum += in[counter]; + } + res = sum; + break; + case 2: /*Square root of addition of squares of all elements*/ + for (counter=0; counter < size; counter++) + { + sum += in[counter]*in[counter]; + } + res = sqrt(sum); + break; + case 3: /*Cube root of addition of cubes of all elements*/ + for (counter=0; counter < size; counter++) + { + sum += pow(in[counter],3); + } + res = cbrt(sum); + break; + default : /*Nth root of addition of all elements raised to n*/ + for (counter=0; counter < size; counter++) + { + sum += pow(in[counter],norm); + } + res = pow(sum, 1./norm); + break; + } + + return res; +}
\ No newline at end of file diff --git a/src/c/matrixOperations/norm/snorma.c b/src/c/matrixOperations/norm/snorma.c new file mode 100644 index 00000000..4bf2ccda --- /dev/null +++ b/src/c/matrixOperations/norm/snorma.c @@ -0,0 +1,72 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + + /*This function calculates norms for matrices*/ + /*Acceptable norms are: 1, 2, 'inf', 'fro', */ + +#include "norm.h" +#include <math.h> + +float dnorma (float *in, int row, int col, int norm) +{ + float res = 0, sum = 0; + int col_count, row_count; + + switch (norm) + { + case 1: /*largest column sum*/ + for(col_count = 0; col_count < col; col_count++) + { + sum = 0; + for(row_count = 0; row_count < row; row_count++) + { + sum += in[col_count*row+row_count]; + } + if (sum >= res) + res = sum; + } + break; + + case 2: /*Largest singular value of the matrix*/ + break; + + case 3: /*inf: largest row sum*/ + + for(row_count = 0; row_count < row; row_count++) + { + sum = 0; + for(col_count = 0; col_count < col; col_count++) + { + sum += in[col_count*row + row_count]; + } + if(sum >= res) + res = sum; + } + break; + + case 4: /*Frobenius norm*/ + + for(row_count = 0; row_count < row; row_count++) + { + for(col_count = 0; col_count < col; col_count++) + { + sum += in[col_count*row + row_count] * in[col_count*row + row_count]; + } + } + res = sqrt(sum); + + break; + } + + + return res; +}
\ No newline at end of file diff --git a/src/c/matrixOperations/norm/snormv.c b/src/c/matrixOperations/norm/snormv.c new file mode 100644 index 00000000..03e9ed66 --- /dev/null +++ b/src/c/matrixOperations/norm/snormv.c @@ -0,0 +1,60 @@ + /* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + + /*This function calculates norms for vectors (row or column)*/ + +#include "norm.h" +#include <math.h> + +float dnormv (float *in, int size, int norm) +{ + float sum = 0; + float res = 0; + int counter = 0; + + switch (norm) + { + case 0: + res = INFINITY; + break; + case 1: /*Addition of all elements*/ + for (counter=0; counter < size; counter++) + { + sum += in[counter]; + } + res = sum; + break; + case 2: /*Square root of addition of squares of all elements*/ + for (counter=0; counter < size; counter++) + { + sum += in[counter]*in[counter]; + } + res = sqrt(sum); + break; + case 3: /*Cube root of addition of cubes of all elements*/ + for (counter=0; counter < size; counter++) + { + sum += pow(in[counter],3); + } + res = cbrt(sum); + break; + default : /*Nth root of addition of all elements raised to n*/ + for (counter=0; counter < size; counter++) + { + sum += pow(in[counter],norm); + } + res = pow(sum, 1./norm); + break; + } + + return res; +}
\ No newline at end of file diff --git a/src/c/matrixOperations/ones/i16onesa.c b/src/c/matrixOperations/ones/i16onesa.c new file mode 100644 index 00000000..d8dee192 --- /dev/null +++ b/src/c/matrixOperations/ones/i16onesa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "ones.h" + +void i16onesa ( int16* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (int16)1 ; + + } + +} + + + diff --git a/src/c/matrixOperations/ones/i8onesa.c b/src/c/matrixOperations/ones/i8onesa.c new file mode 100644 index 00000000..11b48bf2 --- /dev/null +++ b/src/c/matrixOperations/ones/i8onesa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "ones.h" + +void i8onesa ( int8* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (int8)1 ; + + } + +} + + + diff --git a/src/c/matrixOperations/ones/u16onesa.c b/src/c/matrixOperations/ones/u16onesa.c new file mode 100644 index 00000000..e91b5a72 --- /dev/null +++ b/src/c/matrixOperations/ones/u16onesa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "ones.h" + +void u16onesa ( uint16* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (uint16)1 ; + + } + +} + + + diff --git a/src/c/matrixOperations/ones/u8onesa.c b/src/c/matrixOperations/ones/u8onesa.c new file mode 100644 index 00000000..be9a1bf3 --- /dev/null +++ b/src/c/matrixOperations/ones/u8onesa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "ones.h" + +void u8onesa ( uint8* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (uint8)1 ; + + } + +} + + + diff --git a/src/c/matrixOperations/pertrans/dpertransa.c b/src/c/matrixOperations/pertrans/dpertransa.c new file mode 100644 index 00000000..36b963ec --- /dev/null +++ b/src/c/matrixOperations/pertrans/dpertransa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +void dpertransa(double *in, int row, int col, double* out) +{ + + double middle[row*col]; + int j=0; + + dtransposea(in, row, col, middle); + + for(int i= row*col-1; i>=0; i=i-1) + { + + out[j]= middle[i]; + j=j+1; + + } + + + + +} diff --git a/src/c/matrixOperations/pertrans/dpertranss.c b/src/c/matrixOperations/pertrans/dpertranss.c new file mode 100644 index 00000000..10c2d036 --- /dev/null +++ b/src/c/matrixOperations/pertrans/dpertranss.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +double dpertranss(double in) +{ + + return in; + + +} diff --git a/src/c/matrixOperations/pertrans/spertransa.c b/src/c/matrixOperations/pertrans/spertransa.c new file mode 100644 index 00000000..4eba2f16 --- /dev/null +++ b/src/c/matrixOperations/pertrans/spertransa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +void spertransa(float *in, int row, int col, float* out) +{ + + float middle[row*col]; + int j=0; + + stransposea(in, row, col, middle); + + for(int i= row*col-1; i>=0; i=i-1) + { + + out[j]= middle[i]; + j=j+1; + + } + + + + +} diff --git a/src/c/matrixOperations/pertrans/spertranss.c b/src/c/matrixOperations/pertrans/spertranss.c new file mode 100644 index 00000000..694c2317 --- /dev/null +++ b/src/c/matrixOperations/pertrans/spertranss.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" + +float spertranss(float in) +{ + + return in; + + +} diff --git a/src/c/matrixOperations/pertrans/zpertransa.c b/src/c/matrixOperations/pertrans/zpertransa.c new file mode 100644 index 00000000..c52fdbc0 --- /dev/null +++ b/src/c/matrixOperations/pertrans/zpertransa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" +#include "doubleComplex.h" + +void zpertransa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + + doubleComplex middle[row*col]; + int j=0; + + ztransposea(in, row, col, middle); + + for(int i= row*col-1; i>=0; i=i-1) + { + + out[j]= middle[i]; + j=j+1; + + } + + + + +} diff --git a/src/c/matrixOperations/pertrans/zpertranss.c b/src/c/matrixOperations/pertrans/zpertranss.c new file mode 100644 index 00000000..73e6e618 --- /dev/null +++ b/src/c/matrixOperations/pertrans/zpertranss.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "pertrans.h" +#include "types.h" +#include "matrixTranspose.h" +#include "doubleComplex.h" + +doubleComplex zpertranss(doubleComplex in) +{ + + return in; + + +} diff --git a/src/c/matrixOperations/toeplitz/ctoeplitza.c b/src/c/matrixOperations/toeplitz/ctoeplitza.c new file mode 100644 index 00000000..56c3ef84 --- /dev/null +++ b/src/c/matrixOperations/toeplitz/ctoeplitza.c @@ -0,0 +1,36 @@ +#include <stdio.h> +#include "toeplitz.h" +#include "floatComplex.h" +#include "stdlib.h" +#include "string.h" +#include "cat.h" + +/*Function to build a Toeplitz Matrix for inputs of SingleComplex datatype*/ + +void ctoeplitza(floatComplex* inp1,int size1,floatComplex* inp2,int size2,floatComplex* oup) +{ + if ((creals(inp1[0])!=creals(inp2[0]))&&(cimags(inp1[0])!=cimags(inp2[0]))) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = FloatComplex(0,0); // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (creals(oup[i]) == 0 && cimags(oup[i]) == 0) + oup[i] = oup[i-size2-1]; + } +} + + diff --git a/src/c/matrixOperations/toeplitz/dtoeplitza.c b/src/c/matrixOperations/toeplitz/dtoeplitza.c new file mode 100644 index 00000000..ef075a9a --- /dev/null +++ b/src/c/matrixOperations/toeplitz/dtoeplitza.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include "toeplitz.h" + + +/*Function to build a Toeplitz Matrix for inputs of Double datatype*/ + + +void dtoeplitza(double* inp1,int size1,double* inp2,int size2,double* oup) +{ + if (inp1[0]!=inp2[0]) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } +} + diff --git a/src/c/matrixOperations/toeplitz/gtoeplitza.c b/src/c/matrixOperations/toeplitz/gtoeplitza.c new file mode 100644 index 00000000..c852f92f --- /dev/null +++ b/src/c/matrixOperations/toeplitz/gtoeplitza.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include "toeplitz.h" + + +/*Function to build a Toeplitz Matrix for inputs of Character datatype*/ + + +void gtoeplitza(char* inp1,int size1,char* inp2,int size2,char* oup) +{ + if (inp1[0]!=inp2[0]) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } + +} + + diff --git a/src/c/matrixOperations/toeplitz/i16toeplitza.c b/src/c/matrixOperations/toeplitz/i16toeplitza.c new file mode 100644 index 00000000..945f626e --- /dev/null +++ b/src/c/matrixOperations/toeplitz/i16toeplitza.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include "toeplitz.h" +#include "int16.h" + +/*Function to build a Toeplitz Matrix for inputs of Signed Int16 datatype*/ + + +void i16toeplitza(int16* inp1,int size1,int16* inp2,int size2,int16* oup) +{ + if (inp1[0]!=inp2[0]) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } +} diff --git a/src/c/matrixOperations/toeplitz/i8toeplitza.c b/src/c/matrixOperations/toeplitz/i8toeplitza.c new file mode 100644 index 00000000..5075cc13 --- /dev/null +++ b/src/c/matrixOperations/toeplitz/i8toeplitza.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include "toeplitz.h" +#include "int8.h" + + +/*Function to build a Toeplitz Matrix for inputs of Signed Int8 datatype*/ + + +void i8toeplitza(int8* inp1,int size1,int8* inp2,int size2,int8* oup) +{ + if (inp1[0]!=inp2[0]) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } +} diff --git a/src/c/matrixOperations/toeplitz/stoeplitza.c b/src/c/matrixOperations/toeplitz/stoeplitza.c new file mode 100644 index 00000000..11d91ce1 --- /dev/null +++ b/src/c/matrixOperations/toeplitz/stoeplitza.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include "toeplitz.h" + + +/*Function to build a Toeplitz Matrix for inputs of Float datatype*/ + + +void stoeplitza(float* inp1,int size1,float* inp2,int size2,float* oup) +{ + if (inp1[0]!=inp2[0]) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } +} diff --git a/src/c/matrixOperations/toeplitz/u16toeplitza.c b/src/c/matrixOperations/toeplitz/u16toeplitza.c new file mode 100644 index 00000000..8dab5452 --- /dev/null +++ b/src/c/matrixOperations/toeplitz/u16toeplitza.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include "toeplitz.h" +#include "uint16.h" + + +/*Function to build a Toeplitz Matrix for inputs of Unsigned Int16 datatype*/ + + +void u16toeplitza(uint16* inp1,int size1,uint16* inp2,int size2,uint16* oup) +{ + if (inp1[0]!=inp2[0]) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } +} diff --git a/src/c/matrixOperations/toeplitz/u8toeplitza.c b/src/c/matrixOperations/toeplitz/u8toeplitza.c new file mode 100644 index 00000000..8301fc16 --- /dev/null +++ b/src/c/matrixOperations/toeplitz/u8toeplitza.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include "toeplitz.h" +#include "uint8.h" + + +/*Function to build a Toeplitz Matrix for inputs of Unsigned Int8 datatype*/ + + +void u8toeplitza(uint8* inp1,int size1,uint8* inp2,int size2,uint8* oup) +{ + if (inp1[0]!=inp2[0]) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } +} diff --git a/src/c/matrixOperations/toeplitz/ztoeplitza.c b/src/c/matrixOperations/toeplitz/ztoeplitza.c new file mode 100644 index 00000000..117f8189 --- /dev/null +++ b/src/c/matrixOperations/toeplitz/ztoeplitza.c @@ -0,0 +1,36 @@ +#include <stdio.h> +#include "toeplitz.h" +#include "doubleComplex.h" +#include "stdlib.h" +#include "string.h" +#include "cat.h" + + +/*Function to build a Toeplitz Matrix for inputs of DoubleComplex datatype*/ + + +void ztoeplitza(doubleComplex* inp1,int size1,doubleComplex* inp2,int size2,doubleComplex* oup) +{ + if ((zreals(inp1[0])!=zreals(inp2[0]))&&(zimags(inp1[0])!=zimags(inp2[0]))) + { + printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. + return; + } + int i, j; + + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + + for (i = 0; i<size1; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (zreals(oup[i]) == 0 && zimags(oup[i]) == 0) + oup[i] = oup[i-size2-1]; + } +} diff --git a/src/c/matrixOperations/trace/i16tracea.c b/src/c/matrixOperations/trace/i16tracea.c new file mode 100644 index 00000000..3aeec4e1 --- /dev/null +++ b/src/c/matrixOperations/trace/i16tracea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTrace.h" + +int16 i16tracea ( int16* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + int16 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (int16)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/i8tracea.c b/src/c/matrixOperations/trace/i8tracea.c new file mode 100644 index 00000000..9158ba45 --- /dev/null +++ b/src/c/matrixOperations/trace/i8tracea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTrace.h" + +int8 i8tracea ( int8* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + int8 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (int8)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/u16tracea.c b/src/c/matrixOperations/trace/u16tracea.c new file mode 100644 index 00000000..2a85fa30 --- /dev/null +++ b/src/c/matrixOperations/trace/u16tracea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTrace.h" + +uint16 u16tracea ( uint16* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + uint16 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (uint16)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/u8tracea.c b/src/c/matrixOperations/trace/u8tracea.c new file mode 100644 index 00000000..2823f6d4 --- /dev/null +++ b/src/c/matrixOperations/trace/u8tracea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTrace.h" + +uint8 u8tracea ( uint8* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + uint8 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (uint8)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/transpose/i16transposea.c b/src/c/matrixOperations/transpose/i16transposea.c new file mode 100644 index 00000000..e370c636 --- /dev/null +++ b/src/c/matrixOperations/transpose/i16transposea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTranspose.h" + +void i16transposea ( int16* in , int lines , int columns, int16* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (int16)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/i8transposea.c b/src/c/matrixOperations/transpose/i8transposea.c new file mode 100644 index 00000000..a05ee064 --- /dev/null +++ b/src/c/matrixOperations/transpose/i8transposea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTranspose.h" + +void i8transposea ( int8* in , int lines , int columns, int8* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (int8)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/u16transposea.c b/src/c/matrixOperations/transpose/u16transposea.c new file mode 100644 index 00000000..8bf659df --- /dev/null +++ b/src/c/matrixOperations/transpose/u16transposea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTranspose.h" + +void u16transposea ( uint16* in , int lines , int columns, uint16* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (uint16)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/u8transposea.c b/src/c/matrixOperations/transpose/u8transposea.c new file mode 100644 index 00000000..54b53324 --- /dev/null +++ b/src/c/matrixOperations/transpose/u8transposea.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "matrixTranspose.h" + +void u8transposea ( uint8* in , int lines , int columns, uint8* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (uint8)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/tril/dtrila.c b/src/c/matrixOperations/tril/dtrila.c new file mode 100644 index 00000000..b45c85fb --- /dev/null +++ b/src/c/matrixOperations/tril/dtrila.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "tril.h" + +void dtrila (double *in, int row, int column, double diag, double *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) >= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/tril/i16trila.c b/src/c/matrixOperations/tril/i16trila.c new file mode 100644 index 00000000..98174d90 --- /dev/null +++ b/src/c/matrixOperations/tril/i16trila.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "tril.h" + +void i16trila (int16 *in, int row, int column, double diag, int16 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) >= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/tril/i8trila.c b/src/c/matrixOperations/tril/i8trila.c new file mode 100644 index 00000000..d06b2aad --- /dev/null +++ b/src/c/matrixOperations/tril/i8trila.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "tril.h" + +void i8trila (int8 *in, int row, int column, double diag, int8 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) >= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/tril/strila.c b/src/c/matrixOperations/tril/strila.c new file mode 100644 index 00000000..bc7f1f2f --- /dev/null +++ b/src/c/matrixOperations/tril/strila.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "tril.h" + +void strila (float *in, int row, int column, double diag, float *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) >= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/tril/u16trila.c b/src/c/matrixOperations/tril/u16trila.c new file mode 100644 index 00000000..418a595e --- /dev/null +++ b/src/c/matrixOperations/tril/u16trila.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "tril.h" + +void u16trila (uint16 *in, int row, int column, double diag, uint16 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) >= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/tril/u8trila.c b/src/c/matrixOperations/tril/u8trila.c new file mode 100644 index 00000000..5c21d88e --- /dev/null +++ b/src/c/matrixOperations/tril/u8trila.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "tril.h" + +void u8trila (uint8 *in, int row, int column, double diag, uint8 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) >= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/triu/dtriua.c b/src/c/matrixOperations/triu/dtriua.c new file mode 100644 index 00000000..80db14b3 --- /dev/null +++ b/src/c/matrixOperations/triu/dtriua.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "triu.h" + +void dtriua (double *in, int row, int column, double diag, double *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) <= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/triu/i16triua.c b/src/c/matrixOperations/triu/i16triua.c new file mode 100644 index 00000000..a4a0e9f3 --- /dev/null +++ b/src/c/matrixOperations/triu/i16triua.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "triu.h" + +void i16triua (int16 *in, int row, int column, double diag, int16 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) <= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/triu/i8triua.c b/src/c/matrixOperations/triu/i8triua.c new file mode 100644 index 00000000..c5dcee5d --- /dev/null +++ b/src/c/matrixOperations/triu/i8triua.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "triu.h" + +void i8triua (int8 *in, int row, int column, double diag, int8 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) <= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/triu/striua.c b/src/c/matrixOperations/triu/striua.c new file mode 100644 index 00000000..8ec779ea --- /dev/null +++ b/src/c/matrixOperations/triu/striua.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "triu.h" + +void striua (float *in, int row, int column, double diag, float *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) <= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/triu/u16triua.c b/src/c/matrixOperations/triu/u16triua.c new file mode 100644 index 00000000..6341881b --- /dev/null +++ b/src/c/matrixOperations/triu/u16triua.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + +#include "triu.h" + +void u16triua (uint16 *in, int row, int column, double diag, uint16 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) <= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/triu/u8triua.c b/src/c/matrixOperations/triu/u8triua.c new file mode 100644 index 00000000..4637e873 --- /dev/null +++ b/src/c/matrixOperations/triu/u8triua.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function to extract lower triagular entries from given matrix*/ + + +#include "triu.h" + +void u8triua (uint8 *in, int row, int column, double diag, uint8 *out) +{ + int row_counter, col_counter = 0; + + for(row_counter=0; row_counter < row; row_counter++) + { + for(col_counter=0; col_counter < column; col_counter++) + { + if((double)(row_counter + diag) <= (double)col_counter) + { + out[col_counter*row+row_counter] = in[col_counter*row+row_counter]; + } + else + { + out[col_counter*row+row_counter] = 0; + } + } + } +}
\ No newline at end of file diff --git a/src/c/matrixOperations/zeros/i16zerosa.c b/src/c/matrixOperations/zeros/i16zerosa.c new file mode 100644 index 00000000..13ff62b6 --- /dev/null +++ b/src/c/matrixOperations/zeros/i16zerosa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "zeros.h" + +void i16zerosa ( int16* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (int16)0 ; + + } + +} + + + diff --git a/src/c/matrixOperations/zeros/i8zerosa.c b/src/c/matrixOperations/zeros/i8zerosa.c new file mode 100644 index 00000000..f8808c0a --- /dev/null +++ b/src/c/matrixOperations/zeros/i8zerosa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "zeros.h" + +void i8zerosa ( int8* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (int8)0 ; + + } + +} + + + diff --git a/src/c/matrixOperations/zeros/u16zerosa.c b/src/c/matrixOperations/zeros/u16zerosa.c new file mode 100644 index 00000000..3db1ac5a --- /dev/null +++ b/src/c/matrixOperations/zeros/u16zerosa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "zeros.h" + +void u16zerosa ( uint16* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (uint16)0 ; + + } + +} + + + diff --git a/src/c/matrixOperations/zeros/u8zerosa.c b/src/c/matrixOperations/zeros/u8zerosa.c new file mode 100644 index 00000000..ee239a67 --- /dev/null +++ b/src/c/matrixOperations/zeros/u8zerosa.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "zeros.h" + +void u8zerosa ( uint8* in , int rows , int cols ) +{ + int i = 0 ; + + for ( i = 0 ; i < rows*cols ; i++) + { + in[i] = (uint8)0 ; + + } + +} + + + diff --git a/src/c/operations/addition/i16adda.c b/src/c/operations/addition/i16adda.c new file mode 100644 index 00000000..db85675a --- /dev/null +++ b/src/c/operations/addition/i16adda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void i16adda(int16* in1, int size1, int16* in2, int size2, int16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i16adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/i16adds.c b/src/c/operations/addition/i16adds.c new file mode 100644 index 00000000..88c927d4 --- /dev/null +++ b/src/c/operations/addition/i16adds.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +int16 i16adds(int16 in1, int16 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/i8adda.c b/src/c/operations/addition/i8adda.c new file mode 100644 index 00000000..5e556d35 --- /dev/null +++ b/src/c/operations/addition/i8adda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void i8adda(int8* in1, int size1, int8* in2, int size2, int8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i8adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/i8adds.c b/src/c/operations/addition/i8adds.c new file mode 100644 index 00000000..0520912b --- /dev/null +++ b/src/c/operations/addition/i8adds.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +int8 i8adds(int8 in1, int8 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/u16adda.c b/src/c/operations/addition/u16adda.c new file mode 100644 index 00000000..3884aa3c --- /dev/null +++ b/src/c/operations/addition/u16adda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void u16adda(uint16* in1, int size1, uint16* in2, int size2, uint16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u16adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/u16adds.c b/src/c/operations/addition/u16adds.c new file mode 100644 index 00000000..2d49e905 --- /dev/null +++ b/src/c/operations/addition/u16adds.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +uint16 u16adds(uint16 in1, uint16 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/u8adda.c b/src/c/operations/addition/u8adda.c new file mode 100644 index 00000000..01c7608b --- /dev/null +++ b/src/c/operations/addition/u8adda.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +void u8adda(uint8* in1, int size1, uint8* in2, int size2, uint8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u8adds(in1[i], in2[i]); + } +} diff --git a/src/c/operations/addition/u8adds.c b/src/c/operations/addition/u8adds.c new file mode 100644 index 00000000..ad258232 --- /dev/null +++ b/src/c/operations/addition/u8adds.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "addition.h" + +uint8 u8adds(uint8 in1, uint8 in2) +{ + return (in1 + in2); +} diff --git a/src/c/operations/addition/zadds.c b/src/c/operations/addition/zadds.c index d4a94dc5..768faf38 100644 --- a/src/c/operations/addition/zadds.c +++ b/src/c/operations/addition/zadds.c @@ -11,6 +11,7 @@ */ #include "addition.h" +#include "doubleComplex.h" doubleComplex zadds(doubleComplex z1, doubleComplex z2) { return DoubleComplex(zreals(z1) + zreals(z2), diff --git a/src/c/operations/division/cldiva.c b/src/c/operations/division/cldiva.c index 21d95e31..73b94f28 100644 --- a/src/c/operations/division/cldiva.c +++ b/src/c/operations/division/cldiva.c @@ -15,7 +15,8 @@ void cldiva (floatComplex* in1, floatComplex* in2, int size, floatComplex* out ){ int i=0; - for (i=0;i<size;i++){ + for (i=0;i<size;i++) + { out[i]=cldivs(in1[i],in2[i]); } } diff --git a/src/c/operations/division/crdiva.c b/src/c/operations/division/crdiva.c index 86676bd5..ea9781e8 100644 --- a/src/c/operations/division/crdiva.c +++ b/src/c/operations/division/crdiva.c @@ -15,7 +15,8 @@ void crdiva (floatComplex* in1, floatComplex* in2, int size, floatComplex* out ){ int i=0; - for (i=0;i<size;i++){ + for (i=0;i<size;i++) + { out[i]=crdivs(in1[i],in2[i]); } } diff --git a/src/c/operations/division/i16ldiva.c b/src/c/operations/division/i16ldiva.c new file mode 100644 index 00000000..4106acf1 --- /dev/null +++ b/src/c/operations/division/i16ldiva.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void i16ldiva (int16* in1, int16* in2, int size, int16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i16ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i16ldivs.c b/src/c/operations/division/i16ldivs.c new file mode 100644 index 00000000..d807e491 --- /dev/null +++ b/src/c/operations/division/i16ldivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int16 i16ldivs (int16 in1, int16 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/i16rdiva.c b/src/c/operations/division/i16rdiva.c new file mode 100644 index 00000000..149e8efb --- /dev/null +++ b/src/c/operations/division/i16rdiva.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void i16rdiva (int16* in1, int16* in2, int size, int16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i16rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i16rdivs.c b/src/c/operations/division/i16rdivs.c new file mode 100644 index 00000000..418e5704 --- /dev/null +++ b/src/c/operations/division/i16rdivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int16 i16rdivs (int16 in1, int16 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/i8ldiva.c b/src/c/operations/division/i8ldiva.c new file mode 100644 index 00000000..b7e0a7b9 --- /dev/null +++ b/src/c/operations/division/i8ldiva.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "division.h" + +void i8ldiva (int8* in1, int8* in2, int size, int8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i8ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i8ldivs.c b/src/c/operations/division/i8ldivs.c new file mode 100644 index 00000000..65b2ff89 --- /dev/null +++ b/src/c/operations/division/i8ldivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int8 i8ldivs (int8 in1, int8 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/i8rdiva.c b/src/c/operations/division/i8rdiva.c new file mode 100644 index 00000000..f3be2a03 --- /dev/null +++ b/src/c/operations/division/i8rdiva.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void i8rdiva (int8* in1, int8* in2, int size, int8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i8rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/i8rdivs.c b/src/c/operations/division/i8rdivs.c new file mode 100644 index 00000000..54e39554 --- /dev/null +++ b/src/c/operations/division/i8rdivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +int8 i8rdivs (int8 in1, int8 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/u16ldiva.c b/src/c/operations/division/u16ldiva.c new file mode 100644 index 00000000..bc24ab05 --- /dev/null +++ b/src/c/operations/division/u16ldiva.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u16ldiva (uint16* in1, uint16* in2, int size, uint16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u16ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u16ldivs.c b/src/c/operations/division/u16ldivs.c new file mode 100644 index 00000000..b1d85182 --- /dev/null +++ b/src/c/operations/division/u16ldivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint16 u16ldivs (uint16 in1, uint16 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/u16rdiva.c b/src/c/operations/division/u16rdiva.c new file mode 100644 index 00000000..a13deccb --- /dev/null +++ b/src/c/operations/division/u16rdiva.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u16rdiva (uint16* in1, uint16* in2, int size, uint16* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u16rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u16rdivs.c b/src/c/operations/division/u16rdivs.c new file mode 100644 index 00000000..d55c07f4 --- /dev/null +++ b/src/c/operations/division/u16rdivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint16 u16rdivs (uint16 in1, uint16 in2){ + return in1/in2; +} diff --git a/src/c/operations/division/u8ldiva.c b/src/c/operations/division/u8ldiva.c new file mode 100644 index 00000000..8dc948f9 --- /dev/null +++ b/src/c/operations/division/u8ldiva.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u8ldiva (uint8* in1, uint8* in2, int size, uint8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u8ldivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u8ldivs.c b/src/c/operations/division/u8ldivs.c new file mode 100644 index 00000000..bf16943f --- /dev/null +++ b/src/c/operations/division/u8ldivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint8 u8ldivs (uint8 in1, uint8 in2){ + return in2/in1; +} diff --git a/src/c/operations/division/u8rdiva.c b/src/c/operations/division/u8rdiva.c new file mode 100644 index 00000000..7ed7f9cc --- /dev/null +++ b/src/c/operations/division/u8rdiva.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + +void u8rdiva (uint8* in1, uint8* in2, int size, uint8* out ){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u8rdivs(in1[i],in2[i]); + } +} diff --git a/src/c/operations/division/u8rdivs.c b/src/c/operations/division/u8rdivs.c new file mode 100644 index 00000000..9d04ebfa --- /dev/null +++ b/src/c/operations/division/u8rdivs.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "division.h" + + +uint8 u8rdivs (uint8 in1, uint8 in2){ + return in1/in2; +} diff --git a/src/c/operations/includes/addition.h b/src/c/operations/includes/addition.h index d6f03381..fbf0177b 100644 --- a/src/c/operations/includes/addition.h +++ b/src/c/operations/includes/addition.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -108,6 +109,86 @@ EXTERN_OPERATIONS void zadda(doubleComplex *in1, int size1, doubleComplex *in2, int size2, doubleComplex *out); +/* +** \brief Compute an addition with uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint8 u8adds(uint8 in1, uint8 in2); + +/* +** \brief Compute an addition element wise for uint8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void u8adda(uint8 *in1, int size1, + uint8 *in2, int size2, + uint8 *out); + +/* +** \brief Compute an addition with int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int8 i8adds(int8 in1, int8 in2); + +/* +** \brief Compute an addition element wise for int8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void i8adda(int8 *in1, int size1, + int8 *in2, int size2, + int8 *out); + +/* +** \brief Compute an addition with uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint16 u16adds(uint16 in1, uint16 in2); + +/* +** \brief Compute an addition element wise for uint16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void u16adda(uint16 *in1, int size1, + uint16 *in2, int size2, + uint16 *out); + +/* +** \brief Compute an addition with int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int16 i16adds(int16 in1, int16 in2); + +/* +** \brief Compute an addition element wise for int16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the addition in1 + in2. +*/ +EXTERN_OPERATIONS void i16adda(int16 *in1, int size1, + int16 *in2, int size2, + int16 *out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/includes/division.h b/src/c/operations/includes/division.h index df4c5d2a..ac2d1482 100644 --- a/src/c/operations/includes/division.h +++ b/src/c/operations/includes/division.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -101,6 +102,80 @@ EXTERN_OPERATIONS doubleComplex zrdivs (doubleComplex in1, doubleComplex in2); */ EXTERN_OPERATIONS void zrdiva(doubleComplex* in1, doubleComplex* in2, int size, doubleComplex* out ); + +/* +** \brief Compute a right division element ways for uint8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void u8rdiva (uint8* in1, uint8* in2, int size, uint8* out ); + + + +/* +** \brief Compute a right division for uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return in1 / in2 = in1 ./ in2. +*/ + +EXTERN_OPERATIONS uint8 u8rdivs (uint8 in1, uint8 in2); + +/* +** \brief Compute a right division element ways for uint16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void u16rdiva (uint16* in1, uint16* in2, int size, uint16* out ); + + +/* +** \brief Compute a right division element ways for int8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void i8rdiva (int8* in1, int8* in2, int size, int8* out ); + +/* +** \brief Compute a right division for int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int8 i8rdivs (int8 in1, int8 in2); + +/* +** \brief Compute a right division for uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS uint16 u16rdivs (uint16 in1, uint16 in2); + +/* +** \brief Compute a right division for int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int16 i16rdivs (int16 in1, int16 in2); + +/* +** \brief Compute a right division element ways for int16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 ./ in2. +*/ +EXTERN_OPERATIONS void i16rdiva (int16* in1, int16* in2, int size, int16* out ); + + /* ** LEFT DIVISION */ @@ -173,6 +248,78 @@ EXTERN_OPERATIONS doubleComplex zldivs (doubleComplex in1, doubleComplex in2); */ EXTERN_OPERATIONS void zldiva(doubleComplex* in1, doubleComplex* in2, int size, doubleComplex* out ); +/* +** \brief Compute a left division element ways for uint8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void u8ldiva (uint8* in1, uint8* in2, int size, uint8* out ); + +/* +** \brief Compute a right division for uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS uint8 u8ldivs (uint8 in1, uint8 in2); + +/* +** \brief Compute a left division element ways for int8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void i8ldiva (int8* in1, int8* in2, int size, int8* out ); + +/* +** \brief Compute a right division for int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int8 i8ldivs (int8 in1, int8 in2); + +/* +** \brief Compute a left division element ways for uint16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void u16ldiva (uint16* in1, uint16* in2, int size, uint16* out ); + + +/* +** \brief Compute a right division for uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS uint16 u16ldivs (uint16 in1, uint16 in2); + +/* +** \brief Compute a left division element ways for int16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array = rows*columns. +** \param out : array that contains the division in1 .\ in2. +*/ +EXTERN_OPERATIONS void i16ldiva (int16* in1, int16* in2, int size, int16* out ); + + +/* +** \brief Compute a right division for int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return in1 / in2 = in1 ./ in2. +*/ +EXTERN_OPERATIONS int16 i16ldivs (int16 in1, int16 in2); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/includes/multiplication.h b/src/c/operations/includes/multiplication.h index 9931a9a9..32ea932b 100644 --- a/src/c/operations/includes/multiplication.h +++ b/src/c/operations/includes/multiplication.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -140,6 +141,111 @@ EXTERN_OPERATIONS doubleComplex zmulzdv(doubleComplex *in1, double *in2, int siz EXTERN_OPERATIONS doubleComplex zmuldzv(double *in1, doubleComplex *in2, int size2); +/* +** \brief Compute a multiplication element ways for uint8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void u8mula(uint8 *in1, uint8 *in2, int size,uint8 * out); + +/* +** \brief Compute a multiplication with uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS uint8 u8muls(uint8 in1, uint8 in2); + +/* +** \brief Compute a multiplication for uint8 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS uint8 u8mulv(uint8 *in1, uint8 *in2, int size2); + +/* +** \brief Compute a multiplication element ways for int8. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void i8mula(int8 *in1, int8 *in2, int size,int8 * out); + +/* +** \brief Compute a multiplication with int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS int8 i8muls(int8 in1, int8 in2); + +/* +** \brief Compute a multiplication for int8 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS int8 i8mulv(int8 *in1, int8 *in2, int size2); + +/* +** \brief Compute a multiplication element ways for uint16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void u16mula(uint16 *in1, uint16 *in2, int size,uint16 * out); + +/* +** \brief Compute a multiplication with uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS uint16 u16muls(uint16 in1, uint16 in2); + +/* +** \brief Compute a multiplication for uint16 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS uint16 u16mulv(uint16 *in1, uint16 *in2, int size2); + +/* +** \brief Compute a multiplication element ways for int16. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \param out : array that contains the multiplication = in1 .* in2. +*/ +EXTERN_OPERATIONS void i16mula(int16 *in1, int16 *in2, int size,int16 * out); + +/* +** \brief Compute a multiplication with int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return : in1 * in 2 = in1 .* in2. +*/ +EXTERN_OPERATIONS int16 i16muls(int16 in1, int16 in2); + +/* +** \brief Compute a multiplication for int16 arrays. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the multiplication of the two vectors = in1 .* in2. +*/ +EXTERN_OPERATIONS int16 i16mulv(int16 *in1, int16 *in2, int size2); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/includes/subtraction.h b/src/c/operations/includes/subtraction.h index 8571a5de..798df2bf 100644 --- a/src/c/operations/includes/subtraction.h +++ b/src/c/operations/includes/subtraction.h @@ -16,6 +16,7 @@ #include "dynlib_operations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -107,6 +108,88 @@ EXTERN_OPERATIONS void zdiffa(doubleComplex *in1, int size1, doubleComplex *in2, int size2, doubleComplex *out); + +/* +** \brief Compute a subtraction with uint8. +** \param in1 : input uint8. +** \param in2 : input uint8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint8 u8diffs(uint8 in1, uint8 in2); + +/* +** \brief Compute a subtraction element wise for uint8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void u8diffa(uint8 *in1, int size1, + uint8 *in2, int size2, + uint8 *out); + +/* +** \brief Compute a subtraction with int8. +** \param in1 : input int8. +** \param in2 : input int8. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int8 i8diffs(int8 in1, int8 in2); + +/* +** \brief Compute a subtraction element wise for int8. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void i8diffa(int8 *in1, int size1, + int8 *in2, int size2, + int8 *out); + + +/* +** \brief Compute a subtraction with uint16. +** \param in1 : input uint16. +** \param in2 : input uint16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS uint16 u16diffs(uint16 in1, uint16 in2); + +/* +** \brief Compute a subtraction element wise for uint16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void u16diffa(uint16 *in1, int size1, + uint16 *in2, int size2, + uint16 *out); + +/* +** \brief Compute a subtraction with int16. +** \param in1 : input int16. +** \param in2 : input int16. +** \return : in1 + in2 +*/ +EXTERN_OPERATIONS int16 i16diffs(int16 in1, int16 in2); + +/* +** \brief Compute a subtraction element wise for int16. +** \param in1 : input array. +** \param size1 : size of in1 array. +** \param in2 : input arry. +** \param size2 : size of in2 array. +** \param out : array that contains the subtraction in1 + in2. +*/ +EXTERN_OPERATIONS void i16diffa(int16 *in1, int size1, + int16 *in2, int size2, + int16 *out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/operations/interfaces/int_OpDotBackSlash.h b/src/c/operations/interfaces/int_OpDotBackSlash.h index 5ba1af3d..220da8db 100644 --- a/src/c/operations/interfaces/int_OpDotBackSlash.h +++ b/src/c/operations/interfaces/int_OpDotBackSlash.h @@ -25,6 +25,14 @@ #define z0z0OpDotBackSlashz0(in1,in2) zldivs(in1,in2) +#define u80u80OpDotBackSlashu80(in1,in2) u8ldivs(in1,in2) + +#define u160u160OpDotBackSlashu160(in1,in2) u16ldivs(in1,in2) + +#define i80i80OpDotBackSlashi80(in1,in2) i8ldivs(in1,in2) + +#define i160i160OpDotBackSlashi160(in1,in2) i16ldivs(in1,in2) + #define s0c0OpDotBackSlashc0(in1,in2) cldivs(FloatComplex(in1,0),in2) #define c0s0OpDotBackSlashc0(in1,in2) cldivs(in1,FloatComplex(in2,0)) @@ -48,6 +56,19 @@ #define z0z2OpDotBackSlashz2(in1,in2,size,out) {int i;\ for(i=0;i<size[0]*size[1];i++) out[i]= zldivs(in1,in2[i]);} +#define u80u82OpDotBackSlashu82(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u8ldivs(in1,in2[i]);} + +#define u160u162OpDotBackSlashu162(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u16ldivs(in1,in2[i]);} + +#define i80i82OpDotBackSlashi82(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i8ldivs(in1,in2[i]);} + +#define i160i162OpDotBackSlashi162(in1,in2,size,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i16ldivs(in1,in2[i]);} + + #define s0c2OpDotBackSlashc2(in1,in2,size,out) c0c2OpDotBackSlashc2(FloatComplex(in1,0),in2,size,out) #define d0z2OpDotBackSlashz2(in1,in2,size,out) z0z2OpDotBackSlashz2(DoubleComplex(in1,0),in2,size,out) @@ -73,6 +94,20 @@ #define z2z0OpDotBackSlashz2(in1,size,in2,out) {int i;\ for(i=0;i<size[0]*size[1];i++) out[i]= zldivs(in1[i],in2);} +#define u82u80OpDotBackSlashu82(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u8ldivs(in1[i],in2);} + +#define u162u160OpDotBackSlashu162(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= u16ldivs(in1[i],in2);} + +#define i82i80OpDotBackSlashi82(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i8ldivs(in1[i],in2);} + +#define i162i160OpDotBackSlashi162(in1,size,in2,out) {int i;\ + for(i=0;i<size[0]*size[1];i++) out[i]= i16ldivs(in1[i],in2);} + + + #define s2c0OpDotBackSlashc2(in1,size,in2,out) {int i;\ for(i=0;i<size[0]*size[1];i++) out[i]= cldivs(FloatComplex(in1[i],0),in2);} @@ -91,6 +126,15 @@ #define c2c2OpDotBackSlashc2(in1,size1,in2,size2,out) cldiva(in1,in2,size2[0]*size2[1],out) +#define u82u82OpDotBackSlashu82(in1,size1,in2,size2,out) u8ldiva(in1,in2,size2[0]*size2[1],out) + +#define u162u162OpDotBackSlashu162(in1,size1,in2,size2,out) u16ldiva(in1,in2,size2[0]*size2[1],out) + +#define i82i82OpDotBackSlashi82(in1,size1,in2,size2,out) i8ldiva(in1,in2,size2[0]*size2[1],out) + +#define i162i162OpDotBackSlashi162(in1,size1,in2,size2,out) i16ldiva(in1,in2,size2[0]*size2[1],out) + + #define c2s2OpDotBackSlashc2(in1,size1,in2,size2,out) {int i;\ for(i=0;i<size1[0]*size2[1];i++) out[i]= cldivs(in1[i],FloatComplex(in2[i], 0));} diff --git a/src/c/operations/interfaces/int_OpDotSlash.h b/src/c/operations/interfaces/int_OpDotSlash.h index a6c57051..54f0c3a2 100644 --- a/src/c/operations/interfaces/int_OpDotSlash.h +++ b/src/c/operations/interfaces/int_OpDotSlash.h @@ -25,6 +25,14 @@ #define z0z0OpDotSlashz0(in1,in2) zrdivs(in1,in2) +#define u80u80OpDotSlashu80(in1,in2) u8rdivs(in1,in2) + +#define u160u160OpDotSlashu160(in1,in2) u16rdivs(in1,in2) + +#define i80i80OpDotSlashi80(in1,in2) i8rdivs(in1,in2) + +#define i160i60OpDotSlashi60(in1,in2) i16divs(in1,in2) + #define s0c0OpDotSlashc0(in1,in2) crdivs(FloatComplex(in1,0),in2) #define c0s0OpDotSlashc0(in1,in2) crdivs(in1,FloatComplex(in2,0)) @@ -52,6 +60,19 @@ #define z0z2OpDotSlashz2(in1,in2,size,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=crdivs(in1,in2[i]);} +#define u80u82OpDotSlashu82(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define u160u162OpDotSlashu162(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i80i82OpDotSlashi82(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i160i162OpDotSlashi162(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + + #define s0c2OpDotSlashc2(in1,in2,size,out) c0c2OpDotSlashc2(FloatComplex(in1,0),in2,size,out) @@ -87,6 +108,19 @@ #define z2z0OpDotSlashz2(in1,size,in2,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=zrdivs(in1[i],in2);} +#define u82u80OpDotSlashu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + +#define u162u160OpDotSlashu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + +#define i82i80OpDotSlashi82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + +#define i162i160OpDotSlashi162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++ out[i]=in[i]/in2);} + + #define s2c0OpDotSlashc2(in1,size,in2,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=crdivs(FloatComplex(in1[i],0),in2);} @@ -113,6 +147,17 @@ #define z2z2OpDotSlashz2(in1,size1,in2,size2,out) zrdiva(in1,in2,size2[0]*size2[1],out) +#define u82u82OpDotSlashu82(in1,size1,in2,size2,out) u8rdiva(in1,in2,size2[0]*size2[1],out) + +#define u162u162OpDotSlashu162(in1,size1,in2,size2,out) u16rdiva(in1,in2,size2[0]*size2[1],out) + +#define i82i82OpDotSlashi82(in1,size1,in2,size2,out) i8rdiva(in1,in2,size2[0]*size2[1],out) + +#define i162i162OpDotSlashi162(in1,size1,in2,size2,out) i16rdiva(in1,in2,size2[0]*size2[1],out) + + + + #define c2s2OpDotSlashc2(in1,size1,in2,size2,out) {int i=0;\ for (i=0;i<size1[0]*size2[1];i++) out[i]=crdivs(in1[i],FloatComplex(in2[i],0));} diff --git a/src/c/operations/interfaces/int_OpDotStar.h b/src/c/operations/interfaces/int_OpDotStar.h index 22e09a92..4586e0c6 100644 --- a/src/c/operations/interfaces/int_OpDotStar.h +++ b/src/c/operations/interfaces/int_OpDotStar.h @@ -25,6 +25,14 @@ #define z0z0OpDotStarz0(in1,in2) zmuls(in1,in2) +#define u80u80OpDotStaru80(in1,in2) u8muls(in1,in2) + +#define u160u160OpDotStaru160(in1,in2) u16muls(in1,in2) + +#define i80i80OpDotStari80(in1,in2) i8muls(in1,in2) + +#define i160i60OpDotStari60(in1,in2) i16muls(in1,in2) + #define s0c0OpDotStarc0(in1,in2) cmuls(FloatComplex(in1,0),in2) #define c0s0OpDotStarc0(in1,in2) cmuls(in1,FloatComplex(in2,0)) @@ -48,6 +56,18 @@ #define z0z2OpDotStarz2(in1,in2,size,out) {int i=0;\ for(i=0;i<size[0]*size[1];i++) out[i]= zmuls(in1,in2[i]);} +#define u80u82OpDotStaru80(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u8muls(in1,in2[i]);} + +#define u160u162OpDotStaru160(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u16muls(in1,in2[i]);} + +#define i80i82OpDotStari80(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i8muls(in1,in2[i]);} + +#define i160i162OpDotStari160(in1,in2,size,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i16muls(in1,in2[i]);} + #define s0c2OpDotStarc2(in1,in2,size,out) c0c2OpDotStarc2(FloatComplex(in1,0),in2,size,out) #define d0z2OpDotStarz2(in1,in2,size,out) z0z2OpDotStarz2(DoubleComplex(in1,0),in2,size,out) @@ -73,6 +93,18 @@ #define z2z0OpDotStarz2(in1,size,in2,out) {int i=0;\ for(i=0;i<size[0]*size[1];i++) out[i]= zmuls(in1[i],in2);} +#define u82u80OpDotStaru82(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u8muls(in[i],in2);} + +#define u162u160OpDotStaru162(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = u16muls(in[i],in2);} + +#define i82i80OpDotStari82(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i8muls(in[i],in2);} + +#define i162i160OpDotStari162(in1,size,in2,out) {int i=0;\ + for(i=0;i<size[0]*size[1];i++) out[i] = i16muls(in[i],in2);} + #define s2c0OpDotStarc2(in1,size,in2,out) {int i=0;\ for(i=0;i<size[0]*size[1];i++) out[i]= cmuls(FloatComplex(in1[i],0),in2);} @@ -93,6 +125,14 @@ #define z2z2OpDotStarz2(in1,size1,in2,size2,out) zmula(in1,in2,size1[0]*size2[1],out) +#define u82u82OpDotStaru82(in1,size1,in2,size2,out) u8mula(in1,in2,size1[0]*size2[1],out) + +#define u162u162OpDotStaru162(in1,size1,in2,size2,out) u16mula(in1,in2,size1[0]*size2[1],out) + +#define i82i82OpDotStari82(in1,size1,in2,size2,out) i8mula(in1,in2,size1[0]*size2[1],out) + +#define i162i61OpDotStari162(in1,size1,in2,size2,out) i16mula(in1,in2,size1[0]*size2[1],out) + #define c2s2OpDotStarc2(in1,size1,in2,size2,out) {int i=0;\ for(i=0;i<size1[0]*size2[1];i++) out[i]= cmuls(in1[i],FloatComplex(in2[i],0));} diff --git a/src/c/operations/interfaces/int_OpLogAnd.h b/src/c/operations/interfaces/int_OpLogAnd.h index 460c81ca..50a31894 100644 --- a/src/c/operations/interfaces/int_OpLogAnd.h +++ b/src/c/operations/interfaces/int_OpLogAnd.h @@ -19,6 +19,14 @@ #define Bool2Double(in) ((in) ? 1.0 : 0.0) +#define Bool2Uint8(in) ((in) ? (uint8)1 : (uint8)0) + +#define Bool2Int8(in) ((in) ? (int8)1 : (int8)0) + +#define Bool2Uint16(in) ((in) ? (uint16)1 : (uint16)0) + +#define Bool2Int16(in) ((in) ? (int16)1 : (int16)0) + /*scalar and scalar*/ #define s0s0OpLogAnds0(in1, in2) Bool2Float(in1 != 0.0 && in2 != 0.0) @@ -38,6 +46,15 @@ #define z0d0OpLogAndd0(in1, in2) Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2 != 0.0) +#define u80u80OpLogAndu80(in1, in2) Bool2Uint8(in1 != 0 && in2 != 0) + +#define i80i80OpLogAndi80(in1, in2) Bool2Int8(in1 != 0 && in2 != 0) + +#define u160u160OpLogAndu160(in1, in2) Bool2Uint16(in1 != 0 && in2 != 0) + +#define i160i160OpLogAndi160(in1, in2) Bool2Int16(in1 != 0 && in2 != 0) + + /*matrix and scalar*/ #define s2s0OpLogAnds2(in1, size1, in2, out) {int i = 0 ;\ @@ -65,6 +82,21 @@ #define z2d0OpLogAndd2(in1, size1, in2, out) {int i = 0 ;\ for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2 != 0.0);} +#define u82u80OpLogAndu82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 && in2 != 0);} + +#define i82i80OpLogAndi82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 && in2 != 0);} + +#define u82u80OpLogAndu82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 && in2 != 0);} + +#define u162u160OpLogAndu162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 && in2 != 0);} + +#define i162i160OpLogAndi162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 && in2 != 0);} + /*scalar and matrix*/ #define s0s2OpLogAnds2(in1, in2, size2, out) {int i = 0 ;\ @@ -92,6 +124,18 @@ #define z0d2OpLogAndd2(in1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2[i] != 0.0);} +#define u80u82OpLogAndu82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1 != 0 && in2[i] != 0);} + +#define i80i82OpLogAndi82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1 != 0 && in2[i] != 0);} + +#define u160u162OpLogAndu162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1 != 0 && in2[i] != 0);} + +#define i160i162OpLogAndi162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1 != 0 && in2[i] != 0);} + /*TODO matrix and matrix*/ #define s2s2OpLogAnds2(in1, size1, in2, size2, out) {int i = 0 ;\ @@ -119,4 +163,17 @@ #define z2d2OpLogAndd2(in1, size1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2[i] != 0.0;)} + +#define u82u82OpLogAndu82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 && in2[i] != 0);} + +#define i82i82OpLogAndi82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 && in2[i] != 0);} + +#define u162u162OpLogAndu162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 && in2[i] != 0);} + +#define i162i162OpLogAndi162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 && in2[i] != 0);} + #endif /* !__INT_OPLOGAND_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogEq.h b/src/c/operations/interfaces/int_OpLogEq.h index b15a8b6a..b693db65 100644 --- a/src/c/operations/interfaces/int_OpLogEq.h +++ b/src/c/operations/interfaces/int_OpLogEq.h @@ -14,17 +14,32 @@ #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #define s0s0OpLogEqs0(in1,in2) (float) (in1 == in2) #define d0d0OpLogEqd0(in1,in2) (double) (in1 == in2) #define c0c0OpLogEqs0(in1,in2) (float) ((creals(in1) == creals(in2)) && (cimags(in1) == cimags(in2))) #define z0z0OpLogEqd0(in1,in2) (double) ((zreals(in1) == zreals(in2)) && (zimags(in1) == zimags(in2))) +#define u80u80OpLogEqu80(in1,in2) (uint8) (in1 == in2) +#define i80i80OpLogEqi80(in1,in2) (int8) (in1 == in2) +#define u160u160OpLogEqu160(in1,in2) (uint16) (in1 == in2) +#define i160i160OpLogEqi160(in1,in2) (int16) (in1 == in2) + #define s0c0OpLogEqs0(in1,in2) (float) ((in1==creals(in2)) && (0==cimags(in2))) #define d0z0OpLogEqd0(in1,in2) (double) ((in1==zreals(in2)) && (0==zimags(in2))) #define c0s0OpLogEqs0(in1,in2) s0c0OpLogEqs0(in2,in1) #define z0d0OpLogEqd0(in1,in2) d0z0OpLogEqd0(in2,in1) +#define u80d0OpLogEqu80(in1,in2) (uint8) (in1 == (uint8)in2) +#define i80d0OpLogEqi80(in1,in2) (int8) (in1 == (int8)in2) +#define u160d0OpLogEqu160(in1,in2) (uint16) (in1 == (uint16)in2) +#define i160d0OpLogEqi160(in1,in2) (int16) (in1 == (int16)in2) + +#define d0u80OpLogEqu80(in1,in2) (uint8) ((uint8)in1 == in2) +#define d0i80OpLogEqi80(in1,in2) (int8) ((int8)in1 == in2) +#define d0u160OpLogEqu160(in1,in2) (uint16) ((uint16)in1 == in2) +#define d0i160OpLogEqi160(in1,in2) (int16) ((int16)in1 == in2) #define s2s0OpLogEqs2(in1,size,in2,out) {int i;\ @@ -51,8 +66,21 @@ #define d2z0OpLogEqd2(in1,size,in2,out) {int i;\ for (i=0;i<size[0]*size[1];i++) out[i]=(double)((in1[i]==zreals(in2))&&(zimags(in2)==0));\ } +#define u82u80OpLogEqu82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint8)(in1[i]==in2);\ + } +#define i82i80OpLogEqi82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int8)(in1[i]==in2);\ + } +#define u162u160OpLogEqu162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint16)(in1[i]==in2);\ + } + +#define i162i160OpLogEqi162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int16)(in1[i]==in2);\ + } #define s0s2OpLogEqs2(in1,in2,inSize,out) s2s0OpLogEqs2(in2,inSize,in1,out) #define c0s2OpLogEqs2(in1,in2,inSize,out) s2c0OpLogEqs2(in2,inSize,in1,out) @@ -62,6 +90,11 @@ #define c0c2OpLogEqs2(in1,in2,inSize,out) c2c0OpLogEqs2(in2,inSize,in1,out) #define d0z2OpLogEqd2(in1,in2,inSize,out) z2d0OpLogEqd2(in2,inSize,in1,out) #define z0z2OpLogEqd2(in1,in2,inSize,out) z2z0OpLogEqd2(in2,inSize,in1,out) +#define u80u82OpLogEqu82(in1,in2,inSize,out) u82u80OpLogEqu82(in2,inSize,in1,out) +#define i80i82OpLogEqi82(in1,in2,inSize,out) i82i80OpLogEqi82(in2,inSize,in1,out) +#define u160u162OpLogEqu162(in1,in2,inSize,out) u162u160OpLogEq162(in2,inSize,in1,out) +#define i160i162OpLogEqi162(in1,in2,inSize,out) i162i160OpLogEqi162(in2,inSize,in1,out) + /* we must have size1=size2 */ @@ -91,4 +124,22 @@ #define c2s2OpLogEqs2(in1,size1,in2,size2,out) s2c2OpLogEqs2(in2,size2,in1,size1,out) #define z2d2OpLogEqd2(in1,size1,in2,size2,out) d2z2OpLogEqd2(in2,size2,in1,size1,out) -#endif /* !__OPLOGGT_H__ */ + +#define u82u82OpLogEqu82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint8)(in1[i]==in2[i]);\ + } + +#define i82i82OpLogEqi82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int8)(in1[i]==in2[i]);\ + } + +#define u162u162OpLogEqu162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint16)(in1[i]==in2[i]);\ + } + +#define i162i162OpLogEqi162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int16)(in1[i]==in2[i]);\ + } + + +#endif /* !__OPLOGEQ_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogGe.h b/src/c/operations/interfaces/int_OpLogGe.h index 0ce1ad81..edbdc071 100644 --- a/src/c/operations/interfaces/int_OpLogGe.h +++ b/src/c/operations/interfaces/int_OpLogGe.h @@ -21,15 +21,57 @@ #define s0s0OpLogGes0(in1,in2) (float) (in1 >= in2) #define d0d0OpLogGed0(in1,in2) (double) (in1 >= in2) +#define u80u80OpLogGeu80(in1,in2) (uint8) (in1 >= in2) + +#define i80i80OpLogGei80(in1,in2) (int8) (in1 >= in2) + +#define u160u160OpLogGeu160(in1,in2) (uint16) (in1 >= in2) + +#define i160i160OpLogGei160(in1,in2) (int16) (in1 >= in2) + #define s2s0OpLogGes2(in1, size1, in2, out) {int i;\ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGes0(in1[i],in2);\ } + +#define u82u80OpLogGeu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGeu80(in1[i],in2);\ + } + +#define i82i80OpLogGei82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGei80(in1[i],in2);\ + } + +#define u82u80OpLogGeu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGeu80(in1[i],in2);\ + } + +#define u162u160OpLogGeu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGeu160(in1[i],in2);\ + } + +#define i162i160OpLogGei162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGei160(in1[i],in2);\ + } + #define s0s2OpLogGes2(in1, in2, size2, out) {int i; \ for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogGes0(in1,in2[i]);\ } +#define u80u82OpLogGeu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogGeu80(in1,in2[i]);\ + } + +#define u160u162OpLogGeu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogGeu160(in1,in2[i]);\ + } + + +#define i160i162OpLogGei162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogGei160(in1,in2[i]);\ + } + /* we must have size1=size2 */ #define s2s2OpLogGes2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGes0(in1[i],in2[i]);\ @@ -47,4 +89,22 @@ #define d2d2OpLogGed2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogGed0(in1[i],in2[i]);\ } + +#define u82u82OpLogGeu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGeu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogGei82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGei80(in1[i],in2[i]);\ + } + +#define u162u162OpLogGeu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGeu160(in1[i],in2[i]);\ + } + +#define i162i162OpLogGei162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGei160(in1[i],in2[i]);\ + } + + #endif /* !__OPLOGGE_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogGt.h b/src/c/operations/interfaces/int_OpLogGt.h index 161b654f..38c76cfb 100644 --- a/src/c/operations/interfaces/int_OpLogGt.h +++ b/src/c/operations/interfaces/int_OpLogGt.h @@ -21,15 +21,51 @@ #define s0s0OpLogGts0(in1,in2) (float) (in1 > in2) #define d0d0OpLogGtd0(in1,in2) (double) (in1 > in2) +#define u80u80OpLogGtu80(in1,in2) (uint8) (in1 > in2) +#define i80i80OpLogGti80(in1,in2) (int8) (in1 > in2) +#define u160u160OpLogGtu160(in1,in2) (uint16) (in1 > in2) +#define i160i160OpLogGti160(in1,in2) (int16) (in1 > in2) #define s2s0OpLogGts2(in1, size1, in2, out) {int i;\ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGts0(in1[i],in2);\ } +#define u82u80OpLogGtu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGtu80(in1[i],in2);\ + } + +#define i82i80OpLogGti82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGti80(in1[i],in2);\ + } + +#define u162u160OpLogGtu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGtu160(in1[i],in2);\ + } + +#define i162i160OpLogGti162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGti160(in1[i],in2);\ + } + #define s0s2OpLogGts2(in1, in2, size2, out) {int i; \ for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogGts0(in1,in2[i]);\ } +#define u80u82OpLogGtu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogGtu80(in1,in2[i]);\ + } + +#define i80i82OpLogGti82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i80i80OpLogGti80(in1,in2[i]);\ + } + +#define u160u162OpLogGtu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogGtu160(in1,in2[i]);\ + } + +#define i160i162OpLogGti162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogGti160(in1,in2[i]);\ + } + /* we must have size1=size2 */ #define s2s2OpLogGts2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogGts0(in1[i],in2[i]);\ @@ -47,4 +83,21 @@ #define d2d2OpLogGtd2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogGtd0(in1[i],in2[i]);\ } + +#define u82u82OpLogGtu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogGtu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogGti82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogGti80(in1[i],in2[i]);\ + } + +#define u162u162OpLogGtu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogGt160(in1[i],in2[i]);\ + } + +#define i162i162OpLogGti162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogGti160(in1[i],in2[i]);\ + } + #endif /* !__OPLOGGT_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogLe.h b/src/c/operations/interfaces/int_OpLogLe.h index ebb09c7b..8dbd1aac 100644 --- a/src/c/operations/interfaces/int_OpLogLe.h +++ b/src/c/operations/interfaces/int_OpLogLe.h @@ -20,16 +20,51 @@ #define s0s0OpLogLes0(in1,in2) (float) (in1 <= in2) #define d0d0OpLogLed0(in1,in2) (double) (in1 <= in2) - +#define u80u80OpLogLeu80(in1,in2) (uint8) (in1 <= in2) +#define i80i80OpLogLei80(in1,in2) (int8) (in1 <= in2) +#define u160u160OpLogLeu160(in1,in2) (uint16) (in1 <= in2) +#define i160i160OpLogLei160(in1,in2) (int16) (in1 <= in2) #define s2s0OpLogLes2(in1, size1, in2, out) {int i;\ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLes0(in1[i],in2);\ } +#define u82u80OpLogLeu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLeu80(in1[i],in2);\ + } + +#define i82i80OpLogLei82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLei80(in1[i],in2);\ + } + +#define u162u160OpLogLeu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLeu160(in1[i],in2);\ + } + +#define i162i160OpLogLei162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLei160(in1[i],in2);\ + } + #define s0s2OpLogLes2(in1, in2, size2, out) {int i; \ for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogLes0(in1,in2[i]);\ } +#define u80u82OpLogLeu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogLeu80(in1,in2[i]);\ + } + +#define i80i82OpLogLei82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i80i80OpLogLei80(in1,in2[i]);\ + } + +#define u160u162OpLogLeu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogLeu160(in1,in2[i]);\ + } + +#define i160i162OpLogLei162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogLei160(in1,in2[i]);\ + } + /* we must have size1=size2 */ #define s2s2OpLogLes2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLes0(in1[i],in2[i]);\ @@ -47,4 +82,21 @@ #define d2d2OpLogLed2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogLed0(in1[i],in2[i]);\ } + +#define u82u82OpLogLeu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLeu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogLei82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLei80(in1[i],in2[i]);\ + } + +#define u162u162OpLogLeu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLeu160(in1[i],in2[i]);\ + } + +#define i162i162OpLogLei162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLei160(in1[i],in2[i]);\ + } + #endif /* !__OPLOGLE_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogLt.h b/src/c/operations/interfaces/int_OpLogLt.h index 2c5d8639..8974b156 100644 --- a/src/c/operations/interfaces/int_OpLogLt.h +++ b/src/c/operations/interfaces/int_OpLogLt.h @@ -20,16 +20,51 @@ #define s0s0OpLogLts0(in1,in2) (float) (in1 < in2) #define d0d0OpLogLtd0(in1,in2) (double) (in1 < in2) - +#define u80u80OpLogLtu80(in1,in2) (uint8) (in1 < in2) +#define i80i80OpLogLti80(in1,in2) (int8) (in1 < in2) +#define u160u160OpLogLtu160(in1,in2) (uint16) (in1 < in2) +#define i160i160OpLogLti160(in1,in2) (int16) (in1 < in2) #define s2s0OpLogLts2(in1, size1, in2, out) {int i;\ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLts0(in1[i],in2);\ } +#define u82u80OpLogLtu82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLtu80(in1[i],in2);\ + } + +#define i82i80OpLogLti82(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLti80(in1[i],in2);\ + } + +#define u162u160OpLogLtu162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLtu160(in1[i],in2);\ + } + +#define i162i160OpLogLti162(in1, size1, in2, out) {int i;\ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLti160(in1[i],in2);\ + } + #define s0s2OpLogLts2(in1, in2, size2, out) {int i; \ for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = s0s0OpLogLts0(in1,in2[i]);\ } +#define u80u82OpLogLtu82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u80u80OpLogLtu80(in1,in2[i]);\ + } + +#define i80i82OpLogLti82(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i80i80OpLogLti80(in1,in2[i]);\ + } + +#define u160u162OpLogLtu162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = u160u160OpLogLtu160(in1,in2[i]);\ + } + +#define i160i162OpLogLti162(in1, in2, size2, out) {int i; \ + for(i = 0 ; i < size2[0] * size2[1] ; ++i) out[i] = i160i160OpLogLti160(in1,in2[i]);\ + } + /* we must have size1=size2 */ #define s2s2OpLogLts2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = s0s0OpLogLts0(in1[i],in2[i]);\ @@ -47,4 +82,21 @@ #define d2d2OpLogLtd2(in1, size1, in2, size2, out) {int i; \ for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = d0d0OpLogLtd0(in1[i],in2[i]);\ } + +#define u82u82OpLogLtu82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u80u80OpLogLtu80(in1[i],in2[i]);\ + } + +#define i82i82OpLogLti82(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i80i80OpLogLti80(in1[i],in2[i]);\ + } + +#define u162u162OpLogLtu162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = u160u160OpLogLtu160(in1[i],in2[i]);\ + } + +#define i162i162OpLogLti162(in1, size1, in2, size2, out) {int i; \ + for(i = 0 ; i < size1[0] * size1[1] ; ++i) out[i] = i160i160OpLogLti160(in1[i],in2[i]);\ + } + #endif /* !__OPLOGLT_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogNe.h b/src/c/operations/interfaces/int_OpLogNe.h index 238ef483..56cafefa 100644 --- a/src/c/operations/interfaces/int_OpLogNe.h +++ b/src/c/operations/interfaces/int_OpLogNe.h @@ -22,6 +22,10 @@ #define d0d0OpLogNed0(in1,in2) (double) !(in1 == in2) #define c0c0OpLogNes0(in1,in2) (float) !((creals(in1) == creals(in2)) && (cimags(in1) == cimags(in2))) #define z0z0OpLogNed0(in1,in2) (double) !((zreals(in1) == zreals(in2)) && (zimags(in1) == zimags(in2))) +#define u80u80OpLogNeu80(in1,in2) (uint8) !(in1 == in2) +#define i80i80OpLogNei80(in1,in2) (int8) !(in1 == in2) +#define u160u160OpLogNeu160(in1,in2) (uint16) !(in1 == in2) +#define i160i160OpLogNei160(in1,in2) (int16) !(in1 == in2) #define s0c0OpLogNes0(in1,in2) (float) !((in1==creals(in2)) && (0==cimags(in2))) #define d0z0OpLogNed0(in1,in2) (double) !((in1==zreals(in2)) && (0==zimags(in2))) @@ -55,7 +59,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=(double)!((in1[i]==zreals(in2))&&(zimags(in2)==0));\ } +#define u82u80OpLogNeu82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint8)!(in1[i]==in2);\ + } + +#define i82i80OpLogNei82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int8)!(in1[i]==in2);\ + } +#define u162u160OpLogNeu162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(uint16)!(in1[i]==in2);\ + } + +#define i162i160OpLogNei162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=(int16)!(in1[i]==in2);\ + } #define s0s2OpLogNes2(in1,in2,inSize,out) s2s0OpLogNes2(in2,inSize,in1,out) #define c0s2OpLogNes2(in1,in2,inSize,out) s2c0OpLogNes2(in2,inSize,in1,out) @@ -65,6 +83,10 @@ #define c0c2OpLogNes2(in1,in2,inSize,out) c2c0OpLogNes2(in2,inSize,in1,out) #define d0z2OpLogNed2(in1,in2,inSize,out) z2d0OpLogNed2(in2,inSize,in1,out) #define z0z2OpLogNed2(in1,in2,inSize,out) z2z0OpLogNed2(in2,inSize,in1,out) +#define u80u82OpLogNeu82(in1,in2,inSize,out) u82u80OpLogNeu82(in2,inSize,in1,out) +#define i80i82OpLogNei82(in1,in2,inSize,out) i82i80OpLogNei82(in2,inSize,in1,out) +#define u160u162OpLogNeu162(in1,in2,inSize,out) u162u160OpLogNeu162(in2,inSize,in1,out) +#define i160i162OpLogNei162(in1,in2,inSize,out) i162i160OpLogNei162(in2,inSize,in1,out) /* we must have size1=size2 */ @@ -95,4 +117,20 @@ #define c2s2OpLogNes2(in1,size1,in2,size2,out) s2c2OpLogNes2(in2,size2,in1,size1,out) #define z2d2OpLogNed2(in1,size1,in2,size2,out) d2z2OpLogNed2(in2,size2,in1,size1,out) +#define u82u82OpLogNeu82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint8)!(in1[i]==in2[i]);\ + } + +#define i82i82OpLogNei82(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int8)!(in1[i]==in2[i]);\ + } + +#define u162u162OpLogNeu162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(uint16)!(in1[i]==in2[i]);\ + } + +#define i162i162OpLogNei162(in1,size1,in2,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=(int16)!(in1[i]==in2[i]);\ + } + #endif /* !__OPLOGNE_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogNot.h b/src/c/operations/interfaces/int_OpLogNot.h index 6184265c..852cd1c7 100644 --- a/src/c/operations/interfaces/int_OpLogNot.h +++ b/src/c/operations/interfaces/int_OpLogNot.h @@ -23,6 +23,14 @@ #define z0OpLogNotz0(in) (zreals(in)==0) ? DoubleComplex(1,0) : DoubleComplex(0,0) +#define u8OpLogNotu80(in) (in==0) ? (uint8)1 : (uint8)0 + +#define i8OpLogNoti80(in) (in==0) ? (int8)1 : (int8)0 + +#define u16OpLogNotu160(in) (in==0) ? (uint16)1 : (uint16)0 + +#define i16OpLogNoti160(in) (in==0) ? (int16)1 : (int16)0 + #define s2OpLogNots2(in,size,out) {int i;\ for (i=0;i<size[0]*size[1];i++) out[i]=s0OpLogNots0(in[i]);\ } @@ -39,4 +47,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=z0OpLogNotz0(in[i]);\ } +#define u82OpLogNotu82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u80OpLogNotu80(in[i]);\ + } + +#define i82OpLogNoti82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i80OpLogNoti80(in[i]);\ + } + +#define u162OpLogNotu162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=u160OpLogNoti160(in[i]);\ + } + +#define i162OpLogNoti162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=i160OpLogNotu160(in[i]);\ + } + + #endif /* !__INT_OPLOGNOT_H__ */ diff --git a/src/c/operations/interfaces/int_OpLogOr.h b/src/c/operations/interfaces/int_OpLogOr.h index b5d55fba..c7acb51d 100644 --- a/src/c/operations/interfaces/int_OpLogOr.h +++ b/src/c/operations/interfaces/int_OpLogOr.h @@ -19,6 +19,14 @@ #define Bool2Double(in) ((in) ? 1.0 : 0.0) +#define Bool2Uint8(in) ((in) ? (uint8)1 : (uint8)0) + +#define Bool2Int8(in) ((in) ? (int8)1 : (int8)0) + +#define Bool2Uint16(in) ((in) ? (uint16)1 : (uint16)0) + +#define Bool2Int16(in) ((in) ? (int16)1 : (int16)0) + /*scalar or scalar */ #define s0s0OpLogOrs0(in1, in2) Bool2Float(in1 != 0.0f || in2 != 0.0f) @@ -37,6 +45,14 @@ #define z0d0OpLogOrd0(in1, in2) Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2 != 0.0) +#define u80u80OpLogOru80(in1, in2) Bool2Uint8(in1 != 0 || in2 != 0) + +#define i80i80OpLogOri80(in1, in2) Bool2Int8(in1 != 0 || in2 != 0) + +#define u160u160OpLogOru160(in1, in2) Bool2Uint16(in1 != 0 || in2 != 0) + +#define i160i160OpLogOri160(in1, in2) Bool2Int16(in1 != 0 || in2 != 0) + /*matrix or scalar */ #define s2s0OpLogOrs2(in1, size1, in2, out) {int i = 0 ;\ @@ -63,54 +79,93 @@ #define z2d0OpLogOrd2(in1, size1, in2, out) {int i = 0 ;\ for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2 != 0.0);} +#define i82i80OpLogOri82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 || in2 != 0);} + +#define u82u80OpLogOru82(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 || in2 != 0);} + +#define u162u160OpLogOru162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 || in2 != 0);} + +#define i162i160OpLogOri162(in1, size1, in2, out) {int i = 0 ;\ + for (i = 0 ; i < size1[0]*size1[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 || in2 != 0);} + + /*scalar or matrix */ #define s0s2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.2f || in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.0 || in2[i] != 0.0);} #define d0d2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.2 || in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.0 || in2[i] != 0.0);} #define c0c2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.2f || cimags(in1) != 0.2f) || (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.0 || cimags(in1) != 0.0) || (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define s0c2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.2f && (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.0 && (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define c0s2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.2f || cimags(in1) != 0.2f) && in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.0 || cimags(in1) != 0.0) && in2[i] != 0.0);} #define z0z2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.2 || zimags(in1) != 0.2) && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define d0z2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.2 && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.0 && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define z0d2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.2 || zimags(in1) != 0.2) && in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2[i] != 0.0);} + +#define u80u82OpLogOru82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1 != 0 || in2[i] != 0);} + +#define i80i82OpLogOri82(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1 != 0 || in2[i] != 0);} + +#define u160u162OpLogOru162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1 != 0 || in2[i] != 0);} + +#define i160i162OpLogOri162(in1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1 != 0 || in2[i] != 0);} + /*matrix or matrix */ #define s2s2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.2f || in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.0 || in2[i] != 0.0);} #define d2d2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.2 || in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.0 || in2[i] != 0.0);} #define c2c2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.2f || cimags(in1[i]) != 0.2f) || (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.0 || cimags(in1[i]) != 0.0) || (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define s2c2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.2f && (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.0 && (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define c2s2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.2f || cimags(in1[i]) != 0.2f) && in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.0 || cimags(in1[i]) != 0.0) && in2[i] != 0.0);} #define z2z2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.2 || zimags(in1[i]) != 0.2) && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define d2z2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.2 && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.0 && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define z2d2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.2 || zimags(in1[i]) != 0.2) && in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2[i] != 0.0);} + +#define u82u82OpLogOru82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 || in2[i] != 0);} + +#define i82i82OpLogOri82(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int8(in1[i] != 0 || in2[i] != 0);} + +#define u162u162OpLogOru162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint16(in1[i] != 0 || in2[i] != 0);} + +#define i162i162OpLogOri162(in1, size1, in2, size2, out) {int i = 0 ;\ + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Int16(in1[i] != 0 || in2[i] != 0);} + #endif /* !__INT_OPLOGOR_H__ */ diff --git a/src/c/operations/interfaces/int_OpMinus.h b/src/c/operations/interfaces/int_OpMinus.h index ac27ddb6..2ea8a521 100644 --- a/src/c/operations/interfaces/int_OpMinus.h +++ b/src/c/operations/interfaces/int_OpMinus.h @@ -25,6 +25,14 @@ #define z0OpMinusz0(in) DoubleComplex(-zreals(in), -zimags(in)) +#define u80OpMinusu80(in) -(int8)in + +#define i80OpMinusi80(in) -in + +#define u160OpMinusu160(in) -(int16)in + +#define i160OpMinusi160(in) -in + /* - Matrix */ #define s2OpMinuss2(in, size, out) {int i=0; \ @@ -43,6 +51,25 @@ for (i=0;i<size[0]*size[1];i++) out[i] = DoubleComplex(-zreals(in[i]), -zimags(in[i])); \ } +#define u82OpMinusu82(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -(int8)in[i]; \ + } + + +#define i82OpMinusi82(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -in[i]; \ + } + + +#define u162OpMinusu162(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -(int16)in[i]; \ + } + + +#define i162OpMinui162(in, size, out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i] = -(int16)in[i]; \ + } + /* Scalar - Scalar */ @@ -62,6 +89,14 @@ #define z0d0OpMinusz0(in1,in2) zdiffs(in1,DoubleComplex(in2,0)) +#define u80u80OpMinusu80(in1,in2) u8diffs(in1,in2) + +#define i80i80OpMinusi80(in1,in2) i8diffs(in1,in2) + +#define u160u160OpMinusu160(in1,in2) u16diffs(in1,in2) + +#define i160i160OpMinusi160(in1,in2) i16diffs(in1,in2) + /* Matrix - Scalar */ @@ -99,6 +134,25 @@ } +#define u82u80OpMinusu82(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + + +#define i82i80OpMinusi82(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + + +#define u162u160OpMinusu162(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + + +#define i162i160OpMinusi162(in1,size,in2,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]-in2; \ + } + /* Scalar - Matrix */ @@ -136,6 +190,22 @@ } +#define u80u82OpMinusu82(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } + + +#define i80i82OpMinusi82(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } + +#define u160u162OpMinusu162(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } + +#define i160i162OpMinusi162(in1,in2,size,out) {int i=0; \ + for (i=0;i<size[0]*size[1];i++) out[i]=in1-in2[i]; \ + } /* Matrix - Matrix */ @@ -167,7 +237,12 @@ for (i=0;i<size1[0]*size2[1];i++) out[i]=zdiffs(in1[i],DoubleComplex(in2[i],0)); \ } +#define u82u82OpMinusu82(in1,size1,in2,size2,out) u8diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) + +#define i82i82OpMinusi82(in1,size1,in2,size2,out) i8diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) +#define u162u162OpMinusu162(in1,size1,in2,size2,out) u16diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) +#define i162i162OpMinusi162(in1,size1,in2,size2,out) i16diffa(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) #endif /* !__INT_OPMINUS_H__ */ diff --git a/src/c/operations/interfaces/int_OpPlus.h b/src/c/operations/interfaces/int_OpPlus.h index cb86d815..a5731d43 100644 --- a/src/c/operations/interfaces/int_OpPlus.h +++ b/src/c/operations/interfaces/int_OpPlus.h @@ -34,7 +34,13 @@ #define z0d0OpPlusz0(in1,in2) zadds(in1,DoubleComplex(in2,0)) +#define u80u80OpPlusu80(in1,in2) u8adds(in1,in2) +#define i80i80OpPlusi80(in1,in2) i8adds(in1,in2) + +#define u160u160OpPlusu160(in1,in2) u16adds(in1,in2) + +#define i160i160OpPlusi160(in1,in2) i16adds(in1,in2) /* Matrix + Scalar */ @@ -68,6 +74,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zadds(DoubleComplex(in1[i],0),in2);\ } +#define u82u80OpPlusu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } + +#define i82i80OpPlusi82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } + +#define u162u160OpPlusu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } + +#define i162i160OpPlusi162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]+in2;\ + } /* Scalar + Matrix */ @@ -101,7 +122,21 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zadds(in1,DoubleComplex(in2[i],0));\ } +#define u80u82OpPlusu82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } + +#define i80i82OpPlusi82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } + +#define u160u162OpPlusu162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } +#define i160i162OpPlusi162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1+in2[i];\ + } /* Matrix + Matrix */ @@ -132,7 +167,13 @@ for (i=0;i<size1[0]*size2[1];i++) out[i]=zadds(in1[i],DoubleComplex(in2[i],0));\ } +#define u82u82OpPlusu82(in1,size1,in2,size2,out) u8adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) + +#define i82i82OpPlusi82(in1,size1,in2,size2,out) i8adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) + +#define u162u162OpPlusu162(in1,size1,in2,size2,out) u16adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) +#define i162i162OpPlusi162(in1,size1,in2,size2,out) i16adda(in1, size1[0]*size1[1], in2, size2[0]*size2[1], out) /* Strings */ /* RNU: size1[1]-1 -> "-1" because '\0' of the first string must be removed. */ #define g2g2OpPlusg2(in1,size1,in2,size2,out) {int i = 0, j = 0; \ diff --git a/src/c/operations/interfaces/int_OpSlash.h b/src/c/operations/interfaces/int_OpSlash.h index fd8dda28..635fe2bf 100644 --- a/src/c/operations/interfaces/int_OpSlash.h +++ b/src/c/operations/interfaces/int_OpSlash.h @@ -33,6 +33,13 @@ #define z0d0OpSlashz0(in1,in2) zrdivs(in1,DoubleComplex(in2,0)) +#define u80u80OpSlashu80(in1,in2) u8rdivs(in1,in2) + +#define i80i80OpSlashi80(in1,in2) i8rdivs(in1,in2) + +#define u160u160OpSlashu160(in1,in2) u16rdivs(in1,in2) + +#define i160i160OpSlashi160(in1,in2) i16rdivs(in1,in2) /* Scalar / Matrix */ @@ -76,6 +83,17 @@ dinverma(in2,temp,size[0]);\ for (i=0;i<size[0]*size[1];i++) out[i]=zmuls(in1,DoubleComplex(temp[i],0));} +#define u80u82OpSlashu82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i80i82OpSlashi82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define u160u162OpSlashu162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} + +#define i160i162OpSlashi162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1/in2[i];} /* Matrix / Scalar */ @@ -110,8 +128,17 @@ #define z2d0OpSlashz2(in1,size,in2,out) z2z0OpSlashz2(in1,size,DoubleComplex(in2,0),out) +#define u82u80OpSlashu82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} +#define i82i80OpSlashi82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} +#define u162u160OpSlashu162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} + +#define i162i160OpSlashi162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]/in2;} /* Matrix / Matrix */ diff --git a/src/c/operations/interfaces/int_OpStar.h b/src/c/operations/interfaces/int_OpStar.h index 52ff221c..78697b3e 100644 --- a/src/c/operations/interfaces/int_OpStar.h +++ b/src/c/operations/interfaces/int_OpStar.h @@ -33,9 +33,47 @@ #define z0d0OpStarz0(in1,in2) zmuls(in1,DoubleComplex(in2,0)) +#define u80u80OpStaru80(in1,in2) u8muls(in1, in2) -/* Scalar * Matrix */ +#define u80u80OpStaru160(in1,in2) (uint16)(in1 * in2) + +#define u80i80OpStari80(in1,in2) (int8)(in1 * in2) + +#define u80i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define u80u160OpStaru160(in1,in2) (uint16)(in1 * in2) + +#define u80i160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80u80OpStari80(in1,in2) (int8)(in1 * in2) + +#define i80u80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80i80OpStari80(in1,in2) (int8)(in1 , in2) + +#define i80i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80u160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i80i160OpStari160(in1,in2) (int16)(in1 * in2) +#define u160u80OpStaru160(in1,in2) (uint16)(in1 * in2) + +#define u160i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define u160u160OpStaru160(in1,in2) u16muls(in1 , in2) + +#define u160i160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160u80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160i80OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160u160OpStari160(in1,in2) (int16)(in1 * in2) + +#define i160i160OpStari160(in1,in2) i16muls(in1 , in2) + +/* Scalar * Matrix */ #define s0s2OpStars2(in1,in2,size,out) {int i=0;\ for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} @@ -65,6 +103,18 @@ for (i=0;i<size[0]*size[1];i++) out[i]=zmuls(in1,DoubleComplex(in2[i],0));} +#define u80u82OpStaru82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*(uint8)in2[i];} + +#define i80i82OpStari82(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} + +#define u160u162OpStaru162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} + +#define i160i162OpStari162(in1,in2,size,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1*in2[i];} + /* Matrix * Scalar */ @@ -96,6 +146,20 @@ #define z2d0OpStarz2(in1,size,in2,out) z2z0OpStarz2(in1,size,DoubleComplex(in2,0),out) + +#define u82u80OpStaru82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + +#define i82i80OpStari82(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + +#define u162u160OpStaru162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + +#define i162i160OpStari162(in1,size,in2,out) {int i=0;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in1[i]*in2;} + + /* Matrix * Matrix */ #define s2s2OpStars2(in1,size1,in2,size2,out) smulma(in1,size1[0],size1[1],in2,size2[0],size2[1],out) @@ -148,4 +212,12 @@ #define z2z2OpStarz0(in1, size1, in2, size2) zmulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) +#define u82u82OpStaru80(in1, size1, in2, size2) u8mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + +#define i82i82OpStari80(in1, size1, in2, size2) i8mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + +#define u162u162OpStaru160(in1, size1, in2, size2) u16mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + +#define i162i162OpStari160(in1, size1, in2, size2) i16mulv( in1, in2, MAX(MAX(size1[0], size1[1]), MAX(size2[0], size2[1]))) + #endif /* !__INT_OPSTAR_H__ */ diff --git a/src/c/operations/multiplication/dmula.c b/src/c/operations/multiplication/dmula.c index 976faacf..77c204a7 100644 --- a/src/c/operations/multiplication/dmula.c +++ b/src/c/operations/multiplication/dmula.c @@ -15,7 +15,8 @@ void dmula(double* in1, double* in2, int size, double* out){ int i=0; - for (i=0;i<size;i++){ + for (i=0;i<size;i++) + { out[i]=dmuls(in1[i],in2[i]); } } diff --git a/src/c/operations/multiplication/dmuls.c b/src/c/operations/multiplication/dmuls.c index 09e7fdf5..ac21ace0 100644 --- a/src/c/operations/multiplication/dmuls.c +++ b/src/c/operations/multiplication/dmuls.c @@ -13,6 +13,7 @@ #include "multiplication.h" -double dmuls(double in1, double in2){ +double dmuls(double in1, double in2) +{ return in1*in2; } diff --git a/src/c/operations/multiplication/i16mula.c b/src/c/operations/multiplication/i16mula.c new file mode 100644 index 00000000..bffa107e --- /dev/null +++ b/src/c/operations/multiplication/i16mula.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void i16mula(int16* in1, int16* in2, int size, int16* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i16muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/i16muls.c b/src/c/operations/multiplication/i16muls.c new file mode 100644 index 00000000..4aaa5d11 --- /dev/null +++ b/src/c/operations/multiplication/i16muls.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +int16 i16muls(int16 in1, int16 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/i16mulv.c b/src/c/operations/multiplication/i16mulv.c new file mode 100644 index 00000000..3f3cc8d1 --- /dev/null +++ b/src/c/operations/multiplication/i16mulv.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +int16 i16mulv(int16* in1, int16* in2, int size) +{ + int16 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += i16muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/multiplication/i8mula.c b/src/c/operations/multiplication/i8mula.c new file mode 100644 index 00000000..c5c6114d --- /dev/null +++ b/src/c/operations/multiplication/i8mula.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void i8mula(int8* in1, int8* in2, int size, int8* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=i8muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/i8muls.c b/src/c/operations/multiplication/i8muls.c new file mode 100644 index 00000000..d6566208 --- /dev/null +++ b/src/c/operations/multiplication/i8muls.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +int8 i8muls(int8 in1, int8 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/i8mulv.c b/src/c/operations/multiplication/i8mulv.c new file mode 100644 index 00000000..6dc1ec4e --- /dev/null +++ b/src/c/operations/multiplication/i8mulv.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +int8 i8mulv(int8* in1, int8* in2, int size) +{ + int8 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += i8muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/multiplication/u16mula.c b/src/c/operations/multiplication/u16mula.c new file mode 100644 index 00000000..5be6e64e --- /dev/null +++ b/src/c/operations/multiplication/u16mula.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void u16mula(uint16* in1, uint16* in2, int size, uint16* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u16muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/u16muls.c b/src/c/operations/multiplication/u16muls.c new file mode 100644 index 00000000..10380c0d --- /dev/null +++ b/src/c/operations/multiplication/u16muls.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +uint16 u16muls(uint16 in1, uint16 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/u16mulv.c b/src/c/operations/multiplication/u16mulv.c new file mode 100644 index 00000000..5cd9805c --- /dev/null +++ b/src/c/operations/multiplication/u16mulv.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +uint16 u16mulv(uint16* in1, uint16* in2, int size) +{ + uint16 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += u16muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/multiplication/u8mula.c b/src/c/operations/multiplication/u8mula.c new file mode 100644 index 00000000..7ff2dd0b --- /dev/null +++ b/src/c/operations/multiplication/u8mula.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" + +void u8mula(uint8* in1, uint8* in2, int size, uint8* out){ + int i=0; + for (i=0;i<size;i++){ + out[i]=u8muls(in1[i],in2[i]); + } +} diff --git a/src/c/operations/multiplication/u8muls.c b/src/c/operations/multiplication/u8muls.c new file mode 100644 index 00000000..7acf5b58 --- /dev/null +++ b/src/c/operations/multiplication/u8muls.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "multiplication.h" +#include "types.h" + +uint8 u8muls(uint8 in1, uint8 in2){ + return in1*in2; +} diff --git a/src/c/operations/multiplication/u8mulv.c b/src/c/operations/multiplication/u8mulv.c new file mode 100644 index 00000000..9ae063e8 --- /dev/null +++ b/src/c/operations/multiplication/u8mulv.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "multiplication.h" + +uint8 u8mulv(uint8* in1, uint8* in2, int size) +{ + uint8 out = 0; + int i = 0; + + for (i = 0 ; i < size ; ++i) + { + out += u8muls(in1[i], in2[i]); + } + + return out; +} diff --git a/src/c/operations/subtraction/i16diffa.c b/src/c/operations/subtraction/i16diffa.c new file mode 100644 index 00000000..5a3c78c7 --- /dev/null +++ b/src/c/operations/subtraction/i16diffa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void i16diffa(int16* in1, int size1, int16* in2, int size2, int16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i16diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/i16diffs.c b/src/c/operations/subtraction/i16diffs.c new file mode 100644 index 00000000..c73bab0b --- /dev/null +++ b/src/c/operations/subtraction/i16diffs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +int16 i16diffs(int16 in1, int16 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/i8diffa.c b/src/c/operations/subtraction/i8diffa.c new file mode 100644 index 00000000..8eae7597 --- /dev/null +++ b/src/c/operations/subtraction/i8diffa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void i8diffa(int8* in1, int size1, int8* in2, int size2, int8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i8diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/i8diffs.c b/src/c/operations/subtraction/i8diffs.c new file mode 100644 index 00000000..88eaf4d1 --- /dev/null +++ b/src/c/operations/subtraction/i8diffs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +int8 i8diffs(int8 in1, int8 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/u16diffa.c b/src/c/operations/subtraction/u16diffa.c new file mode 100644 index 00000000..e9a30499 --- /dev/null +++ b/src/c/operations/subtraction/u16diffa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void u16diffa(uint16* in1, int size1, uint16* in2, int size2, uint16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u16diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/u16diffs.c b/src/c/operations/subtraction/u16diffs.c new file mode 100644 index 00000000..baf4e078 --- /dev/null +++ b/src/c/operations/subtraction/u16diffs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +uint16 u16diffs(uint16 in1, uint16 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/u8diffa.c b/src/c/operations/subtraction/u8diffa.c new file mode 100644 index 00000000..c1512e91 --- /dev/null +++ b/src/c/operations/subtraction/u8diffa.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +void u8diffa(uint8* in1, int size1, uint8* in2, int size2, uint8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u8diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/u8diffs.c b/src/c/operations/subtraction/u8diffs.c new file mode 100644 index 00000000..f71192ac --- /dev/null +++ b/src/c/operations/subtraction/u8diffs.c @@ -0,0 +1,18 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "subtraction.h" + +uint8 u8diffs(uint8 in1, uint8 in2) +{ + return (in1 - in2); +} diff --git a/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c b/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c new file mode 100644 index 00000000..42005d1c --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_analog_in.h" +#include "Arduino.h" + +uint16 u8cmd_analog_ins(uint8 board_no, uint8 pin) +{ + return((uint16)analogRead(pin)); +} + diff --git a/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c b/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c new file mode 100644 index 00000000..f961719d --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.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 + Author: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_analog_in_volt.h" +#include "Arduino.h" + +float u8cmd_analog_in_volts(uint8 board_no, uint8 pin) +{ + float a; //declaration of variable + a = ((5*(float)analogRead(pin))/1023); //recieved 10 bit input from analog pin is convert to voltage(0 - 50 + return(a); +} + diff --git a/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c b/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c new file mode 100644 index 00000000..a5b8513e --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_analog_out.h" +#include "Arduino.h" + +void u8cmd_analog_outs(uint8 board_no, uint8 pin, uint8 value) +{ + analogWrite(pin,value); + +} + diff --git a/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c b/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c new file mode 100644 index 00000000..1d76b601 --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.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 + Author: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_analog_out_volt.h" +#include "Arduino.h" + +void u8cmd_analog_out_volts(uint8 board_no, uint8 pin, float value) +{ + int a; //declaring variable + a = ((value*255)/5); //converting given voltage to duty cycle value (0 - 255) + analogWrite(pin,a); //passing pin no. and duty cycle value + +} diff --git a/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c b/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c new file mode 100644 index 00000000..d56d12d7 --- /dev/null +++ b/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c @@ -0,0 +1,29 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_dcmotor_release.h" +#include "Arduino.h" + +void u8cmd_dcmotor_releases(uint8 board_no, uint8 motor_no) +{ + if (dcm_mode[motor_no] == 3) //for IC accepting analog value + { + analogWrite(dcm_pin_1[motor_no],0); //passing LOW to IC pins to stop the motor + analogWrite(dcm_pin_2[motor_no],0); + } + + else //for IC accepting digital value + { + digitalWrite(dcm_pin_1[motor_no],LOW); + digitalWrite(dcm_pin_2[motor_no],LOW); //passing LOW to IC pins to stop the motor + } +} diff --git a/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c b/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c new file mode 100644 index 00000000..e8fa8b3c --- /dev/null +++ b/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c @@ -0,0 +1,60 @@ +/* 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: Siddhesh Wani + Revised by: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_dcmotor_run.h" +#include "Arduino.h" + +void u8cmd_dcmotor_runs(uint8 board_no, uint8 motor_no, int16 duty) +{ + uint8 direction = 1; + if(duty >= 0) + { + direction = 1; + } + else + { + direction = 0; + duty = -duty; + } + + if(duty > 255) duty = 255; + + if (dcm_mode[motor_no] == 3) //L293 + { + if(direction == 1) + { + analogWrite(dcm_pin_1[motor_no],duty); + analogWrite(dcm_pin_2[motor_no],0); + } + else + { + analogWrite(dcm_pin_2[motor_no],duty); + analogWrite(dcm_pin_1[motor_no],0); + } + } + else + { + if(direction == 1) + { + digitalWrite(dcm_pin_1[motor_no],HIGH); + digitalWrite(dcm_pin_2[motor_no],LOW); + } + else + { + digitalWrite(dcm_pin_2[motor_no],HIGH); + digitalWrite(dcm_pin_1[motor_no],LOW); + } + } + +} + diff --git a/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c new file mode 100644 index 00000000..0d04e748 --- /dev/null +++ b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c @@ -0,0 +1,43 @@ +/* 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: Siddhesh Wani + Revised by: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_dcmotor_setup.h" +#include "Arduino.h" + +uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; + +void u8cmd_dcmotor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ + uint8 pin_1, uint8 pin_2) +{ + dcm_pin_1[motor_no] = pin_1; + dcm_pin_2[motor_no] = pin_2; + dcm_mode[motor_no] = driver_type; + + //Initialise pins + pinMode(pin_1,OUTPUT); + pinMode(pin_2,OUTPUT); + + //Set output to low. + if(driver_type == 3) + { + analogWrite(pin_1,0); + analogWrite(pin_2,0); + } + else + { + digitalWrite(pin_1,LOW); + digitalWrite(pin_2,LOW); + } + +} + diff --git a/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c b/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c new file mode 100644 index 00000000..da5ca78d --- /dev/null +++ b/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c @@ -0,0 +1,20 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_digital_in.h" +#include "Arduino.h" + +uint8 u8cmd_digital_ins(uint8 board_no, uint8 pin) +{ + return((uint8)digitalRead(pin)); +} + diff --git a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c new file mode 100644 index 00000000..64af7b5c --- /dev/null +++ b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_digital_out.h" +#include "Arduino.h" + + +void u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value) +{ + digitalWrite(pin,value); + +} + diff --git a/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp new file mode 100644 index 00000000..eb9ec102 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp @@ -0,0 +1,23 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +//This function establishes I2C communication between arduino and given device + +#include "cmd_i2c_dev.h" +#include "Arduino.h" +#include "Wire.h" + +uint8 u8cmd_i2c_devs(uint8 address) +{ + Wire.begin(); //To initiate connection + return((uint8)address); //Returns address to create a device object +} diff --git a/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp new file mode 100644 index 00000000..24d36dea --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp @@ -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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +//This function reads data from I2C bus. +#include "cmd_i2c_read.h" +#include "Arduino.h" +#include "Wire.h" + +float u8cmd_i2c_reads(uint8 address, uint8 bytes) +{ + + float c; //variable declaration to save received data + + // request reading from sensor + Wire.requestFrom(address, bytes); // request no. of bytes(given) from slave device with address + + // receive reading from sensor + while (Wire.available()) //If data is received + c = Wire.read(); //Save received data in variable + return(c); + +} diff --git a/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp b/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp new file mode 100644 index 00000000..fd07eb6b --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp @@ -0,0 +1,40 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +//this function reads data from the device register with given address +#include "cmd_i2c_read_register.h" +#include "Arduino.h" +#include "Wire.h" + +uint16 u8cmd_i2c_read_registers(uint8 address, uint8 reg_adrs) +{ + long int reading; + + Wire.beginTransmission(address); // transmit to device address + Wire.write(reg_adrs); // sets register pointer to reg_adrs position + Wire.endTransmission(); // stop transmitting + + // request reading from sensor + Wire.requestFrom(address, 2); // request 2 bytes from slave device with address + + // receive reading from sensor + if (2 <= Wire.available()) // if two bytes were received + { + reading = Wire.read(); // receive high byte (overwrites previous reading) + reading = reading << 8; // shift high byte to be high 8 bits + reading |= Wire.read(); // receive low byte as lower 8 bits + } + + return(reading); + +} diff --git a/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp new file mode 100644 index 00000000..b7772255 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp @@ -0,0 +1,26 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +//This function writes data to the connected device +#include "cmd_i2c_write.h" +#include "Arduino.h" +#include "Wire.h" + +void u8cmd_i2c_writes(uint8 address, uint8 data) +{ + + Wire.beginTransmission(address); //Begins transmission to the device connected to given address + Wire.write(data); //sends data to slave device + Wire.endTransmission(); //Transmission ends + +} + diff --git a/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp b/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp new file mode 100644 index 00000000..9e3c11c5 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp @@ -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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +//This function writes to the register of the device +#include "cmd_i2c_write_register.h" +#include "Arduino.h" +#include "Wire.h" + +void u8cmd_i2c_write_registers(uint8 address, uint8 reg_adrs, uint8 data) +{ + + + Wire.beginTransmission(address); //Begins transmission to the device connected to given address + Wire.write(reg_adrs); //sets register pointer to reg_adrs position + Wire.write(data); //writes given data on reg_adrs position + Wire.endTransmission(); //Transmission ends + + +} + diff --git a/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attachs.cpp b/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attachs.cpp new file mode 100644 index 00000000..b4322c7f --- /dev/null +++ b/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attachs.cpp @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cmd_servo_attach.h" +#include "Arduino.h" +#include<Servo.h> +Servo servo1,servo2; +void u8cmd_servo_attach(uint8 h,uint8 servo_no) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + if(servo_no == 1) + { + servo1.attach(9); + servo1.write(0); + } + else + { + servo2.attach(10); + servo2.write(0); + } + +} + diff --git a/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detachs.cpp b/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detachs.cpp new file mode 100644 index 00000000..08ea03f4 --- /dev/null +++ b/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detachs.cpp @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_servo_detach.h" +#include "Arduino.h" +#include<Servo.h> +Servo servo1,servo2; +void u8cmd_servo_detach(uint8 h,uint8 servo_no) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + if(servo_no == 1) + { + servo1.detach(); + } + + else + { + servo2.detach(); + } + +} + diff --git a/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_moves.cpp b/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_moves.cpp new file mode 100644 index 00000000..c7c6fa7d --- /dev/null +++ b/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_moves.cpp @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_servo_move.h" +#include "Arduino.h" +#include<Servo.h> +Servo servo1,servo2; +void u8cmd_servo_move(uint8 h,uint8 servo_no,uint8 val) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + //val -> 0 to 180 angle of rotation + if (val>=0 && val<=180) + { + if (servo_no==1) + { + servo1.write(val); + } + else if (servo_no==2) + { + servo2.write(val); + } + } +} + diff --git a/src/c/scilab-arduino/default_files/Makefile b/src/c/scilab-arduino/default_files/Makefile new file mode 100644 index 00000000..5432fcfd --- /dev/null +++ b/src/c/scilab-arduino/default_files/Makefile @@ -0,0 +1,10 @@ +# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile + +ARDUINO_DIR = /usr/share/arduino +ARDMK_DIR = /usr/share/arduino +AVR_TOOLS_DIR = /usr +BOARD_TAG = uno +USER_LIB_PATH = ../ +ARDUINO_LIBS = ../src/c ../includes ../interfaces ../ +ARDUINO_PORT = /dev/ttyACM0 +include /usr/share/arduino/Arduino.mk diff --git a/src/c/scilab-arduino/default_files/sci2c_arduino.ino b/src/c/scilab-arduino/default_files/sci2c_arduino.ino new file mode 100644 index 00000000..1d4465b7 --- /dev/null +++ b/src/c/scilab-arduino/default_files/sci2c_arduino.ino @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "Arduino.h" +#include "loop_arduino.h" +#include "setup_arduino.h" + +void setup() +{ + //Please write appropriate setup functions here. + setup_arduino(); +} + +void loop() +{ + loop_arduino(); +} diff --git a/src/c/scilab-arduino/default_files/setup_arduino.h b/src/c/scilab-arduino/default_files/setup_arduino.h new file mode 100644 index 00000000..acbf8e21 --- /dev/null +++ b/src/c/scilab-arduino/default_files/setup_arduino.h @@ -0,0 +1,65 @@ +/* +** ************************************************ +** This file has been generated using +** Scilab2C (Version 2.3) +** +** Please visit following links for more informations: +** Atoms Module: http://atoms.scilab.org/toolboxes/scilab2c +** Scilab2C Forge: http://forge.scilab.org/index.php/p/scilab2c/ +** Scilab2C ML: http://forge.scilab.org/index.php/p/scilab2c/ +** ************************************************ +*/ + + +#ifndef setup_arduino_h +#define setup_arduino_h +/* +** ------------------- +** ----- Target ------ +** ------------------- +*/ +# define Arduino1 1 +/* +** ----------------------- +** --- SCI2C Includes. --- +** ----------------------- +*/ +#include "Arduino.h" +#include "sci2clib.h" +/* +** --------------------------- +** --- End SCI2C Includes. --- +** --------------------------- +*/ + + +#ifdef __cplusplus +extern "C" { +#endif +/* +** ------------------- +** --- Prototypes. --- +** ------------------- +*/ +int setup_arduino(); +/* +** ----------------------- +** --- End Prototypes. --- +** ----------------------- +*/ + + +/* +** ------------------------ +** --- USER2C Includes. --- +** ------------------------ +*/ +/* +** ---------------------------- +** --- End USER2C Includes. --- +** ---------------------------- +*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif diff --git a/src/c/scilab-arduino/includes/cmd_analog_in.h b/src/c/scilab-arduino/includes/cmd_analog_in.h new file mode 100644 index 00000000..0c186569 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_in.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_ANALOG_IN_H__ +#define __CMD_ANALOG_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 u8cmd_analog_ins(uint8 board_no, uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_ANALOG_IN_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_analog_in_volt.h b/src/c/scilab-arduino/includes/cmd_analog_in_volt.h new file mode 100644 index 00000000..ec471426 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_in_volt.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_ANALOG_IN_VOLT_H__ +#define __CMD_ANALOG_IN_VOLT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +float u8cmd_analog_in_volts(uint8 board_no, uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_ANALOG_IN_VOLT_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_analog_out.h b/src/c/scilab-arduino/includes/cmd_analog_out.h new file mode 100644 index 00000000..54e51f59 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_out.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_ANALOG_OUT_H__ +#define __CMD_ANALOG_OUT_H__ + +#include "types.h" +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_analog_outs(uint8 board_no, uint8 pin, uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_ANALOG_OUT_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_analog_out_volt.h b/src/c/scilab-arduino/includes/cmd_analog_out_volt.h new file mode 100644 index 00000000..51580fbb --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_out_volt.h @@ -0,0 +1,27 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_ANALOG_OUT_VOLT_H__ +#define __CMD_ANALOG_OUT_VOLT_H__ + +#include "types.h" +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_analog_out_volts(uint8 board_no, uint8 pin, float value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_ANALOG_OUT_VOLT_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_release.h b/src/c/scilab-arduino/includes/cmd_dcmotor_release.h new file mode 100644 index 00000000..d185fb5e --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_dcmotor_release.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_DCMOTOR_RELEASE_H__ +#define __CMD_DCMOTOR_RELEASE_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; + +void u8cmd_dcmotor_releases(uint8 board_no, uint8 motor_no); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_RELEASE_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_run.h b/src/c/scilab-arduino/includes/cmd_dcmotor_run.h new file mode 100644 index 00000000..1b5d41c1 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_dcmotor_run.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_DCMOTOR_RUN_H__ +#define __CMD_DCMOTOR_RUN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; + +void u8cmd_dcmotor_runs(uint8 board_no, uint8 motor_no, int16 duty); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h new file mode 100644 index 00000000..45854ffb --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_DCMOTOR_SETUP_H__ +#define __CMD_DCMOTOR_SETUP_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; + +void u8cmd_dcmotor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ + uint8 pin_1, uint8 pin_2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_digital_in.h b/src/c/scilab-arduino/includes/cmd_digital_in.h new file mode 100644 index 00000000..51226a6f --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_digital_in.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_DIGITAL_IN_H__ +#define __CMD_DIGITAL_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8cmd_digital_ins(uint8 board_no, uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_IN_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_digital_out.h b/src/c/scilab-arduino/includes/cmd_digital_out.h new file mode 100644 index 00000000..1e837e53 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_digital_out.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_DIGITAL_OUT_H__ +#define __CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_i2c_dev.h b/src/c/scilab-arduino/includes/cmd_i2c_dev.h new file mode 100644 index 00000000..382c2b3e --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_dev.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_I2C_DEV_H__ +#define __CMD_I2C_DEV_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8cmd_i2c_devs(uint8 address); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_I2C_DEV_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_i2c_read.h b/src/c/scilab-arduino/includes/cmd_i2c_read.h new file mode 100644 index 00000000..e33ede3c --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_read.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_I2C_READ_H__ +#define __CMD_I2C_READ_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +float u8cmd_i2c_reads(uint8 address, uint8 bytes); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_I2C_READ_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_i2c_read_register.h b/src/c/scilab-arduino/includes/cmd_i2c_read_register.h new file mode 100644 index 00000000..50fba935 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_read_register.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_I2C_READ_REGISTER_H__ +#define __CMD_I2C_READ_REGISTER_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 u8cmd_i2c_read_registers(uint8 address, uint8 reg_adrs); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_I2C_READ_REGISTER_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_i2c_write.h b/src/c/scilab-arduino/includes/cmd_i2c_write.h new file mode 100644 index 00000000..128f1af8 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_write.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_I2C_WRITE_H__ +#define __CMD_I2C_WRITE_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_i2c_writes(uint8 address, uint8 data); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_I2C_WRITE_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_i2c_write_register.h b/src/c/scilab-arduino/includes/cmd_i2c_write_register.h new file mode 100644 index 00000000..7fac4cbb --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_write_register.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __CMD_I2C_WRITE_REGISTER_H__ +#define __CMD_I2C_WRITE_REGISTER_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_i2c_write_registers(uint8 address, uint8 reg_adrs, uint8 data); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_I2C_WRITE_REGISTER_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_servo_attach.h b/src/c/scilab-arduino/includes/cmd_servo_attach.h new file mode 100644 index 00000000..12c2c013 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_servo_attach.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_SERVO_ATTACH_H__ +#define __CMD_SERVO_ATTACH_H__ + +#include "types.h" +//#include <Servo.h> +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +void u8cmd_servo_attach(uint8 h, uint8 servo_no ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_servo_detach.h b/src/c/scilab-arduino/includes/cmd_servo_detach.h new file mode 100644 index 00000000..daa5fd2b --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_servo_detach.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_SERVO_DETACH_H__ +#define __CMD_SERVO_DETACH_H__ + +#include "types.h" +//#include<Servo.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +void u8cmd_servo_detach(uint8 h, uint8 servo_no ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_servo_move.h b/src/c/scilab-arduino/includes/cmd_servo_move.h new file mode 100644 index 00000000..79c16b46 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_servo_move.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_SERVO_MOVE_H__ +#define __CMD_SERVO_MOVE_H__ + +#include "types.h" +//#include<Servo.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +void u8cmd_servo_move(uint8 h, uint8 servo_no,uint8 val); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/sleep.h b/src/c/scilab-arduino/includes/sleep.h new file mode 100644 index 00000000..8763f5f4 --- /dev/null +++ b/src/c/scilab-arduino/includes/sleep.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __SLEEP_H__ +#define __SLEEP_H__ + +#include "types.h" +#ifdef __cplusplus +extern "C" { +#endif + +void u16sleeps(uint16 delay_ms); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h new file mode 100644 index 00000000..7358509b --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h @@ -0,0 +1,30 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_ANALOG_IN_H__ +#define __INT_CMD_ANALOG_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_analog_inu160(in1,in2) u8cmd_analog_ins((uint8)in1,\ + (uint8)in2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_ANALOG_IN_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.h new file mode 100644 index 00000000..e8fe65d7 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_ANALOG_IN_VOLT_H__ +#define __INT_CMD_ANALOG_IN_VOLT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_analog_in_volts0(in1,in2) u8cmd_analog_in_volts((uint8)in1,(uint8)in2) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_ANALOG_IN_VOLT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h new file mode 100644 index 00000000..80ed7ab9 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h @@ -0,0 +1,33 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_ANALOG_OUT_H__ +#define __INT_CMD_ANALOG_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_analog_out(in1,in2,in3) u8cmd_analog_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +#define d0d0u80cmd_analog_out(in1,in2,in3) u8cmd_analog_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.h new file mode 100644 index 00000000..283f8fa0 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CMD_ANALOG_OUT_VOLT_H__ +#define __INT_CMD_ANALOG_OUT_VOLT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_analog_out_volt(in1,in2,in3) u8cmd_analog_out_volts((uint8)in1,(uint8)in2,(float)in3) + +#define d0d0s0cmd_analog_out_volt(in1,in2,in3) u8cmd_analog_out_volts((uint8)in1,(uint8)in2,(float)in3) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_ANALOG_OUT_VOLT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h b/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h new file mode 100644 index 00000000..d465ff6f --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h @@ -0,0 +1,40 @@ +/* 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: Siddhesh Wani + Revised by: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_DCMOTOR_H__ +#define __INT_CMD_DCMOTOR_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0d0d0cmd_dcmotor_setup(in1,in2,in3,in4,in5) u8cmd_dcmotor_setups((uint8)in1,(uint8)in2,(uint8)in3,(uint8)in4,(uint8)in5) + +#define d0d0d0cmd_dcmotor_run(in1,in2,in3) u8cmd_dcmotor_runs((uint8)in1,\ + (uint8)in2, (int16)in3); + + +#define d0d0u160cmd_dcmotor_run(in1,in2,in3) u8cmd_dcmotor_runs((uint8)in1,\ + (uint8)in2, (int16)in3); + +#define d0d0cmd_dcmotor_release(in1,in2) u8cmd_dcmotor_releases((uint8)in1,(uint8)in2) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DCMOTOR_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h b/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h new file mode 100644 index 00000000..4e5e575d --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h @@ -0,0 +1,30 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_DIGITAL_IN_H__ +#define __INT_CMD_DIGITAL_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_digital_inu80(in1,in2) u8cmd_digital_ins((uint8)in1,\ + (uint8)in2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_IN_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h new file mode 100644 index 00000000..92a92c68 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_DIGITAL_OUT_H__ +#define __INT_CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_digital_out(in1,in2,in3) u8cmd_digital_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +//Required when input from one pin is directed to other output pin. +#define d0d0u80cmd_digital_out(in1,in2,in3) u8cmd_digital_outs((uint8)in1,\ + (uint8)in2, (uint8)in3) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h new file mode 100644 index 00000000..85f3e3cb --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h @@ -0,0 +1,29 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CMD_I2C_DEV_H__ +#define __INT_CMD_I2C_DEV_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0cmd_i2c_devu80(in1) u8cmd_i2c_devs((uint8)in1) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_I2C_DEV_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h new file mode 100644 index 00000000..6ffd7ec7 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CMD_I2C_READ_H__ +#define __INT_CMD_I2C_READ_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_i2c_reads0(in1, in2) u8cmd_i2c_reads((uint8)in1, (uint8)in2) + +#define u80d0cmd_i2c_reads0(in1, in2) u8cmd_i2c_reads((uint8)in1, (uint8)in2) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_I2C_READ_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h new file mode 100644 index 00000000..e848b69b --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CMD_I2C_READ_REGISTER_H__ +#define __INT_CMD_I2C_READ_REGISTER_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_i2c_read_registeru160(in1, in2) u8cmd_i2c_read_registers((uint8)in1, (uint8)in2) + +#define u80d0cmd_i2c_read_registeru160(in1, in2) u8cmd_i2c_read_registers((uint8)in1, (uint8)in2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_I2C_READ_REGISTER_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h new file mode 100644 index 00000000..3a015933 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CMD_I2C_WRITE_H__ +#define __INT_CMD_I2C_WRITE_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_i2c_write(in1, in2) u8cmd_i2c_writes((uint8)in1, (uint8)in2) + +#define u80d0cmd_i2c_write(in1, in2) u8cmd_i2c_writes((uint8)in1, (uint8)in2) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_I2C_WRITE_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h new file mode 100644 index 00000000..78a3382b --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_CMD_I2C_WRITE_REGISTER_H__ +#define __INT_CMD_I2C_WRITE_REGISTER_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_i2c_write_register(in1, in2, in3) u8cmd_i2c_write_registers((uint8)in1, (uint8)in2, (uint8)in3) + +#define u80d0d0cmd_i2c_write_register(in1, in2, in3) u8cmd_i2c_write_registers((uint8)in1, (uint8)in2, (uint8)in3) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_I2C_WRITE_REGISTER_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_servo.h b/src/c/scilab-arduino/interfaces/int_cmd_servo.h new file mode 100644 index 00000000..a431fe14 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_servo.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_SERVO_H__ +#define __INT_CMD_SERVO_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d0d0cmd_servo_attach(in1,in2) u8cmd_servo_attach((uint8)in1,(uint8)in2); + +#define d0d0cmd_servo_detach(in1,in2) u8cmd_servo_detach((uint8)in1,(uint8)in2); + +#define d0d0d0cmd_servo_move(in1,in2,in3) u8cmd_servo_move((uint8)in1,(uint8)in2,(uint8)in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DCMOTOR_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_sleep.h b/src/c/scilab-arduino/interfaces/int_sleep.h new file mode 100644 index 00000000..f3a697f4 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_sleep.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_SLEEP_H__ +#define __INT_sLEEP_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0sleep(in1) u16sleeps((uint16)in1) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_SLEEP_H__ */ diff --git a/src/c/scilab-arduino/sleep/u16sleeps.c b/src/c/scilab-arduino/sleep/u16sleeps.c new file mode 100644 index 00000000..30459782 --- /dev/null +++ b/src/c/scilab-arduino/sleep/u16sleeps.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Revised by: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sleep.h" +#include "Arduino.h" + +void u16sleeps(uint16 delay_ms) +{ + delay(delay_ms); +} + diff --git a/src/c/signalProcessing/%k/dmodka.c b/src/c/signalProcessing/%k/dmodka.c new file mode 100644 index 00000000..8368cb6b --- /dev/null +++ b/src/c/signalProcessing/%k/dmodka.c @@ -0,0 +1,98 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "modk.h" +double max_calc(double* ptr,int sz) +{ + int i=0; + double mx; + if(ptr[0]<0) + { + ptr[0]=-1*ptr[0]; + } + mx=(ptr[0]); + for(i=1;i<sz;i++) + { + if(ptr[i]<0) + { + ptr[i]=-1*ptr[i]; + } + if(mx<(ptr[i])) + mx=(ptr[i]); + } + return mx; +} +void dmodka(double* inp,int size,double* oup) +{ + double ones[size],PI=M_PI; + double eps=pow(2,-52); + int i; + for(i=0;i<size;i++) + { + ones[i]=1; + } + double a[size],b[size],c[size],an[size],bn[size],cn[size],kans[size]; + + int j,kk,l,m; + for(j=0;j<size;j++) + { + a[j]=1; + } + for(kk=0;kk<size;kk++) + { + b[kk]=sqrt(ones[kk]-inp[kk]); + } + for(l=0;l<size;l++) + { + c[l]=sqrt(inp[l]); + + } + int x=0; + + while(max_calc(c,size)>eps) + { + int q,w,r; + for(q=0;q<size;q++) + { + an[q]=0.5*(a[q]+b[q]); + } + for(w=0;w<size;w++) + { + bn[w]=sqrt(a[w]*b[w]); + } + for(r=0;r<size;r++) + { + cn[r]=0.5*(a[r]-b[r]); + } + int x,y,z; + for(x=0;x<size;x++) + { + a[x]=an[x]; + } + for(y=0;y<size;y++) + { + b[y]=bn[y]; + } + for(z=0;z<size;z++) + { + c[z]=cn[z]; + } + } + int q,w; + for(q=0;q<size;q++) + { + oup[q]=PI*(ones[q]/(2*a[q])); + } + +} + diff --git a/src/c/signalProcessing/%k/int_modk.h b/src/c/signalProcessing/%k/int_modk.h new file mode 100644 index 00000000..ae09c50a --- /dev/null +++ b/src/c/signalProcessing/%k/int_modk.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_%K_H__ +#define __INT_%K_H__ + +#define d2modkz2(inp,size,oup) dmodka(inp,size,oup) + +#endif /* !INT_%K_H__! */ diff --git a/src/c/signalProcessing/%k/modk.h b/src/c/signalProcessing/%k/modk.h new file mode 100644 index 00000000..6b4a7e08 --- /dev/null +++ b/src/c/signalProcessing/%k/modk.h @@ -0,0 +1,29 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __%K_H__ +#define __%K_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmodka(double* inp,int size,doubleComplex* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __%K_H__ */ + diff --git a/src/c/signalProcessing/%sn/dmodsna.c b/src/c/signalProcessing/%sn/dmodsna.c new file mode 100644 index 00000000..7e1e81c3 --- /dev/null +++ b/src/c/signalProcessing/%sn/dmodsna.c @@ -0,0 +1,24 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "modsn.h" + +void dmodsna(double* uu,int size,double emmc,double* sn) +{ + int i; + for(i=0;i<size;i++) + { + sn[i]=dmodsns(uu[i],emmc); + } +} + diff --git a/src/c/signalProcessing/%sn/dmodsns.c b/src/c/signalProcessing/%sn/dmodsns.c new file mode 100644 index 00000000..aae16c19 --- /dev/null +++ b/src/c/signalProcessing/%sn/dmodsns.c @@ -0,0 +1,85 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + Reference:- Abramowitz, Milton and Stegun, Irene A + Handbook of Mathematical Functions, Dover, 1965 + Chapter 16 (Sections 16.4, 16.13 and 16.15) + Link for FORTRAN code:-http://www.aip.de/groups/soe/local/numres/bookfpdf/f6-11.pdf +*/ + +#include<stdio.h> +#include<math.h> +#define CA 0.0003 +#include "modsn.h" +double dmodsns(double uu, double emmc) +{ + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + double sn,cn,dn; + emc=1-emmc; + u=uu; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + dn=1.0; + for(i=1;i<=13;i++) + { + l=i; + em[i]=a; + en[i]=(emc=sqrt(emc)); + c=0.5*(a+emc); + if(fabs(a-emc)<=CA*a)break; + emc*=a; + a=c; + } + u*=c; + sn=sin(u); + cn=cos(u); + if(sn) + { + a=cn/sn; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=dn; + dn=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + sn=(sn>=0.0?a:-a); + cn=c*(sn); + } + if(bo) + { + a=dn; + dn=cn; + cn=a; + sn/=d; + } + } + else + { + cn=1.0/cosh(u); + dn=cn; + sn=tanh(u); + } + return sn; +} + diff --git a/src/c/signalProcessing/%sn/int_modsn.h b/src/c/signalProcessing/%sn/int_modsn.h new file mode 100644 index 00000000..179fb61f --- /dev/null +++ b/src/c/signalProcessing/%sn/int_modsn.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_MODSN_H__ +#define __INT_MODSN_H__ + +#define d0d0modsnd0(uu,emmc) dmodsns(uu,emmc) + +#endif /* !INT_MODSN_H__! */ diff --git a/src/c/signalProcessing/%sn/modsn.h b/src/c/signalProcessing/%sn/modsn.h new file mode 100644 index 00000000..c5896562 --- /dev/null +++ b/src/c/signalProcessing/%sn/modsn.h @@ -0,0 +1,27 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __MODSN_H__ +#define __MODSN_H__ +#include "types.h" + +#ifdef __cplusplus +extern "c" { +#endif + +double dmodsns(double uu, double emmc); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODSN_H__ */ diff --git a/src/c/signalProcessing/%sn/zmodsna.c b/src/c/signalProcessing/%sn/zmodsna.c new file mode 100644 index 00000000..85bc0c16 --- /dev/null +++ b/src/c/signalProcessing/%sn/zmodsna.c @@ -0,0 +1,165 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "modsn.h" +#include "doubleComplex.h" +#define CA 0.0003 + + +doubleComplex zmodsnsproto(doubleComplex uu,double emmc,doubleComplex* sni) +{ + doubleComplex ans; + double uur,uui; + uur=zreals(uu); + uui=zimags(uu); + double sr,cr,dr; + //Performing Elliptic Function operation for the real values + double a1,b1,c1,d1,emc1,u1; + double em1[14],en1[14]; + int i1,ii1,l1,bo1; + emc1=1-emmc; + u1=uur; + if(emc1) + { + bo1=(emc1<0.0); + if(bo1) + { + d1=1.0-emc1; + emc1/=-1.0/d1; + u1*=(d1=sqrt(d1)); + } + a1=1.0; + dr=1.0; + for(i1=1;i1<=13;i1++) + { + l1=i1; + em1[i1]=a1; + en1[i1]=(emc1=sqrt(emc1)); + c1=0.5*(a1+emc1); + if(fabs(a1-emc1)<=CA*a1)break; + emc1*=a1; + a1=c1; + } + u1*=c1; + sr=sin(u1); + cr=cos(u1); + if(sr) + { + a1=cr/sr; + c1*=a1; + for(ii1=l1;ii1>=1;ii1--) + { + b1=em1[ii1]; + a1*=c1; + c1*=dr; + dr=(en1[ii1]+a1)/(b1+a1); + a1=c1/b1; + } + a1=1.0/sqrt(c1*c1+1.0); + sr=(sr>=0.0?a1:-a1); + cr=c1*(sr); + } + if(bo1) + { + a1=dr; + dr=cr; + cr=a1; + sr/=d1; + } + } + else + { + cr=1.0/cosh(u1); + dr=cr; + sr=tanh(u1); + } + //////////////////////////////////////////////////////////////// + double si,ci,di; + //Performing Elleptic Function operation for the imaginary values + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + //double s1,c1,d1; + emc=emmc; + u=uui; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + di=1.0; + for(i=1;i<=13;i++) + { + l=i; + em[i]=a; + en[i]=(emc=sqrt(emc)); + c=0.5*(a+emc); + if(fabs(a-emc)<=CA*a)break; + emc*=a; + a=c; + } + u*=c; + si=sin(u); + ci=cos(u); + if(si) + { + a=ci/si; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=di; + di=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + si=(si>=0.0?a:-a); + ci=c*(si); + } + if(bo) + { + a=di; + di=ci; + ci=a; + si/=d; + } + } + else + { + ci=1.0/cosh(u); + di=ci; + si=tanh(u); + } + ///////////////////////////////////////////////////////// + double delta; + delta=ci*ci + emmc*sr*sr*si*si; + double snir,snii; + snir=(sr*di)/delta; + snii=(cr*dr*si*ci)/delta; + *sni=DoubleComplex(snir,snii); +} + +void zmodsna(doubleComplex* uu,int size,double emmc,doubleComplex* sn) +{ + int i; + for(i=0;i<size;i++) + { + zmodsnsproto(uu[i],emmc,&sn[i]); + } +} diff --git a/src/c/signalProcessing/%sn/zmodsns.c b/src/c/signalProcessing/%sn/zmodsns.c new file mode 100644 index 00000000..5f35059f --- /dev/null +++ b/src/c/signalProcessing/%sn/zmodsns.c @@ -0,0 +1,161 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + Reference:- Abramowitz, Milton and Stegun, Irene A + Handbook of Mathematical Functions, Dover, 1965 + Chapter 16 (Sections 16.4, 16.13 and 16.15) + Link for FORTRAN code:-http://www.aip.de/groups/soe/local/numres/bookfpdf/f6-11.pdf +*/ + +#include<stdio.h> +#include<math.h> +#include "modsn.h" +#include "doubleComplex.h" +#define CA 0.0003 + +doubleComplex zmodsns(doubleComplex uu,double emmc) +{ + doubleComplex ans; + double uur,uui; + uur=zreals(uu); + uui=zimags(uu); + double sr,cr,dr; + //Performing Elliptic Function operation for the real values + double a1,b1,c1,d1,emc1,u1; + double em1[14],en1[14]; + int i1,ii1,l1,bo1; + emc1=1-emmc; + u1=uur; + if(emc1) + { + bo1=(emc1<0.0); + if(bo1) + { + d1=1.0-emc1; + emc1/=-1.0/d1; + u1*=(d1=sqrt(d1)); + } + a1=1.0; + dr=1.0; + for(i1=1;i1<=13;i1++) + { + l1=i1; + em1[i1]=a1; + en1[i1]=(emc1=sqrt(emc1)); + c1=0.5*(a1+emc1); + if(fabs(a1-emc1)<=CA*a1)break; + emc1*=a1; + a1=c1; + } + u1*=c1; + sr=sin(u1); + cr=cos(u1); + if(sr) + { + a1=cr/sr; + c1*=a1; + for(ii1=l1;ii1>=1;ii1--) + { + b1=em1[ii1]; + a1*=c1; + c1*=dr; + dr=(en1[ii1]+a1)/(b1+a1); + a1=c1/b1; + } + a1=1.0/sqrt(c1*c1+1.0); + sr=(sr>=0.0?a1:-a1); + cr=c1*(sr); + } + if(bo1) + { + a1=dr; + dr=cr; + cr=a1; + sr/=d1; + } + } + else + { + cr=1.0/cosh(u1); + dr=cr; + sr=tanh(u1); + } + //////////////////////////////////////////////////////////////// + double si,ci,di; + //Performing Elleptic Function operation for the imaginary values + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + //double s1,c1,d1; + emc=emmc; + u=uui; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + di=1.0; + for(i=1;i<=13;i++) + { + l=i; + em[i]=a; + en[i]=(emc=sqrt(emc)); + c=0.5*(a+emc); + if(fabs(a-emc)<=CA*a)break; + emc*=a; + a=c; + } + u*=c; + si=sin(u); + ci=cos(u); + if(si) + { + a=ci/si; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=di; + di=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + si=(si>=0.0?a:-a); + ci=c*(si); + } + if(bo) + { + a=di; + di=ci; + ci=a; + si/=d; + } + } + else + { + ci=1.0/cosh(u); + di=ci; + si=tanh(u); + } + ///////////////////////////////////////////////////////// + double delta; + delta=ci*ci + emmc*sr*sr*si*si; + double snir,snii; + snir=(sr*di)/delta; + snii=(cr*dr*si*ci)/delta; + ans=DoubleComplex(snir,snii); + return ans; +} diff --git a/src/c/signalProcessing/amell/amell.h b/src/c/signalProcessing/amell/amell.h new file mode 100644 index 00000000..30bd6c82 --- /dev/null +++ b/src/c/signalProcessing/amell/amell.h @@ -0,0 +1,27 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __AMELL_H__ +#define __AMELL_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double damells(double u,double x); + +#ifdef __cplusplus +} /* extern "c" */ +#endif + +#endif /*__AMELL_H__*/ diff --git a/src/c/signalProcessing/amell/damella.c b/src/c/signalProcessing/amell/damella.c new file mode 100644 index 00000000..5c37e2a5 --- /dev/null +++ b/src/c/signalProcessing/amell/damella.c @@ -0,0 +1,23 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "amell.h" + +void damella(double* u,int size,double x,double* oup) +{ + int i; + for(i=0;i<size;i++) + { + oup[i]=damells(u[i],x); + } +} diff --git a/src/c/signalProcessing/amell/damells.c b/src/c/signalProcessing/amell/damells.c new file mode 100644 index 00000000..90c20530 --- /dev/null +++ b/src/c/signalProcessing/amell/damells.c @@ -0,0 +1,57 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include<math.h> +#include "amell.h" +#define N 30 +#define DBL_EPSILON 2.2204460492503131E-16 + + +double damells(double u,double x) +{ + double a[N+1]; + double g[N+1]; + double c[N+1]; + double two_n; + double phi; + double k; + int n; + k=(long double)fabs(x); + if(k==1.0) + return 0; + if(k>1.0) + printf("Wrong type of input argument type #2"); + + a[0]=1.0; + g[0]=sqrt(1.0-k*k); + c[0]=k; + two_n=1.0; + for(n=0;n<N;n++) + { + if(fabs(a[n]-g[n])<(a[n]*DBL_EPSILON)) + { + break; + } + two_n+=two_n; + a[n+1]=0.5*(a[n]+g[n]); + g[n+1]=sqrt(a[n]*g[n]); + c[n+1]=0.5*(a[n]-g[n]); + } + phi=two_n*a[n]*u; + for(;n>0;n--) + { + phi=0.5*(phi+asin(c[n]*sin(phi)/a[n])); + } + return (double)phi; +} + diff --git a/src/c/signalProcessing/amell/int_amell.h b/src/c/signalProcessing/amell/int_amell.h new file mode 100644 index 00000000..5d0c86f6 --- /dev/null +++ b/src/c/signalProcessing/amell/int_amell.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_AMELL_H__ +#define __INT_AMELL_H__ + +#define d0d0amelld0(u,x) damells(u,x) + +#endif /* !__INT_AMELL_H__! */ diff --git a/src/c/signalProcessing/buttmag/buttmag.h b/src/c/signalProcessing/buttmag/buttmag.h new file mode 100644 index 00000000..47e64af8 --- /dev/null +++ b/src/c/signalProcessing/buttmag/buttmag.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __BUTTMAG_H__ +#define __BUTTMAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dbuttmags(double order, double omegac, int size, double* sample,double* out); + +#ifdef __cplusplus +} /* extern "C"*/ +#endif + +#endif /* __BUTTMAG_H__ */ + diff --git a/src/c/signalProcessing/buttmag/dbuttmags.c b/src/c/signalProcessing/buttmag/dbuttmags.c new file mode 100644 index 00000000..dc40e814 --- /dev/null +++ b/src/c/signalProcessing/buttmag/dbuttmags.c @@ -0,0 +1,33 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include<stdio.h> +#include<math.h> +#include "buttmag.h" +void dbuttmags(double order, double omegac,double* sample,int size,double* out) +{ + double ones[size]; + int j,k; + for(j=0;j<size;j++) + { + ones[j]=1.0; + } + //double h[size]; + for(k=0;k<size;k++) + { + double x=ones[k]/(ones[k]+pow((sample[k]/omegac),(2*order))); + out[k]=x; + //printf("%lf\n",h[k]); + } + +} + diff --git a/src/c/signalProcessing/buttmag/int_buttmag.h b/src/c/signalProcessing/buttmag/int_buttmag.h new file mode 100644 index 00000000..9867438e --- /dev/null +++ b/src/c/signalProcessing/buttmag/int_buttmag.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_BUTTMAG_H__ +#define __INT_BUTTMAG_H__ + +#define d0d0d2buttmagd2(order,omegac,size,sample,out) dbuttmags(order,omegac,size,sample,out) + +#endif /* !INT_BUTTMAG_H__! */ diff --git a/src/c/signalProcessing/buttmag/u8buttmags.c b/src/c/signalProcessing/buttmag/u8buttmags.c new file mode 100644 index 00000000..e7b52c22 --- /dev/null +++ b/src/c/signalProcessing/buttmag/u8buttmags.c @@ -0,0 +1,33 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include<stdio.h> +#include<math.h> +#include "buttmag.h" +void dbuttmags(int order, int omegac,double* sample,int size,double* out) +{ + double ones[size]; + int j,k; + for(j=0;j<size;j++) + { + ones[j]=1.0; + } + //double h[size]; + for(k=0;k<size;k++) + { + double x=ones[k]/(ones[k]+pow((sample[k]/omegac),(2*order))); + out[k]=x; + //printf("%lf\n",h[k]); + } + +} + diff --git a/src/c/signalProcessing/cheb1mag/cheb1mag.h b/src/c/signalProcessing/cheb1mag/cheb1mag.h new file mode 100644 index 00000000..369ee4ce --- /dev/null +++ b/src/c/signalProcessing/cheb1mag/cheb1mag.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB1MAG_H__ +#define __CHEB1MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB1MAG_H__ */ diff --git a/src/c/signalProcessing/cheb1mag/dcheb1mags.c b/src/c/signalProcessing/cheb1mag/dcheb1mags.c new file mode 100644 index 00000000..a4a459d4 --- /dev/null +++ b/src/c/signalProcessing/cheb1mag/dcheb1mags.c @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "cheb1mag.h" +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out) +{ + double x; + int j; + double tn; + for(j=0;j<size;j++) + { + x=sample[j]/omegac; + if(x<=1) + { + tn=cos(n*acos(x)); + out[j]=1/(1+(epsilon*epsilon)*(tn*tn)); + } + else + { + tn=cosh(n*acosh(x)); + out[j]=1/(1+(epsilon*epsilon)*(tn*tn)); + } + } +} + diff --git a/src/c/signalProcessing/cheb1mag/int_cheb1mag.h b/src/c/signalProcessing/cheb1mag/int_cheb1mag.h new file mode 100644 index 00000000..fa0ff83e --- /dev/null +++ b/src/c/signalProcessing/cheb1mag/int_cheb1mag.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB1MAG_H__ +#define __INT_CHEB1MAG_H__ + +#define d0d0d2cheb1magd2(n,omegac,epsilon,sample,size,out) dcheb1mags(n,omegac,epsilon,sample,size,out) + +#endif /* !__INT_CHEB1MAG_H__! */ diff --git a/src/c/signalProcessing/cheb2mag/cheb2mag.h b/src/c/signalProcessing/cheb2mag/cheb2mag.h new file mode 100644 index 00000000..0516ca51 --- /dev/null +++ b/src/c/signalProcessing/cheb2mag/cheb2mag.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB2MAG_H__ +#define __CHEB2MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB2MAG_H__ */ diff --git a/src/c/signalProcessing/cheb2mag/dcheb2mags.c b/src/c/signalProcessing/cheb2mag/dcheb2mags.c new file mode 100644 index 00000000..006c5917 --- /dev/null +++ b/src/c/signalProcessing/cheb2mag/dcheb2mags.c @@ -0,0 +1,49 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "cheb2mag.h" +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup) +{ + double e; + //e=sqrt(A*A-1); + e=1/(pow(10,A/10)-1); + double x,k,cn,h,tp; + int i; + for(i=0;i<size;i++) + { + x=omegar/sample[i]; + if(x<=1) + { + tp=acos(x); + cn=cos(n*tp); + if(x==1) + { + h=1/(1+A*A-1); + } + else + { + h=1/(1+((A*A-1)/(cn*cn))); + } + + } + else + { + tp=acosh(x); + cn=cosh(n*tp); + h=e*(cn*cn)/(1+e*(cn*cn)); + + } + oup[i]=h; + } +} + diff --git a/src/c/signalProcessing/cheb2mag/int_cheb2mag.h b/src/c/signalProcessing/cheb2mag/int_cheb2mag.h new file mode 100644 index 00000000..05b77c2d --- /dev/null +++ b/src/c/signalProcessing/cheb2mag/int_cheb2mag.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB2MAG_H__ +#define __INT_CHEB2MAG_H__ + +#define d0d0d0d2cheb2magd2(n,omegar,A,sample,size,oup) dcheb2mag(n,omegar,A,sample,size,oup) + +#endif /* !__INT_CHEB2MAG_H__! */ diff --git a/src/c/signalProcessing/ell1mag/dell1maga.c b/src/c/signalProcessing/ell1mag/dell1maga.c new file mode 100644 index 00000000..58ef3035 --- /dev/null +++ b/src/c/signalProcessing/ell1mag/dell1maga.c @@ -0,0 +1,40 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include "modsn.h" +#include "ell1mag.h" +#include "doubleComplex.h" + +void dell1maga(double eps,double m1,double* z,int size,double* oup ) +{ + double s[size]; + int i; + for(i=0;i<size;i++) + { + s[i]=dmodsns(z[i],m1); + } + double un[size]; + int j; + for(j=0;j<size;j++) + { + un[j]=1; + } + double v; + int k; + for(k=0;k<size;k++) + { + v=un[k]/(un[k]+(eps*eps*s[k]*s[k])); + oup[k]=v; + } +} + diff --git a/src/c/signalProcessing/ell1mag/ell1mag.h b/src/c/signalProcessing/ell1mag/ell1mag.h new file mode 100644 index 00000000..8fffc0c6 --- /dev/null +++ b/src/c/signalProcessing/ell1mag/ell1mag.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ELL1MAG_H__ +#define __ELL1MAG_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dell1mags(double eps,double m1,doubleComplex* z,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ELL1MAG_H__*/ diff --git a/src/c/signalProcessing/ell1mag/int_ell1mag.h b/src/c/signalProcessing/ell1mag/int_ell1mag.h new file mode 100644 index 00000000..590a0abd --- /dev/null +++ b/src/c/signalProcessing/ell1mag/int_ell1mag.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ELL1MAG_H__ +#define __INT_ELL1MAG_H__ + +#define d0d0z2ell1magd2(eps,m1,z,size,oup) dell1mags(eps,m1,z,size,oup) + +#endif /* !__INT_ELL1MAG_H__! */ diff --git a/src/c/signalProcessing/ell1mag/zell1maga.c b/src/c/signalProcessing/ell1mag/zell1maga.c new file mode 100644 index 00000000..35b49281 --- /dev/null +++ b/src/c/signalProcessing/ell1mag/zell1maga.c @@ -0,0 +1,49 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include "modsn.h" +#include "ell1mag.h" +#include "doubleComplex.h" +#include "multiplication.h" +#include "addition.h" +#include "division.h" + +void zell1maga(double eps,double m1,doubleComplex* z,int size,double* oup ) +{ + doubleComplex s[size]; + int i; + for(i=0;i<size;i++) + { + s[i]=zmodsns(z[i],m1); + } + double un[size]; + int j; + for(j=0;j<size;j++) + { + un[j]=1; + } + doubleComplex v; + int k; + double ml; + ml=eps*eps; + doubleComplex tp1,tp2,tp3; + for(k=0;k<size;k++) + { + tp1=zmuls(s[k],s[k]); + tp2=DoubleComplex(ml,0); + tp3=DoubleComplex(un[k],0); + v=zrdivs(tp3,zadds(tp3,(zmuls(tp2,tp1)))); + oup[k]=zreals(v); + } +} + diff --git a/src/c/signalProcessing/faurre/dfaurrea.c b/src/c/signalProcessing/faurre/dfaurrea.c new file mode 100644 index 00000000..04d5a697 --- /dev/null +++ b/src/c/signalProcessing/faurre/dfaurrea.c @@ -0,0 +1,112 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Funtion to find faurre */ + +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include "faurre.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include "matrixInversion.h" +#include "addition.h" +#include "subtraction.h" +#include "eye.h" +#include "matrixDivision.h" + +void dfaurrea(int n, double* H, int H_row, int H_col, double* F, int F_row, int F_col, double* G, int G_row, int G_col, double * R0, int R0_row, int R0_col, double* P, double *R , double* T ) +{ + +/*Variable Declaration Start*/ + double R0_inv[R0_row* R0_col]; + double temp1[G_row* R0_col]; + double Pn[G_row* G_row]; + double Pn_temp[G_row*G_row]; + double G_trans[G_col*G_row]; + double H_trans[H_col*H_row]; + double F_trans[F_col*F_row]; + double A_trans[G_col*G_row]; + double temp2[F_row*G_row]; + double temp3[F_row*H_row]; + double A[G_row*G_col]; + double temp4[H_row*G_row]; + double temp5[H_row*H_row]; + double temp6[R0_row*R0_col]; + double temp7[G_row*R0_row]; + double temp8[G_row*G_row]; + double temp9[F_row*F_col]; + double temp10[H_row*G_row]; + double temp11[H_row*H_row]; + double temp12[F_row*G_row]; + double temp13[F_row*H_row]; + double temp14[G_row*G_col]; +/*Variable Declaration End*/ + + dinverma(R0, R0_inv, R0_row); //R0_inv= inv(R0) + dmulma(G, G_row, G_col, R0_inv, R0_row, R0_col, temp1); //temp1= G* inv(R0) + dtransposea(G, G_row, G_col, G_trans); //G_trans= G' + dmulma(temp1, G_row, R0_col, G_trans, G_col, G_row, Pn ); // Pn= G* inv(R0)* G' + dtransposea(H, H_row, H_col, H_trans); //H_trans= H' + dtransposea(F, F_row, F_col, F_trans); //F_trans= F' + +/*//Debug Only*/ +/* for(int i=0; i< G_row*G_row; i++)*/ +/* printf("Before loop Pn[%d]= %lf \t", i, Pn[i]);*/ +/* printf("\n");*/ + + for(int i=1;i <= n ; i++) + { + dmulma(F, F_row, F_col, Pn, G_row, G_row, temp2); //temp2= F*Pn; + dmulma(temp2, F_row, G_row, H_trans, H_col, H_row, temp3); //temp3= F*Pn*H' + ddiffa( G, G_row*G_col, temp3, F_row*H_row, A); //A = G- F*Pn*H' + dtransposea(A, G_row, G_col, A_trans); //A_trans= A' + dmulma(H, H_row, H_col, Pn, G_row, G_row, temp4); //temp4= H*Pn + dmulma(temp4, H_row, G_row, H_trans, H_col, H_row, temp5 ); //temp5= H*Pn*H' + ddiffa(R0, R0_row*R0_col, temp5, H_row*H_row,temp6 ); //temp6= R0-H*Pn*H' + drdivma(A,G_row, G_col, temp6, R0_row, R0_col, temp7); //temp7= A / (R0-H*Pn*H') + dmulma(temp7, G_row, R0_row, A_trans, G_col, G_row, temp8); //temp8 = A / (R0-H*Pn*H')*A' + dmulma(temp2, F_row, G_row, F_trans, F_col, F_row, temp9); //temp9= F*Pn*F' + dadda(temp9, F_row*F_col,temp8,G_row*G_row, Pn_temp); //Pn_temp = F*Pn*F'+ A / (R0-H*Pn*H')*A' + for(int j=0; j< G_row*G_row; j++) + Pn[j]= Pn_temp[j]; + + } + +/* //Debug Only*/ +/* for(int i=0; i< G_row*G_row; i++)*/ +/* printf("Afterloop Pn[%d]= %lf \t", i, Pn[i]);*/ +/* printf("\n");*/ + + for(int j=0; j< G_row*G_row; j++) + P[j]= Pn[j]; + + dmulma(H, H_row, H_col, P, G_row, G_row, temp10); //temp10= H*P + dmulma(temp10, H_row, G_row, H_trans, H_col, H_row, temp11 ); //temp11= H*P*H' + ddiffa(R0, R0_row*R0_col, temp11, H_row*H_row, R ); //R= R0-H*P*H' + +/* //Debug Only*/ +/* for(int i=0; i< H_row*H_row; i++)*/ +/* printf("R[%d]= %lf \t", i, R[i]);*/ +/* printf("\n");*/ + + dmulma(F, F_row, F_col, P, G_row, G_row, temp12); //temp12= F*P; + dmulma(temp12, F_row, G_row, H_trans, H_col, H_row, temp13); //temp13= F*P*H' + ddiffa( G, G_row*G_col, temp13, F_row*H_row, temp14); //temp14 = G- F*P*H' + drdivma(temp14,G_row, G_col, R, R0_row, R0_col, T); //T= (G-F*P*H')/ R + +/* //Debug Only*/ +/* for(int i=0; i< G_row*R0_row; i++)*/ +/* printf("T[%d]= %lf \t", i, T[i]);*/ +/* printf("\n");*/ + +} diff --git a/src/c/signalProcessing/ffilt/ffilt.h b/src/c/signalProcessing/ffilt/ffilt.h new file mode 100644 index 00000000..9b98f34c --- /dev/null +++ b/src/c/signalProcessing/ffilt/ffilt.h @@ -0,0 +1,27 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FFILT_H__ +#define __FFILT_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gffilts(char* ft,double N,double fc,double fh,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FFILT_H__ */ diff --git a/src/c/signalProcessing/ffilt/gffilts.c b/src/c/signalProcessing/ffilt/gffilts.c new file mode 100644 index 00000000..09876d00 --- /dev/null +++ b/src/c/signalProcessing/ffilt/gffilts.c @@ -0,0 +1,83 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "filt_sinc.h" +#include "ffilt.h" +void gffilts(char* ft,int size,double N,double fc,double fh,double* oup) +{ + int sz=N; + double X[sz]; + double no22=(N-1)/2; + int ino22=(int)no22; + if(ft[0]=='l') + { + dfilt_sincs(N,fc,X); + int k=0; + for(k=0;k<sz;k++) + { + oup[k]=X[k]; + } + } + else if(ft[0]=='h') + { + int k=0; + dfilt_sincs(N,fc,X); + for(k=0;k<sz;k++) + { + oup[k]=-1*X[k]; + } + int id=no22; + oup[id]=1+oup[id]; + } + else if(ft[0]=='b') + { + double wc=M_PI*(fh+fc); + fc=(fh-fc)/2; + dfilt_sincs(N,fc,X); + double Y[sz]; + double k=0; + for(k=-no22;k<=no22;k++) + { + int ind; + ind=k+no22; + Y[ind]=2*cos(wc*k); + } + int j=0; + for(j=0;j<sz;j++) + { + oup[j]=X[j]*Y[j]; + } + } + else if(ft[0]=='s') + { + double wc=M_PI*(fh+fc); + fc=(fh-fc)/2; + dfilt_sincs(N,fc,X); + double Y[sz]; + double k=0; + for(k=-no22;k<=no22;k++) + { + int ind; + ind=k+no22; + Y[ind]=2*cos(wc*k); + } + int j=0; + for(j=0;j<sz;j++) + { + oup[j]=-1*X[j]*Y[j]; + } + int id=no22; + oup[id]=1+oup[id]; + } +} + diff --git a/src/c/signalProcessing/ffilt/int_ffilt.h b/src/c/signalProcessing/ffilt/int_ffilt.h new file mode 100644 index 00000000..83f44827 --- /dev/null +++ b/src/c/signalProcessing/ffilt/int_ffilt.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FFILT_H__ +#define __INT_FFILT_H__ + +#define g0d0d0d0ffiltd2(ft,N,fc,fh,oup) gffilts(ft,N,fc,fh,oup) + +#endif /* !__INT_FFILT_H__! */ diff --git a/src/c/signalProcessing/filt_sinc/dfilt_sincs.c b/src/c/signalProcessing/filt_sinc/dfilt_sincs.c new file mode 100644 index 00000000..1b7d1b18 --- /dev/null +++ b/src/c/signalProcessing/filt_sinc/dfilt_sincs.c @@ -0,0 +1,49 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "filt_sinc.h" +void dfilt_sincs(double N,double fc,double* oup) +{ + double no2=(N-1)/2; + int ino2=(int)no2; + double wl=fc*2*M_PI; + int sz=N; + double xn[sz]; + double i; + int l,m; + for(i=-no2;i<=no2;i++) + { + l=i+no2; + xn[l]=sin(wl*i); + } + double xd[sz]; + double j; + printf("\n"); + for(j=-no2;j<=no2;j++) + { + m=j+no2; + xd[m]=M_PI*j; + } + if(ino2==no2) + { + xn[(int)no2]=2*fc; + xd[(int)no2]=1; + } + double x[sz]; + int k; + for(k=0;k<N;k++) + { + oup[k]=xn[k]/xd[k]; + } +} + diff --git a/src/c/signalProcessing/filt_sinc/filt_sinc.h b/src/c/signalProcessing/filt_sinc/filt_sinc.h new file mode 100644 index 00000000..43b24151 --- /dev/null +++ b/src/c/signalProcessing/filt_sinc/filt_sinc.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FILT_SINC_H__ +#define __FILT_SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8filt_sincs(int N,double fc,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FILT_SINC_H */ + diff --git a/src/c/signalProcessing/filt_sinc/int_filt_sinc.h b/src/c/signalProcessing/filt_sinc/int_filt_sinc.h new file mode 100644 index 00000000..5b7b07ae --- /dev/null +++ b/src/c/signalProcessing/filt_sinc/int_filt_sinc.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FILT_SINC_H__ +#define __INT_FILT_SINC_H__ + +#define u80d0filt_sincd2(N,fc,oup) u8filt_sincs(N,fc,oup) + +#endif /* !__INT_FILT_SINC_H__! */ diff --git a/src/c/signalProcessing/fsfirlin/dfsfirlina.c b/src/c/signalProcessing/fsfirlin/dfsfirlina.c new file mode 100644 index 00000000..e44f464e --- /dev/null +++ b/src/c/signalProcessing/fsfirlin/dfsfirlina.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 + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include<math.h> +#include "sincd.h" +#include "fsfirlin.h" + +void dfsfirlina(double* hd,int size,double flag,double* hst) +{ + int n1=size,n; + if( n1%2==0) + { + n=2*n1; + } + else + { + n=2*n1+1; + } + double scd[8*n+1]; + //STRAT SINCD + double npt=4*n; + int sz=4*n; + double PI=M_PI; + double pas=PI/npt; + double om[sz+1]; + int i; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flag==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + scd[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + scd[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + scd[m]=scd[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + scd[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + scd[l]=s[l-(sz)]/n; + } + } + //END SINCD + int ii; + for(ii=4*n;ii<=6*n;ii++) + { + hst[ii-(4*n)]=hd[0]*scd[ii]; + } + + int epsi; + epsi=pow(-1,n-1); + int jj; + for(jj=1;jj<=(n1-1);jj++) + { + double tp1[2*n+1]; + double tp2[2*n+1]; + int k,l; + for(k=(-4*jj+4*n);k<=(-4*jj+6*n);k++) + { + tp1[k-(-4*jj+4*n)]=hd[jj]*scd[k]; + } + + for(l=(4*jj);l<=(4*jj+2*n);l++) + { + tp2[l-(4*jj)]=hd[jj]*(epsi*scd[l]); + } + int m; + for(m=0;m<=2*n;m++) + { + hst[m]=hst[m]+(tp1[m]+tp2[m]); + } + + } + + +} diff --git a/src/c/signalProcessing/fsfirlin/fsfirlin.h b/src/c/signalProcessing/fsfirlin/fsfirlin.h new file mode 100644 index 00000000..7337cbfe --- /dev/null +++ b/src/c/signalProcessing/fsfirlin/fsfirlin.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FSFIRLIN_H__ +#define __FSFIRLIN_H__ +#include "types.h" +#include "sincd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfsfirlina(double* hd,int size,int flag,double* hst); + +#ifdef __cplusplus +} /* extern "C" */ +#endif diff --git a/src/c/signalProcessing/fsfirlin/int_fsfirlin.h b/src/c/signalProcessing/fsfirlin/int_fsfirlin.h new file mode 100644 index 00000000..857dae8c --- /dev/null +++ b/src/c/signalProcessing/fsfirlin/int_fsfirlin.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FSFIRLIN_H__ +#define __INT_FSFIRLIN_H__ + +#define d2u80fsfirlind2(hd,size,flag,hst) dfsfirlina(hd,size[1],flag,hst) + +#endif /* !__INT_FSFIRLIN_H__! */ diff --git a/src/c/signalProcessing/hank/dhanka.c b/src/c/signalProcessing/hank/dhanka.c new file mode 100644 index 00000000..5cef7f3b --- /dev/null +++ b/src/c/signalProcessing/hank/dhanka.c @@ -0,0 +1,114 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "hank.h" +#include "types.h" +#include "ones.h" +#include "kron.h" +#include "addition.h" +#include "matrix.h" + +void dhanka(int m, int n, double*seq_conv, int row, int col, double*out) +{ + +// Variable Declaration Start + int mr, nr; + mr= m* row; + nr= n* row; + double ones1[1*nr]; + double ones2[m*1]; + double temp1[mr*1]; + double temp2[1*nr]; + double middle1[m*nr]; + double middle2[m*nr]; + double index[m*nr]; + double final[row*m*nr]; +// Variable Declaration End + +// Algorithm Start + donesa(ones1, 1 , nr); + donesa(ones2, m , 1); +int j=0; +for(int i=1; i< mr+1; i= i+row) + { + temp1[j]=i; + j++; + //printf("%d", i); + } +for(int j=0;j< nr; j++) + temp2[j]=j; + + dkrona(ones1, 1 , nr, temp1, m , 1 , middle1); + dkrona(temp2, 1 , nr, ones2, m , 1 , middle2); + + dadda(middle1, m*nr, middle2, m*nr, index); + + +for(int i=0; i< m*nr; i++) + { + + for(int j=0; j<row; j++) + { + int rank=index[i]; + final[(i*row)+j]= seq_conv[ j+(rank-1)*row]; + + } + + } +//Debug Only +/* +printf("ones1\n"); +for(int k=0; k<1*nr; k++) + printf("%lf\t", ones1[k]); +printf("\n"); + +printf("ones2\n"); +for(int k=0; k<m*1; k++) + printf("%lf\t", ones2[k]); +printf("\n"); + +printf("temp1\n"); +for(int k=0; k<m*1; k++) + printf("%lf\t", temp1[k]); +printf("\n"); + +printf("temp2\n"); +for(int k=0; k<nr*1; k++) + printf("%lf\t", temp2[k]); +printf("\n"); + +printf("middle1\n"); +for(int k=0; k<m*nr; k++) + printf("%lf\t", middle1[k]); +printf("\n"); + +printf("middle2\n"); +for(int k=0; k<m*nr; k++) + printf("%lf\t", middle2[k]); +printf("\n"); + +printf("index\n"); +for(int k=0; k<m*nr; k++) + printf("%lf\t", index[k]); +printf("\n"); + +printf("final\n"); +for(int k=0; k<row*m*nr; k++) + printf("%lf\t", final[k]); +printf("\n"); +*/ + + dmatrixa(final, row, m*nr, mr, (row*m*nr)/mr, out); +//Algorith Ends + +} diff --git a/src/c/signalProcessing/hank/shanka.c b/src/c/signalProcessing/hank/shanka.c new file mode 100644 index 00000000..1c8f0181 --- /dev/null +++ b/src/c/signalProcessing/hank/shanka.c @@ -0,0 +1,110 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "hank.h" +#include "types.h" +#include "ones.h" +#include "kron.h" +#include "addition.h" +#include "matrix.h" + +void shanka(int m, int n, float*seq_conv, int row, int col, float*out) +{ + int mr, nr; + mr= m* row; + nr= n* row; + float ones1[1*nr]; + float ones2[m*1]; + float temp1[mr*1]; + float temp2[1*nr]; + float middle1[m*nr]; + float middle2[m*nr]; + float index[m*nr]; + float final[row*m*nr]; + + + sonesa(ones1, 1 , nr); + sonesa(ones2, m , 1); +int j=0; +for(int i=1; i< mr+1; i= i+row) + { + temp1[j]=i; + j++; + //printf("%d", i); + } +for(int j=0;j< nr; j++) + temp2[j]=j; + + skrona(ones1, 1 , nr, temp1, m , 1 , middle1); + skrona(temp2, 1 , nr, ones2, m , 1 , middle2); + + sadda(middle1, m*nr, middle2, m*nr, index); + + +for(int i=0; i< m*nr; i++) + { + + for(int j=0; j<row; j++) + { + int rank=index[i]; + final[(i*row)+j]= seq_conv[ j+(rank-1)*row]; + + } + + } + +/* +printf("ones1\n"); +for(int k=0; k<1*nr; k++) + printf("%f\t", ones1[k]); +printf("\n"); + +printf("ones2\n"); +for(int k=0; k<m*1; k++) + printf("%f\t", ones2[k]); +printf("\n"); + +printf("temp1\n"); +for(int k=0; k<m*1; k++) + printf("%f\t", temp1[k]); +printf("\n"); + +printf("temp2\n"); +for(int k=0; k<nr*1; k++) + printf("%f\t", temp2[k]); +printf("\n"); + +printf("middle1\n"); +for(int k=0; k<m*nr; k++) + printf("%f\t", middle1[k]); +printf("\n"); + +printf("middle2\n"); +for(int k=0; k<m*nr; k++) + printf("%f\t", middle2[k]); +printf("\n"); + +printf("index\n"); +for(int k=0; k<m*nr; k++) + printf("%f\t", index[k]); +printf("\n"); + +printf("final\n"); +for(int k=0; k<row*m*nr; k++) + printf("%f\t", final[k]); +printf("\n"); +*/ + + smatrixa(final, row, m*nr, mr, (row*m*nr)/mr, out); + +} diff --git a/src/c/signalProcessing/includes/amell.h b/src/c/signalProcessing/includes/amell.h new file mode 100644 index 00000000..2336d3cb --- /dev/null +++ b/src/c/signalProcessing/includes/amell.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __AMELL_H__ +#define __AMELL_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double damells(double u,double x); +void damella(double* u,int size,double x,double* oup); + +#ifdef __cplusplus +} /* extern "c" */ +#endif + +#endif /*__AMELL_H__*/ diff --git a/src/c/signalProcessing/includes/buttmag.h b/src/c/signalProcessing/includes/buttmag.h new file mode 100644 index 00000000..ef17b7ea --- /dev/null +++ b/src/c/signalProcessing/includes/buttmag.h @@ -0,0 +1,29 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __BUTTMAG_H__ +#define __BUTTMAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dbuttmags(double order, double omegac, double* sample, int size,double* out); +void u8buttmags(int order, int omegac, double* sample, int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __BUTTMAG_H__ */ + diff --git a/src/c/signalProcessing/includes/cheb1mag.h b/src/c/signalProcessing/includes/cheb1mag.h new file mode 100644 index 00000000..369ee4ce --- /dev/null +++ b/src/c/signalProcessing/includes/cheb1mag.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB1MAG_H__ +#define __CHEB1MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB1MAG_H__ */ diff --git a/src/c/signalProcessing/includes/cheb2mag.h b/src/c/signalProcessing/includes/cheb2mag.h new file mode 100644 index 00000000..0516ca51 --- /dev/null +++ b/src/c/signalProcessing/includes/cheb2mag.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB2MAG_H__ +#define __CHEB2MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB2MAG_H__ */ diff --git a/src/c/signalProcessing/includes/dct.h b/src/c/signalProcessing/includes/dct.h new file mode 100644 index 00000000..80668ffa --- /dev/null +++ b/src/c/signalProcessing/includes/dct.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __DCT_H__ +#define __DCT_H__ + +#include <math.h> +#include "types.h" +#include "doubleComplex.h" +#include "addition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void ddcta(double *in,int row,int col,int sign,double *out); + +void sdcta(float *in,int row,int col,int sign,float *out); + +void zdcta(doubleComplex *in,int row,int col,int sign,doubleComplex *out); + +void cdcta(floatComplex *in,int row,int col,int sign,floatComplex *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/signalProcessing/includes/ell1mag.h b/src/c/signalProcessing/includes/ell1mag.h new file mode 100644 index 00000000..e881cca9 --- /dev/null +++ b/src/c/signalProcessing/includes/ell1mag.h @@ -0,0 +1,29 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ELL1MAG_H__ +#define __ELL1MAG_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void zell1maga(double eps,double m1,doubleComplex* z,int size,double* oup); +void dell1maga(double eps,double m1,double* z,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ELL1MAG_H__*/ diff --git a/src/c/signalProcessing/includes/faurre.h b/src/c/signalProcessing/includes/faurre.h new file mode 100644 index 00000000..e4a2de3c --- /dev/null +++ b/src/c/signalProcessing/includes/faurre.h @@ -0,0 +1,29 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FAURRE_H__ +#define __FAURRE_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfaurrea(int n, double* H, int H_row, int H_col, double* F, int F_row, int F_col, double* G, int G_row, int G_col, double * R0, int R0_row, int R0_col, double * P, double* R, double* T); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FAURRE_H__ */ + diff --git a/src/c/signalProcessing/includes/ffilt.h b/src/c/signalProcessing/includes/ffilt.h new file mode 100644 index 00000000..f38df6e6 --- /dev/null +++ b/src/c/signalProcessing/includes/ffilt.h @@ -0,0 +1,27 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FFILT_H__ +#define __FFILT_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gffilts(char* ft,int size,double N,double fc,double fh,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FFILT_H__ */ diff --git a/src/c/signalProcessing/includes/filt_sinc.h b/src/c/signalProcessing/includes/filt_sinc.h new file mode 100644 index 00000000..095ca91f --- /dev/null +++ b/src/c/signalProcessing/includes/filt_sinc.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FILT_SINC_H__ +#define __FILT_SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfilt_sincs(double N,double fc,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FILT_SINC_H */ + diff --git a/src/c/signalProcessing/includes/fsfirlin.h b/src/c/signalProcessing/includes/fsfirlin.h new file mode 100644 index 00000000..cf5fbbd0 --- /dev/null +++ b/src/c/signalProcessing/includes/fsfirlin.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FSFIRLIN_H__ +#define __FSFIRLIN_H__ +#include "types.h" +#include "sincd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfsfirlina(double* hd,int size,double flag,double* hst); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__FSFIRLIN_H__*/ diff --git a/src/c/signalProcessing/includes/hank.h b/src/c/signalProcessing/includes/hank.h new file mode 100644 index 00000000..1b661ec5 --- /dev/null +++ b/src/c/signalProcessing/includes/hank.h @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __HANK_H__ +#define __HANK_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dhanka(int m, int n, double*seq_conv, int row, int col, double*out); + +void shanka(int m, int n, float*seq_conv, int row, int col, float*out); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __HANK_H__ */ + diff --git a/src/c/signalProcessing/includes/idct.h b/src/c/signalProcessing/includes/idct.h new file mode 100644 index 00000000..1e7b85b3 --- /dev/null +++ b/src/c/signalProcessing/includes/idct.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __IDCT_H__ +#define __IDCT_H__ + +#include <math.h> +#include "types.h" +#include "doubleComplex.h" +#include "addition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void didcta(double *in,int row,int col,double *out); + +void sidcta(float *in,int row,int col,float *out); + +void zidcta(doubleComplex *in,int row,int col,doubleComplex *out); + +void cidcta(floatComplex *in,int row,int col,floatComplex *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/signalProcessing/includes/kalm.h b/src/c/signalProcessing/includes/kalm.h new file mode 100644 index 00000000..6f73ac15 --- /dev/null +++ b/src/c/signalProcessing/includes/kalm.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __KALM_H__ +#define __KALM_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dkalma(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* x1, double* p1, double* x, double* p); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __KALM_H__ */ + diff --git a/src/c/signalProcessing/includes/modk.h b/src/c/signalProcessing/includes/modk.h new file mode 100644 index 00000000..5040eb7f --- /dev/null +++ b/src/c/signalProcessing/includes/modk.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __MODK_H__ +#define __MODK_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmodka(double* inp,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODK_H__ */ + diff --git a/src/c/signalProcessing/includes/modsn.h b/src/c/signalProcessing/includes/modsn.h new file mode 100644 index 00000000..d91dd9d3 --- /dev/null +++ b/src/c/signalProcessing/includes/modsn.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __MODSN_H__ +#define __MODSN_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmodsns(double uu, double emmc); +doubleComplex zmodsns(doubleComplex uu,double emmc); +void dmodsna(double* uu,int size,double emmc,double* sn); +void zmodsna(doubleComplex* uu,int size,double emmc,doubleComplex* sn); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODSN_H__ */ diff --git a/src/c/signalProcessing/includes/sincd.h b/src/c/signalProcessing/includes/sincd.h new file mode 100644 index 00000000..9b7a3607 --- /dev/null +++ b/src/c/signalProcessing/includes/sincd.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SINCD_H__ +#define __SINCD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsincds(double n,double flg,double* oup); +void u8sincds(int n,int flg,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINCD_H__ */ + diff --git a/src/c/signalProcessing/includes/window.h b/src/c/signalProcessing/includes/window.h new file mode 100644 index 00000000..0a06f22e --- /dev/null +++ b/src/c/signalProcessing/includes/window.h @@ -0,0 +1,33 @@ + /* 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 __WINDOW_H__ +#define __WINDOW_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 dwindowa(char* inp1, int size, double n, double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__WINDOW_H__*/ diff --git a/src/c/signalProcessing/includes/zpbutt.h b/src/c/signalProcessing/includes/zpbutt.h new file mode 100644 index 00000000..9eb88ad4 --- /dev/null +++ b/src/c/signalProcessing/includes/zpbutt.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPBUTT_H__ +#define __ZPBUTT_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpbutts(double n,double fl,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPBUTT_H__ */ + diff --git a/src/c/signalProcessing/includes/zpch1.h b/src/c/signalProcessing/includes/zpch1.h new file mode 100644 index 00000000..fbe850cc --- /dev/null +++ b/src/c/signalProcessing/includes/zpch1.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH1_H__ +#define __ZPCH1_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch1s(double N,double e,double wc,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH1_H__ */ diff --git a/src/c/signalProcessing/includes/zpch2.h b/src/c/signalProcessing/includes/zpch2.h new file mode 100644 index 00000000..d7c1c647 --- /dev/null +++ b/src/c/signalProcessing/includes/zpch2.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH2_H__ +#define __ZPCH2_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH2_H__ */ diff --git a/src/c/signalProcessing/interfaces/int_amell.h b/src/c/signalProcessing/interfaces/int_amell.h new file mode 100644 index 00000000..10719ac5 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_amell.h @@ -0,0 +1,19 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_AMELL_H__ +#define __INT_AMELL_H__ + +#define d0d0amelld0(u,x) damells(u,x) +#define d2d0amelld2(u,size,x,oup) damella(u,size[1],x,oup) + +#endif /* !__INT_AMELL_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_buttmag.h b/src/c/signalProcessing/interfaces/int_buttmag.h new file mode 100644 index 00000000..4a33fafe --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_buttmag.h @@ -0,0 +1,19 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_BUTTMAG_H__ +#define __INT_BUTTMAG_H__ + +#define d0d0d2buttmagd2(order,omegac,sample,size,out) dbuttmags(order,omegac,sample,size[1],out) +#define u80u80d2buttmagd2(order,omegac,sample,size,out) u8buttmags(order,omegac,sample,size[1],out) + +#endif /* !INT_BUTTMAG_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_cheb1mag.h b/src/c/signalProcessing/interfaces/int_cheb1mag.h new file mode 100644 index 00000000..764e8c79 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_cheb1mag.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB1MAG_H__ +#define __INT_CHEB1MAG_H__ + +#define d0d0d0d2cheb1magd2(n,omegac,epsilon,sample,size,out) dcheb1mags(n,omegac,epsilon,sample,size[1],out) + +#endif /* !__INT_CHEB1MAG_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_cheb2mag.h b/src/c/signalProcessing/interfaces/int_cheb2mag.h new file mode 100644 index 00000000..b63db04d --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_cheb2mag.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB2MAG_H__ +#define __INT_CHEB2MAG_H__ + +#define d0d0d0d2cheb2magd2(n,omegar,A,sample,size,oup) dcheb2mags(n,omegar,A,sample,size[1],oup) + +#endif /* !__INT_CHEB2MAG_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_dct.h b/src/c/signalProcessing/interfaces/int_dct.h new file mode 100644 index 00000000..ba8f42fd --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_dct.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_DCT_H__ +#define __INT_DCT_H__ + + + +#define d2d2dctd2(in,size,out) ddcta(in,size[0],size[1],-1,out) + +#define d2d0dctd2(in,size,sign,out) ddcta(in,size[0],size[1],sign,out) + +#define s2dcts2(in,size,out) sdcta(in,size[0],size[1],-1,out) + +#define s2s0dcts2(in,size,sign,out) sdcta(in,size[0],size[1],sign,out) + +#define z2dctz2(in,size,out) zdcta(in,size[0],size[1],-1,out) + +#define z2d0dctz2(in,size,sign,out) zdcta(in,size[0],size[1],sign,out) + +#define c2dctc2(in,size,out) cdcta(in,size[0],size[1],-1,out) + +#define c2s0dctc2(in,size,sign,out) cdcta(in,size[0],size[1],sign,out) + +#endif diff --git a/src/c/signalProcessing/interfaces/int_ell1mag.h b/src/c/signalProcessing/interfaces/int_ell1mag.h new file mode 100644 index 00000000..c30ffef6 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_ell1mag.h @@ -0,0 +1,19 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ELL1MAG_H__ +#define __INT_ELL1MAG_H__ + +#define d0d0z2ell1magd2(eps,m1,z,size,oup) zell1maga(eps,m1,z,size[1],oup) +#define d0d0d2ell1magd2(eps,m1,z,size,oup) dell1maga(eps,m1,z,size[1],oup) + +#endif /* !__INT_ELL1MAG_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_faurre.h b/src/c/signalProcessing/interfaces/int_faurre.h new file mode 100644 index 00000000..e527a639 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_faurre.h @@ -0,0 +1,20 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FAURRE_H__ +#define __INT_FAURRE_H__ + +#define d0d2d2d2d2faurred2d2d2(in1,in2, size2, in3, size3, in4, size4, in5, size5,out1, out2, out3) \ + dfaurrea(in1,in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1], out1, out2, out3) + + +#endif /* !INT_FAURRE_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_ffilt.h b/src/c/signalProcessing/interfaces/int_ffilt.h new file mode 100644 index 00000000..273b98f7 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_ffilt.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FFILT_H__ +#define __INT_FFILT_H__ + +#define g2d0d0d0ffiltd2(ft,size,N,fc,fh,oup) gffilts(ft,size[1],N,fc,fh,oup) + +#endif /* !__INT_FFILT_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_filt_sinc.h b/src/c/signalProcessing/interfaces/int_filt_sinc.h new file mode 100644 index 00000000..f90d0a62 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_filt_sinc.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FILT_SINC_H__ +#define __INT_FILT_SINC_H__ + +#define d0d0filt_sincd2(N,fc,oup) dfilt_sincs(N,fc,oup) + +#endif /* !__INT_FILT_SINC_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_fsfirlin.h b/src/c/signalProcessing/interfaces/int_fsfirlin.h new file mode 100644 index 00000000..3f6fb6e0 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_fsfirlin.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FSFIRLIN_H__ +#define __INT_FSFIRLIN_H__ + +#define d2d0fsfirlind2(hd,size,flag,hst) dfsfirlina(hd,size[1],flag,hst) + +#endif /* !__INT_FSFIRLIN_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_hank.h b/src/c/signalProcessing/interfaces/int_hank.h new file mode 100644 index 00000000..45ab9b62 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_hank.h @@ -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 + Author: ABHINAV Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_HANK_H__ +#define __INT_HANK_H__ + +#define d0d0d2hankd2( in1, in2, in3, size1, out) dhanka(in1, in2, in3, size1[0], size1[1], out) + +#define s0s0s2hanks2( in1, in2, in3, size1, out) shanka(in1, in2, in3, size1[0], size1[1], out) + +#endif /* !INT_HANK_! */ + diff --git a/src/c/signalProcessing/interfaces/int_idct.h b/src/c/signalProcessing/interfaces/int_idct.h new file mode 100644 index 00000000..f705fe2d --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_idct.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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_IDCT_H__ +#define __INT_IDCT_H__ + + + +#define d2idctd2(in,size,out) didcta(in,size[0],size[1],out) + +#define s2idcts2(in,size,out) sidcta(in,size[0],size[1],out) + +#define z2idctz2(in,size,out) zidcta(in,size[0],size[1],out) + +#define c2idctc2(in,size,out) cidcta(in,size[0],size[1],out) + +#endif diff --git a/src/c/signalProcessing/interfaces/int_kalm.h b/src/c/signalProcessing/interfaces/int_kalm.h new file mode 100644 index 00000000..b4369c90 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_kalm.h @@ -0,0 +1,20 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_KALM_H__ +#define __INT_KALM_H__ + +#define d2d2d2d2d2d2d2d2kalmd2d2d2d2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \ + dkalma(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\ + in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4) + +#endif /* !INT_KALM_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_modk.h b/src/c/signalProcessing/interfaces/int_modk.h new file mode 100644 index 00000000..441b9b13 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_modk.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_MODK_H__ +#define __INT_MODK_H__ + +#define d2modkd2(inp,size,oup) dmodka(inp,size[1],oup) + +#endif /* !INT_MODK_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_modsn.h b/src/c/signalProcessing/interfaces/int_modsn.h new file mode 100644 index 00000000..56c8f8cb --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_modsn.h @@ -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 + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_MODSN_H__ +#define __INT_MODSN_H__ + +#define d0d0modsnd0(uu,emmc) dmodsns(uu,emmc) +#define z0d0modsnz0(uu,emmc) zmodsns(uu,emmc) +#define d2d0modsnd2(uu,size,emmc,sn) dmodsna(uu,size[1],emmc,sn) +#define z2d0modsnz2(uu,size,emmc,sn) zmodsna(uu,size[1],emmc,sn) + +#endif /* !__INT_MODSN_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_sincd.h b/src/c/signalProcessing/interfaces/int_sincd.h new file mode 100644 index 00000000..73136730 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_sincd.h @@ -0,0 +1,19 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SINCD_H__ +#define __INT_SINCD_H__ + +#define d0d0sincdd2(n,flg,oup) dsincds(n,flg,oup) +#define u80u80sincdd2(n,flg,oup) u8sincds(n,flg,oup) + +#endif /* !__INT_SINCD_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_weiner.h b/src/c/signalProcessing/interfaces/int_weiner.h new file mode 100644 index 00000000..daefcf03 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_weiner.h @@ -0,0 +1,20 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_WIENER_H__ +#define __INT_WIENER_H__ + +#define d2d2d2d2d2d2d2d2wienerd2d2d2d2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \ + dwienera(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\ + in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4) + +#endif /* !INT_WEINER_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_window.h b/src/c/signalProcessing/interfaces/int_window.h new file mode 100644 index 00000000..77a90a2c --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_window.h @@ -0,0 +1,27 @@ +/* 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_WINDOW_H__ +#define __INT_WINDOW_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define g2d0windowd2(in1, size, in2, out) dwindowa(in1, size[0]*size[1], in2, out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_WINDOW_H__*/ diff --git a/src/c/signalProcessing/interfaces/int_zpbutt.h b/src/c/signalProcessing/interfaces/int_zpbutt.h new file mode 100644 index 00000000..775c1026 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_zpbutt.h @@ -0,0 +1,19 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPBUTT_H__ +#define __INT_ZPBUTT_H__ + +#define d0d0zpbuttz2d0(n,fl,out) dzpbutts(n,fl,out) + +#endif /* !INT_ZPBUTT_H__! */ + diff --git a/src/c/signalProcessing/interfaces/int_zpch1.h b/src/c/signalProcessing/interfaces/int_zpch1.h new file mode 100644 index 00000000..429e7c36 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_zpch1.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH1_H__ +#define __INT_ZPCH1_H__ + +#define d0d0d0zpch1z2d0(N,e,wc,out) dzpch1s(N,e,wc,out) + +#endif /* !INT_ZPCH1_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_zpch2.h b/src/c/signalProcessing/interfaces/int_zpch2.h new file mode 100644 index 00000000..fcb12a7c --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_zpch2.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH2_H__ +#define __INT_ZPCH2_H__ + +#define d0d0d0zpch2z2z2d0(N,A,omegar,zeros,poles) dzpch2s(N,A,omegar,zeros,poles) + +#endif /* !INT_ZPCH2_H__! */ diff --git a/src/c/signalProcessing/kalm/dkalma.c b/src/c/signalProcessing/kalm/dkalma.c new file mode 100644 index 00000000..d71a86a9 --- /dev/null +++ b/src/c/signalProcessing/kalm/dkalma.c @@ -0,0 +1,118 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Function to find kalm */ + +#include "lapack.h" +#include "stdlib.h" +#include "stdio.h" +#include "string.h" +#include "kalm.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include "matrixInversion.h" +#include "addition.h" +#include "subtraction.h" +#include "eye.h" + +void dkalma(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* x1, double* p1, double* x, double* p) + +{ + double k[p0_row*h_row]; + double h_trans[h_col*h_row]; + double temp1[p0_row*h_row]; + double temp2[h_row*p0_col]; + double temp3[h_row*h_row]; + double temp4[h_row*h_row]; + double temp5[h_row*h_row]; + double temp6[p0_row*p0_col]; + double temp7[p0_row*h_col]; + double temp8[p0_row*p0_col]; + double f_trans[f_col*f_row]; + double g_trans[g_col*g_row]; + double temp9 [f_row*p0_col]; + double temp10[f_row*f_row]; + double temp11 [g_row*q_col]; + double temp12[g_row*g_row]; + double temp13[h_row*x0_col]; + double temp14[h_row*x0_col]; + double temp15[p0_row*x0_col]; + + + + dtransposea(h, h_row, h_col, h_trans); + dmulma(p0, p0_row, p0_col, h_trans, h_col, h_row, temp1); //temp1= p0*h' + dmulma(h, h_row, h_col, p0, p0_row, p0_col, temp2); //temp2= h*p0 + dmulma(temp2, h_row, p0_col, h_trans, h_col, h_row, temp3); //temp3= h*p0*h' + dadda(temp3, h_row*h_row, r, r_row*r_col, temp4); //temp4= h*p0*h'+r + +/*//Debug Only*/ +/* for(int i=0; i< h_row*h_row; i++)*/ +/* printf("temp4[%d] = %lf \t",i, temp4[i]);*/ +/* printf("\n");*/ + + dinverma(temp4, temp5, h_row); //temp5= (h*p0*h'+r)**(-1) + + dmulma(temp1, p0_row, h_row, temp5, h_row, h_row, k); //k=p0*h'*(h*p0*h'+r)**(-1) + +/*//Debug Only*/ +/* for(int i=0; i< p0_row*h_row; i++)*/ +/* printf("k[%d] = %lf \t",i, k[i]);*/ +/* printf("\n");*/ + + + deyea(temp6, p0_row, p0_col); //temp6 = eye(p0) + dmulma(k, p0_row, h_row, h, h_row, h_col, temp7); //temp7 = k*h + ddiffa(temp6, p0_row*p0_col, temp7, p0_row*h_col, temp8); //temp8= eye(p0)- k*h + dmulma(temp8, p0_row, p0_col, p0, p0_row, p0_col, p); //p=(eye(p0)-k*h)*p0 + +/*//Debug Only*/ +/* for(int i=0; i< p0_row*p0_col; i++)*/ +/* printf("p[%d] = %lf \t",i, p[i]);*/ +/* printf("\n");*/ + + + dtransposea(g, g_row, g_col, g_trans); + dtransposea(f, f_row, f_col, f_trans); + dmulma(f, f_row, f_col, p, p0_row, p0_col, temp9); //temp9= f*p + dmulma(temp9, f_row, p0_col, f_trans, f_col, f_row, temp10); //temp10= f*p*f' + dmulma(g, g_row, g_col, q, q_row, q_col, temp11); //temp11= g*q + dmulma(temp11, g_row, q_col, g_trans, g_col, g_row, temp12); //temp12= g*q*g' + dadda(temp10, f_row*f_row, temp12, g_row*g_row, p1); //p1=f*p*f'+g*q*g' + +/* //Debug Only*/ +/* for(int i=0; i< f_row*f_row; i++)*/ +/* printf("p1[%d] = %lf \t",i, p1[i]);*/ +/* printf("\n");*/ + + + dmulma(h, h_row, h_col, x0, x0_row, x0_col, temp13); //temp13= h*x0 + ddiffa(y, y_row*y_col, temp13, h_row*x0_col, temp14); //temp14= y-h*x0 + dmulma(k, p0_row, h_row, temp14, h_row, x0_col, temp15); //temp15= k*(y-h*x0) + dadda(x0, x0_row*x0_col, temp15, p0_row*x0_col, x); //x=x0+k*(y-h*x0) + +/* //Debug Only*/ +/* for(int i=0; i< x0_row*x0_col; i++)*/ +/* printf("x[%d] = %lf \t",i, x[i]);*/ +/* printf("\n");*/ + + + dmulma(f, f_row, f_col, x, x0_row, x0_col, x1) ; //x1= f*x + +/* //Debug Only*/ +/* for(int i=0; i< f_row*x0_col; i++)*/ +/* printf("x1[%d] = %lf \t",i, x1[i]);*/ +/* printf("\n");*/ + + + +} diff --git a/src/c/signalProcessing/modk/dmodka.c b/src/c/signalProcessing/modk/dmodka.c new file mode 100644 index 00000000..c0630ec0 --- /dev/null +++ b/src/c/signalProcessing/modk/dmodka.c @@ -0,0 +1,97 @@ +#include<stdio.h> +#include<math.h> +#include "modk.h" +double max_calc(double* ptr,int sz) +{ + int i=0; + double mx; + if(ptr[0]<0) + { + ptr[0]=-1*ptr[0]; + } + mx=(ptr[0]); + //printf("%lf\n",mx); + for(i=1;i<sz;i++) + { + if(ptr[i]<0) + { + ptr[i]=-1*ptr[i]; + } + if(mx<(ptr[i])) + mx=(ptr[i]); + } + return mx; +} +void dmodka(double* inp,int size,double* oup) +{ + double ones[size],PI=M_PI; + double eps=pow(2,-52); + int i; + for(i=0;i<size;i++) + { + ones[i]=1; + } + double a[size],b[size],c[size],an[size],bn[size],cn[size],kans[size]; + + int j,kk,l,m; + for(j=0;j<size;j++) + { + a[j]=1; + } + for(kk=0;kk<size;kk++) + { + b[kk]=sqrt(ones[kk]-inp[kk]); + } + for(l=0;l<size;l++) + { + c[l]=sqrt(inp[l]); + + } + int x=0; + //double maxi; + //maxi=max_calc(c,size); + //printf("%lf",maxi); + + while(max_calc(c,size)>eps) + { + int q,w,r; + for(q=0;q<size;q++) + { + an[q]=0.5*(a[q]+b[q]); + } + for(w=0;w<size;w++) + { + bn[w]=sqrt(a[w]*b[w]); + } + for(r=0;r<size;r++) + { + cn[r]=0.5*(a[r]-b[r]); + } + int x,y,z; + for(x=0;x<size;x++) + { + a[x]=an[x]; + } + for(y=0;y<size;y++) + { + b[y]=bn[y]; + } + for(z=0;z<size;z++) + { + c[z]=cn[z]; + } + } + int q,w; + for(q=0;q<size;q++) + { + oup[q]=PI*(ones[q]/(2*a[q])); + } + +} +/* +int main() +{ + double m[3]={0.1,0.2,0.3}; + dka(m,3); +} +*/ diff --git a/src/c/signalProcessing/sincd/dsincds.c b/src/c/signalProcessing/sincd/dsincds.c new file mode 100644 index 00000000..c9f2f815 --- /dev/null +++ b/src/c/signalProcessing/sincd/dsincds.c @@ -0,0 +1,98 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include<math.h> +#include "sincd.h" +void dsincds(double n,double flg,double* oup) +{ + double npt=4*n; + int sz=4*n; + double PI=M_PI; + double pas=PI/npt; + double om[sz+1]; + int i; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flg==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + oup[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + oup[m]=oup[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + oup[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]/n; + } + + } +} + diff --git a/src/c/signalProcessing/sincd/int_sincd.h b/src/c/signalProcessing/sincd/int_sincd.h new file mode 100644 index 00000000..a404978b --- /dev/null +++ b/src/c/signalProcessing/sincd/int_sincd.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SINCD_H__ +#define __INT_SINCD_H__ + +#define u80sincdd2(n,flg,oup) u8sincds(n,flg,oup) + +#endif /* !__INT_SINCD_H__! */ diff --git a/src/c/signalProcessing/sincd/sincd.h b/src/c/signalProcessing/sincd/sincd.h new file mode 100644 index 00000000..2df85a87 --- /dev/null +++ b/src/c/signalProcessing/sincd/sincd.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SINCD_H__ +#define __SINCD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8sincds(int n,int flg,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINCD_H__ */ + diff --git a/src/c/signalProcessing/sincd/u8sincds.c b/src/c/signalProcessing/sincd/u8sincds.c new file mode 100644 index 00000000..ff0a2acc --- /dev/null +++ b/src/c/signalProcessing/sincd/u8sincds.c @@ -0,0 +1,97 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include<math.h> +#include "sincd.h" +void u8sincds(int n,int flg,double* oup) +{ + double npt=4*n; + int sz=4*n; + double pas=M_PI/npt; + double om[sz+1]; + int i; + //om[0]=0; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flg==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + oup[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + oup[m]=oup[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(M_PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + oup[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]/n; + } + + } +} diff --git a/src/c/signalProcessing/transforms/dct/cdcta.c b/src/c/signalProcessing/transforms/dct/cdcta.c new file mode 100644 index 00000000..7ff83645 --- /dev/null +++ b/src/c/signalProcessing/transforms/dct/cdcta.c @@ -0,0 +1,230 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "dct.h" +#include "addition.h" +#include "types.h" +#include "floatComplex.h" +#include "multiplication.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void cdcta(floatComplex *in,int row,int col,int sign,floatComplex *out) +{ + int i,j,k,u,v; + int n; + int x,y; + float res,ress,vv,ff; + float re,z,q,m; + floatComplex accu = FloatComplex(0, 0); + floatComplex temp,mm,aa,bb,cc; + if(sign==-1) + { + if(row==1) + { + n=col; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + vv = cos(((M_PI)*(y+1-1./2.)*(x))/n); + aa = FloatComplex(vv,0); + temp=cmuls(in[y],aa); + out[x]=cadds(out[x],temp); + } + } + if(x==0) + { + vv = 1./(sqrt(n)); + aa = FloatComplex(vv,0); + out[x]=cmuls(out[x],aa); + } + else + { + float res=2./n; + res = sqrt(res); + aa = FloatComplex(res,0); + out[x]=cmuls(out[x],aa); + } + } + } + } + else + { + n=col*row; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + temp=FloatComplex(0,0); + mm=FloatComplex(0,0); + for(j=0;j<col;j++) + { + y=j*row+i; + z=(float)(((float)j+1.0/2.0)*(float)v); + q=(float)(M_PI/(float)col); + vv = cos(q*z); + aa = FloatComplex(vv,0); + mm=cmuls(in[y],aa); + temp=cadds(temp,mm); + } + z=(float)(((float)i+1.0/2.0)*(float)u); + q=(float)(M_PI/(float)row); + ff = cos(q*z); + bb = FloatComplex(ff,0); + temp=cmuls(temp,bb); + out[x]=cadds(out[x],temp); + } + if(u==0) + { + vv = 1./sqrt((float)row); + aa = FloatComplex(vv,0); + out[x]=cmuls(out[x],aa); + if(v==0) + { + vv = 1./sqrt((float)col); + aa = FloatComplex(vv,0); + out[x]=cmuls(out[x],aa); + } + else + { + vv = sqrt(2./col); + aa = FloatComplex(vv,0); + out[x]=cmuls(out[x],aa); + } + } + else + { + vv = sqrt(2./row); + aa = FloatComplex(vv,0); + out[x]=cmuls(out[x],aa); + if(v==0) + { + vv = 1./sqrt((float)col); + aa = FloatComplex(vv,0); + out[x]=cmuls(out[x],aa); + } + else + { + vv = sqrt(2./col); + aa = FloatComplex(vv,0); + out[x]=cmuls(out[x],aa); + } + } + } + } + } + } + else if(sign==1) + { + n=col; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa = FloatComplex(q,0); + out[x]=cadds(out[x],cmuls(in[y],aa)); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa = FloatComplex(q,0); + out[x]=cadds(out[x],cmuls(in[y],aa)); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=FloatComplex(0,0); + temp=FloatComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(float)(((float)v+1.0/2.0)*(float)j); + q=(float)(M_PI/(float)col); + vv = cos(q*z); + aa = FloatComplex(vv,0); + mm=cmuls(mm,aa); + if(j==0) + { + vv = 1./sqrt((float)col); + aa = FloatComplex(vv,0); + temp=cadds(temp,cmuls(mm,aa)); + } + else + { + vv = sqrt(2./col); + aa = FloatComplex(vv,0); + temp=cadds(temp,cmuls(mm,aa)); + } + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + { + vv = (cos(z*q))*(1./sqrt(row)); + aa = FloatComplex(vv,0); + out[x]=cadds(out[x],cmuls(temp,aa)); + } + else + { + vv = (cos(z*q))*sqrt(2./row); + aa = FloatComplex(vv,0); + out[x]=cadds(out[x],cmuls(temp,aa)); + } + } + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/dct/ddcta.c b/src/c/signalProcessing/transforms/dct/ddcta.c new file mode 100644 index 00000000..3802c816 --- /dev/null +++ b/src/c/signalProcessing/transforms/dct/ddcta.c @@ -0,0 +1,160 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "dct.h" +/*#include <fftw3.h>*/ +#include <math.h> + +void ddcta(double *in,int row,int col,int sign,double *out) +{ + int i,j,k,u,v; + int n; + int x,y; + double res,ress; + double re,z,q,m; + if(sign==-1) + { + if(row==1) + { + n=col; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + out[x]+=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); + } + } + if(x==0) + out[x]*=1./(sqrt(n)); + else + { + double res=2./n; + out[x]*=sqrt(res); + } + } + } + } + else + { + n=col*row; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + m=(double)in[j*row+i]; + z=(double)(((double)j+1.0/2.0)*(double)v); + q=(double)(M_PI/(double)col); + re+=m*(cos(q*z)); + } + z=(double)(((double)i+1.0/2.0)*(double)u); + q=(double)(M_PI/(double)row); + out[x]+=re*(cos(q*z)); + } + if(u==0) + { + out[x]/=sqrt((double)row); + if(v==0) + out[x]/=sqrt((double)col); + else + out[x]*=sqrt(2./col); + } + else + { + out[x]*=sqrt(2./row); + if(v==0) + out[x]/=sqrt((double)col); + else + out[x]*=sqrt(2./col); + } + } + } + + } + } + else if(sign==1) + { + n=col; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + else + out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + y=row*j+i; + m=(double)in[j*row+i]; + z=(double)(((double)v+1.0/2.0)*(double)j); + q=(double)(M_PI/(double)col); + m=m*(cos(q*z)); + if(j==0) + re+=m/sqrt((double)col); + else + re+=m*sqrt(2./col); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]+=(re*(cos(z*q)))/sqrt((double)row); + else + out[x]+=(re*(cos(z*q))*sqrt(2./row)); + } + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/dct/sdcta.c b/src/c/signalProcessing/transforms/dct/sdcta.c new file mode 100644 index 00000000..9f380e8b --- /dev/null +++ b/src/c/signalProcessing/transforms/dct/sdcta.c @@ -0,0 +1,160 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "dct.h" +/*#include <fftw3.h>*/ +#include <math.h> + +void sdcta(float *in,int row,int col,int sign,float *out) +{ + int i,j,k,u,v; + int n; + int x,y; + float res,ress; + float re,z,q,m; + if(sign==-1) + { + if(row==1) + { + n=col; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + out[x]+=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); + } + } + if(x==0) + out[x]*=1./(sqrt(n)); + else + { + float res=2./n; + out[x]*=sqrt(res); + } + } + } + } + else + { + n=col*row; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + m=(float)in[j*row+i]; + z=(float)(((float)j+1.0/2.0)*(float)v); + q=(float)(M_PI/(float)col); + re+=m*(cos(q*z)); + } + z=(float)(((float)i+1.0/2.0)*(float)u); + q=(float)(M_PI/(float)row); + out[x]+=re*(cos(q*z)); + } + if(u==0) + { + out[x]/=sqrt((float)row); + if(v==0) + out[x]/=sqrt((float)col); + else + out[x]*=sqrt(2./col); + } + else + { + out[x]*=sqrt(2./row); + if(v==0) + out[x]/=sqrt((float)col); + else + out[x]*=sqrt(2./col); + } + } + } + + } + } + else if(sign==1) + { + n=col; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + else + out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + y=row*j+i; + m=(float)in[j*row+i]; + z=(float)(((float)v+1.0/2.0)*(float)j); + q=(float)(M_PI/(float)col); + m=m*(cos(q*z)); + if(j==0) + re+=m/sqrt((float)col); + else + re+=m*sqrt(2./col); + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + out[x]+=(re*(cos(z*q)))/sqrt((float)row); + else + out[x]+=(re*(cos(z*q))*sqrt(2./row)); + } + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/dct/zdcta.c b/src/c/signalProcessing/transforms/dct/zdcta.c new file mode 100644 index 00000000..3ae2e333 --- /dev/null +++ b/src/c/signalProcessing/transforms/dct/zdcta.c @@ -0,0 +1,230 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "dct.h" +#include "addition.h" +#include "types.h" +#include "doubleComplex.h" +#include "multiplication.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void zdcta(doubleComplex *in,int row,int col,int sign,doubleComplex *out) +{ + int i,j,k,u,v; + int n; + int x,y; + double res,ress,vv,ff; + double re,z,q,m; + doubleComplex accu = DoubleComplex(0, 0); + doubleComplex temp,mm,aa,bb,cc; + if(sign==-1) + { + if(row==1) + { + n=col; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + vv = cos(((M_PI)*(y+1-1./2.)*(x))/n); + aa = DoubleComplex(vv,0); + temp=zmuls(in[y],aa); + out[x]=zadds(out[x],temp); + } + } + if(x==0) + { + vv = 1./(sqrt(n)); + aa = DoubleComplex(vv,0); + out[x]=zmuls(out[x],aa); + } + else + { + double res=2./n; + res = sqrt(res); + aa = DoubleComplex(res,0); + out[x]=zmuls(out[x],aa); + } + } + } + } + else + { + n=col*row; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + temp=DoubleComplex(0,0); + mm=DoubleComplex(0,0); + for(j=0;j<col;j++) + { + y=j*row+i; + z=(double )(((double )j+1.0/2.0)*(double )v); + q=(double )(M_PI/(double )col); + vv = cos(q*z); + aa = DoubleComplex(vv,0); + mm=zmuls(in[y],aa); + temp=zadds(temp,mm); + } + z=(double )(((double )i+1.0/2.0)*(double )u); + q=(double )(M_PI/(double )row); + ff = cos(q*z); + bb = DoubleComplex(ff,0); + temp=zmuls(temp,bb); + out[x]=zadds(out[x],temp); + } + if(u==0) + { + vv = 1./sqrt((double )row); + aa = DoubleComplex(vv,0); + out[x]=zmuls(out[x],aa); + if(v==0) + { + vv = 1./sqrt((double )col); + aa = DoubleComplex(vv,0); + out[x]=zmuls(out[x],aa); + } + else + { + vv = sqrt(2./col); + aa = DoubleComplex(vv,0); + out[x]=zmuls(out[x],aa); + } + } + else + { + vv = sqrt(2./row); + aa = DoubleComplex(vv,0); + out[x]=zmuls(out[x],aa); + if(v==0) + { + vv = 1./sqrt((double )col); + aa = DoubleComplex(vv,0); + out[x]=zmuls(out[x],aa); + } + else + { + vv = sqrt(2./col); + aa = DoubleComplex(vv,0); + out[x]=zmuls(out[x],aa); + } + } + } + } + } + } + else if(sign==1) + { + n=col; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa = DoubleComplex(q,0); + out[x]=zadds(out[x],zmuls(in[y],aa)); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa = DoubleComplex(q,0); + out[x]=zadds(out[x],zmuls(in[y],aa)); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=DoubleComplex(0,0); + temp=DoubleComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(double )(((double )v+1.0/2.0)*(double )j); + q=(double )(M_PI/(double )col); + vv = cos(q*z); + aa = DoubleComplex(vv,0); + mm=zmuls(mm,aa); + if(j==0) + { + vv = 1./sqrt((double )col); + aa = DoubleComplex(vv,0); + temp=zadds(temp,zmuls(mm,aa)); + } + else + { + vv = sqrt(2./col); + aa = DoubleComplex(vv,0); + temp=zadds(temp,zmuls(mm,aa)); + } + } + z=(double )(((double )u+1.0/2.0)*(double )i); + q=(double )(M_PI/(double )row); + if(i==0) + { + vv = (cos(z*q))*(1./sqrt(row)); + aa = DoubleComplex(vv,0); + out[x]=zadds(out[x],zmuls(temp,aa)); + } + else + { + vv = (cos(z*q))*sqrt(2./row); + aa = DoubleComplex(vv,0); + out[x]=zadds(out[x],zmuls(temp,aa)); + } + } + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/idct/cidcta.c b/src/c/signalProcessing/transforms/idct/cidcta.c new file mode 100644 index 00000000..ae98ba19 --- /dev/null +++ b/src/c/signalProcessing/transforms/idct/cidcta.c @@ -0,0 +1,118 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "idct.h" +#include "addition.h" +#include "types.h" +#include "floatComplex.h" +#include "multiplication.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void cidcta(floatComplex *in,int row,int col,floatComplex *out) +{ + int i,j,k,u,v; + int n=col; + int x,y; + float res,ress,vv,ff; + float re,z,q,m; + floatComplex accu = FloatComplex(0, 0); + floatComplex temp,mm,aa,bb; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa=FloatComplex(q,0); + out[x]=cadds(out[x],cmuls(in[y],aa)); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa=FloatComplex(q,0); + out[x]=cadds(out[x],cmuls(in[y],aa)); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=FloatComplex(0,0); + temp=FloatComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(float)(((float)v+1.0/2.0)*(float)j); + q=(float)(M_PI/(float)col); + vv=cos(q*z); + aa=FloatComplex(vv,0); + mm=cmuls(mm,aa); + if(j==0) + { + vv=1./sqrt((float)col); + aa=FloatComplex(vv,0); + temp=cadds(temp,cmuls(mm,aa)); + } + else + { + vv=sqrt(2./col); + aa=FloatComplex(vv,0); + temp=cadds(temp,cmuls(mm,aa)); + } + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + { + vv=(cos(z*q))*(1./sqrt(row)); + aa=FloatComplex(vv,0); + out[x]=cadds(out[x],cmuls(temp,aa)); + } + else + { + vv=(cos(z*q))*sqrt(2./row); + aa=FloatComplex(vv,0); + out[x]=cadds(out[x],cmuls(temp,aa)); + } + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/idct/didcta.c b/src/c/signalProcessing/transforms/idct/didcta.c new file mode 100644 index 00000000..5f475160 --- /dev/null +++ b/src/c/signalProcessing/transforms/idct/didcta.c @@ -0,0 +1,83 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "idct.h" +/*#include <fftw3.h>*/ +#include <math.h> + +void didcta(double *in,int row,int col,double *out) +{ + int i,j,k,u,v; + int n=col; + int x,y; + double res,ress; + double re,z,q,m; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + else + out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + y=row*j+i; + m=(double)in[j*row+i]; + z=(double)(((double)v+1.0/2.0)*(double)j); + q=(double)(M_PI/(double)col); + m=m*(cos(q*z)); + if(j==0) + re+=m/sqrt((double)col); + else + re+=m*sqrt(2./col); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]+=(re*(cos(z*q)))/sqrt((double)row); + else + out[x]+=(re*(cos(z*q))*sqrt(2./row)); + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/idct/sidcta.c b/src/c/signalProcessing/transforms/idct/sidcta.c new file mode 100644 index 00000000..62f85da0 --- /dev/null +++ b/src/c/signalProcessing/transforms/idct/sidcta.c @@ -0,0 +1,83 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "idct.h" +/*#include <fftw3.h>*/ +#include <math.h> + +void sidcta(float *in,int row,int col,float *out) +{ + int i,j,k,u,v; + int n=col; + int x,y; + float res,ress; + float re,z,q,m; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + else + out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + y=row*j+i; + m=(float)in[j*row+i]; + z=(float)(((float)v+1.0/2.0)*(float)j); + q=(float)(M_PI/(float)col); + m=m*(cos(q*z)); + if(j==0) + re+=m/sqrt((float)col); + else + re+=m*sqrt(2./col); + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + out[x]+=(re*(cos(z*q)))/sqrt((float)row); + else + out[x]+=(re*(cos(z*q))*sqrt(2./row)); + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/idct/zidcta.c b/src/c/signalProcessing/transforms/idct/zidcta.c new file mode 100644 index 00000000..cc01c966 --- /dev/null +++ b/src/c/signalProcessing/transforms/idct/zidcta.c @@ -0,0 +1,118 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "idct.h" +#include "addition.h" +#include "types.h" +#include "doubleComplex.h" +#include "multiplication.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void zidcta(doubleComplex *in,int row,int col,doubleComplex *out) +{ + int i,j,k,u,v; + int n=col; + int x,y; + double res,ress,vv,ff; + double re,z,q,m; + doubleComplex accu = DoubleComplex(0, 0); + doubleComplex temp,mm,aa,bb; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa=DoubleComplex(q,0); + out[x]=zadds(out[x],zmuls(in[y],aa)); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + aa=DoubleComplex(q,0); + out[x]=zadds(out[x],zmuls(in[y],aa)); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=DoubleComplex(0,0); + temp=DoubleComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(double)(((double)v+1.0/2.0)*(double)j); + q=(double)(M_PI/(double)col); + vv=cos(q*z); + aa=DoubleComplex(vv,0); + mm=zmuls(mm,aa); + if(j==0) + { + vv=1./sqrt((double)col); + aa=DoubleComplex(vv,0); + temp=zadds(temp,zmuls(mm,aa)); + } + else + { + vv=sqrt(2./col); + aa=DoubleComplex(vv,0); + temp=zadds(temp,zmuls(mm,aa)); + } + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + { + vv=(cos(z*q))*(1./sqrt(row)); + aa=DoubleComplex(vv,0); + out[x]=zadds(out[x],zmuls(temp,aa)); + } + else + { + vv=(cos(z*q))*sqrt(2./row); + aa=DoubleComplex(vv,0); + out[x]=zadds(out[x],zmuls(temp,aa)); + } + } + } + } + } +} diff --git a/src/c/signalProcessing/window/dwindowa.c b/src/c/signalProcessing/window/dwindowa.c new file mode 100644 index 00000000..316f7138 --- /dev/null +++ b/src/c/signalProcessing/window/dwindowa.c @@ -0,0 +1,67 @@ +/* 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 <string.h> +#include "math.h" +#include "window.h" +#include "ones.h" +#include "abs.h" +#define PI 3.1415927 + +void dwindowa(char* inp1, int size, double n, double* out) +{ + + double no2, un[(int)n], xt[(int)n]; + + no2 = (n-1)/2; + for(int i = 0; i < n; i++) + xt[i] = -no2 + i; + + donesa(un, 1, n); + + + char tr[] = "tr", re[] = "re", hm[] = "hm", hn[] = "hn"; + double flagtr = 0; + + if(strncmp(re, inp1,2) == 0) + { + for(int i = 0; i < n; i++) + out[i] = un[i]; + } + + + + + if(strncmp(tr, inp1,2) == 0) + { + for(int i = 0; i < n; i++) + out[i] = un[i] - (2 * dabss(xt[i])) / (n+1); + } + + + + if(strncmp(hm, inp1,2) == 0) + { + for(int i = 0; i < n; i++) + out[i] = 0.54 * un[i] + 0.46 * cos(2*PI*xt[i]/(n-1)); + } + + + if(strncmp(hn, inp1,2) == 0) + { + for(int i = 0; i < n; i++) + out[i] = 0.5 * un[i] + 0.5 * cos(2*PI*xt[i]/(n-1)); + } + + + +} diff --git a/src/c/signalProcessing/zmodsns.c b/src/c/signalProcessing/zmodsns.c new file mode 100644 index 00000000..5f35059f --- /dev/null +++ b/src/c/signalProcessing/zmodsns.c @@ -0,0 +1,161 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + Reference:- Abramowitz, Milton and Stegun, Irene A + Handbook of Mathematical Functions, Dover, 1965 + Chapter 16 (Sections 16.4, 16.13 and 16.15) + Link for FORTRAN code:-http://www.aip.de/groups/soe/local/numres/bookfpdf/f6-11.pdf +*/ + +#include<stdio.h> +#include<math.h> +#include "modsn.h" +#include "doubleComplex.h" +#define CA 0.0003 + +doubleComplex zmodsns(doubleComplex uu,double emmc) +{ + doubleComplex ans; + double uur,uui; + uur=zreals(uu); + uui=zimags(uu); + double sr,cr,dr; + //Performing Elliptic Function operation for the real values + double a1,b1,c1,d1,emc1,u1; + double em1[14],en1[14]; + int i1,ii1,l1,bo1; + emc1=1-emmc; + u1=uur; + if(emc1) + { + bo1=(emc1<0.0); + if(bo1) + { + d1=1.0-emc1; + emc1/=-1.0/d1; + u1*=(d1=sqrt(d1)); + } + a1=1.0; + dr=1.0; + for(i1=1;i1<=13;i1++) + { + l1=i1; + em1[i1]=a1; + en1[i1]=(emc1=sqrt(emc1)); + c1=0.5*(a1+emc1); + if(fabs(a1-emc1)<=CA*a1)break; + emc1*=a1; + a1=c1; + } + u1*=c1; + sr=sin(u1); + cr=cos(u1); + if(sr) + { + a1=cr/sr; + c1*=a1; + for(ii1=l1;ii1>=1;ii1--) + { + b1=em1[ii1]; + a1*=c1; + c1*=dr; + dr=(en1[ii1]+a1)/(b1+a1); + a1=c1/b1; + } + a1=1.0/sqrt(c1*c1+1.0); + sr=(sr>=0.0?a1:-a1); + cr=c1*(sr); + } + if(bo1) + { + a1=dr; + dr=cr; + cr=a1; + sr/=d1; + } + } + else + { + cr=1.0/cosh(u1); + dr=cr; + sr=tanh(u1); + } + //////////////////////////////////////////////////////////////// + double si,ci,di; + //Performing Elleptic Function operation for the imaginary values + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + //double s1,c1,d1; + emc=emmc; + u=uui; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + di=1.0; + for(i=1;i<=13;i++) + { + l=i; + em[i]=a; + en[i]=(emc=sqrt(emc)); + c=0.5*(a+emc); + if(fabs(a-emc)<=CA*a)break; + emc*=a; + a=c; + } + u*=c; + si=sin(u); + ci=cos(u); + if(si) + { + a=ci/si; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=di; + di=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + si=(si>=0.0?a:-a); + ci=c*(si); + } + if(bo) + { + a=di; + di=ci; + ci=a; + si/=d; + } + } + else + { + ci=1.0/cosh(u); + di=ci; + si=tanh(u); + } + ///////////////////////////////////////////////////////// + double delta; + delta=ci*ci + emmc*sr*sr*si*si; + double snir,snii; + snir=(sr*di)/delta; + snii=(cr*dr*si*ci)/delta; + ans=DoubleComplex(snir,snii); + return ans; +} diff --git a/src/c/signalProcessing/zpbutt/dzpbutts.c b/src/c/signalProcessing/zpbutt/dzpbutts.c new file mode 100644 index 00000000..7b9fe9b4 --- /dev/null +++ b/src/c/signalProcessing/zpbutt/dzpbutts.c @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include<math.h> +#include "zpbutt.h" +#include "doubleComplex.h" +#define PI 3.14159265 +double dzpbutts(double n,double fl,doubleComplex* out) +{ + double e= PI/(2.0*(n)); + int k; + double rl,cpx,gain; + for(k=1;k<=n;k++) + { + double v=2.0*(double)k+(n)-1.0; + rl=(fl)*cos(e*v); + cpx=(fl)*sin(e*v); + out[k-1]=DoubleComplex(rl,cpx); + } + gain=pow(fl,n); + +return gain; + +} + diff --git a/src/c/signalProcessing/zpbutt/int_zpbutt.h b/src/c/signalProcessing/zpbutt/int_zpbutt.h new file mode 100644 index 00000000..72eae8a2 --- /dev/null +++ b/src/c/signalProcessing/zpbutt/int_zpbutt.h @@ -0,0 +1,19 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPBUTT_H__ +#define __INT_ZPBUTT_H__ + +#define d0d0zpbuttzada(n,fl,out,gain) dzpbutts(n,fl,out,gain) + +#endif /* !INT_ZPBUTT_H__ */ + diff --git a/src/c/signalProcessing/zpbutt/zpbutt.h b/src/c/signalProcessing/zpbutt/zpbutt.h new file mode 100644 index 00000000..6883942c --- /dev/null +++ b/src/c/signalProcessing/zpbutt/zpbutt.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPBUTT_H__ +#define __ZPBUTT_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dzpbutts(double* n,double* fl,doublecomplex* out,double* gain); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + diff --git a/src/c/signalProcessing/zpch1/dzpch1s.c b/src/c/signalProcessing/zpch1/dzpch1s.c new file mode 100644 index 00000000..ab7b6332 --- /dev/null +++ b/src/c/signalProcessing/zpch1/dzpch1s.c @@ -0,0 +1,53 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "zpch1.h" +#include "multiplication.h" +#include "conj.h" +#include "abs.h" +#define PI 3.14159265 +double dzpch1s(double N,double e,double wc,doubleComplex* out) +{ + doubleComplex accumulate,tp; + double B,r,R,gain,realVal; + double temp=sqrt(1+e*e); + + B=pow((temp+1)/e,1/N); + + r=wc*((B*B-1)/(2*B)); + R=wc*((B*B+1)/(2*B)); + + int k; + double t1=1; + double t2=0; + accumulate=DoubleComplex(t1,t2); + for(k=0;k<N;k++) + { + double theta; + theta=(PI/2)+((2*k+1)*PI)/(2*N); + double xk,yk; + xk=r*cos(theta); + yk=R*sin(theta); + out[k]=DoubleComplex(xk,yk); + tp=DoubleComplex(xk,yk); + accumulate=zmuls(accumulate,tp); + } + + realVal=zreals(accumulate); + gain=dabss(realVal); + if (N==2*(int)(N/2)) + gain=gain/sqrt(1+e*e); +return gain; + +} + diff --git a/src/c/signalProcessing/zpch1/int_zpch1.h b/src/c/signalProcessing/zpch1/int_zpch1.h new file mode 100644 index 00000000..8933d1a2 --- /dev/null +++ b/src/c/signalProcessing/zpch1/int_zpch1.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH1_H__ +#define __INT_ZPCH1_H__ + +#define d0d0d0zpch1z2d0(N,e,wc) dzpch1s(N,e,wc) + +#endif /* !INT_ZPCH1_H__! */ diff --git a/src/c/signalProcessing/zpch1/zpch1.h b/src/c/signalProcessing/zpch1/zpch1.h new file mode 100644 index 00000000..fbe850cc --- /dev/null +++ b/src/c/signalProcessing/zpch1/zpch1.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH1_H__ +#define __ZPCH1_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch1s(double N,double e,double wc,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH1_H__ */ diff --git a/src/c/signalProcessing/zpch2/dzpch2s.c b/src/c/signalProcessing/zpch2/dzpch2s.c new file mode 100644 index 00000000..22a46a64 --- /dev/null +++ b/src/c/signalProcessing/zpch2/dzpch2s.c @@ -0,0 +1,63 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "zpch2.h" +#include "multiplication.h" +#include "abs.h" +#include "division.h" +#define PI 3.14159265 +double dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles) +{ + int k,j; + double e,xk,realVal,gain; + doubleComplex accumulate1,accumulate2,tp1,tp2; + accumulate1=DoubleComplex(1,0); + accumulate2=DoubleComplex(1,0); + int ct=0; + for(k=1;k<=N;k++) + { + if(k!=((N+1)/2)) + { + ct++; + double num=PI*(2*k-1); + double den=2*N; + xk=cos(num/den); + double sk=omegar/xk; + zeros[k-1]=DoubleComplex(0,sk); + tp1=DoubleComplex(0,sk); + accumulate1=zmuls(accumulate1,tp1); + } + } + for(j=1;j<=N;j++) + { + double num=PI*(2*j-1); + double den=2*N; + double xk1=num/den; + double Gamma=pow((A+sqrt(A*A-1)),(1/N)); + double alpha=-((Gamma-1/Gamma)/2)*sin(xk1); + double Beta=((Gamma+1/Gamma)/2)*cos(xk1); + double normal=alpha*alpha+Beta*Beta; + poles[j-1]=DoubleComplex((omegar*alpha)/normal,(omegar*Beta)/normal); + tp2=DoubleComplex((omegar*alpha)/normal,(omegar*Beta)/normal); + accumulate2=zmuls(accumulate2,tp2); + } + double qt; + double ra2=zreals(accumulate2); + double ra1=zreals(accumulate1); + qt=dldivs(ra1,ra2); + gain=dabss(qt); + + return gain; + +} + diff --git a/src/c/signalProcessing/zpch2/int_zpch2.h b/src/c/signalProcessing/zpch2/int_zpch2.h new file mode 100644 index 00000000..683a7614 --- /dev/null +++ b/src/c/signalProcessing/zpch2/int_zpch2.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH2_H__ +#define __INT_ZPCH2_H__ + +#define d0d0d0zpch2z2z2(N,A,omegar,zeros,poles) dzpch2s(N,A,omegar,zeros,poles) + +#endif /* !INT_ZPCH2_H__! */ diff --git a/src/c/signalProcessing/zpch2/zpch2.h b/src/c/signalProcessing/zpch2/zpch2.h new file mode 100644 index 00000000..0d191d5c --- /dev/null +++ b/src/c/signalProcessing/zpch2/zpch2.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH2_H__ +#define __ZPCH2_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH2_H__ */ 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__*/ diff --git a/src/c/statisticsFunctions/center/dcentera.c b/src/c/statisticsFunctions/center/dcentera.c new file mode 100644 index 00000000..87480386 --- /dev/null +++ b/src/c/statisticsFunctions/center/dcentera.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "multiplication.h" +#include "center.h" + +void dcentera (double* inp, int row, int col, double* out) +{ + double sum = 0, xbar = 0, sigma = 0; + for(int i = 0; i < row*col; i++) // Findinag the maen of all the elements of the matrix + sum += inp[i]; + xbar = sum/(row*col); + + double one[row*col]; // Creating a matrix of ones + donesa(one,row,col); + + double prod[row*col]; + for(int i = 0; i < row*col; i++) // Applying the formula (x(i,j)-xbar)/sigma + prod[i] = one[i]*xbar; + + for(int i = 0; i < row*col; i++) + out[i] = inp[i] - prod[i]; +} diff --git a/src/c/statisticsFunctions/center/dcentercola.c b/src/c/statisticsFunctions/center/dcentercola.c new file mode 100644 index 00000000..e92a1d29 --- /dev/null +++ b/src/c/statisticsFunctions/center/dcentercola.c @@ -0,0 +1,38 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "center.h" + +void dcentercola (double* inp, int row, int col, double* out) +{ + + double sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = 0; + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] += inp[i + j*row]; + } + } + + + for(int i = 0; i < row; i++) + xbar[i] = sum[i]/col; + + double one[col]; // Creating a matrix of ones + donesa(one,1,col); + + + double prod[row*col]; + dmulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; +} diff --git a/src/c/statisticsFunctions/center/dcenterrowa.c b/src/c/statisticsFunctions/center/dcenterrowa.c new file mode 100644 index 00000000..e6f7e3cd --- /dev/null +++ b/src/c/statisticsFunctions/center/dcenterrowa.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "center.h" + +void dcenterrowa (double* inp, int row, int col, double* out) +{ + + double sum[col], xbar[col]; + for(int i = 0; i < col; i++) + sum[i] = 0; + + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] += inp[j + i*row]; + } + } + + + + for(int i = 0; i < col; i++) + xbar[i] = sum[i]/row; + + double one[row]; // Creating a matrix of ones + donesa(one,row,1); + + double prod[row*col]; + dmulma(one, row, 1, xbar, 1, col, prod); + + + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; +} diff --git a/src/c/statisticsFunctions/center/scentera.c b/src/c/statisticsFunctions/center/scentera.c new file mode 100644 index 00000000..2b165be1 --- /dev/null +++ b/src/c/statisticsFunctions/center/scentera.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "multiplication.h" +#include "center.h" + +void scentera (float* inp, int row, int col, float* out) +{ + float sum = 0, xbar = 0, sigma = 0; + for(int i = 0; i < row*col; i++) // Findinag the maen of all the elements of the matrix + sum += inp[i]; + xbar = sum/(row*col); + + float one[row*col]; // Creating a matrix of ones + sonesa(one,row,col); + + float prod[row*col]; + for(int i = 0; i < row*col; i++) // Applying the formula (x(i,j)-xbar)/sigma + prod[i] = one[i]*xbar; + + for(int i = 0; i < row*col; i++) + out[i] = inp[i] - prod[i]; +} diff --git a/src/c/statisticsFunctions/center/scentercola.c b/src/c/statisticsFunctions/center/scentercola.c new file mode 100644 index 00000000..d5ef5eeb --- /dev/null +++ b/src/c/statisticsFunctions/center/scentercola.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "center.h" + +void scentercola (float* inp, int row, int col, float* out) +{ + + float sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = 0; + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] += inp[i + j*row]; + } + } + + for(int i = 0; i < row; i++) + xbar[i] = sum[i]/col; + + float one[col]; // Creating a matrix of ones + sonesa(one,1,col); + + + float prod[row*col]; + smulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; +} diff --git a/src/c/statisticsFunctions/center/scenterrowa.c b/src/c/statisticsFunctions/center/scenterrowa.c new file mode 100644 index 00000000..b5910cd9 --- /dev/null +++ b/src/c/statisticsFunctions/center/scenterrowa.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "center.h" + +void scenterrowa (float* inp, int row, int col, float* out) +{ + + float sum[col], xbar[col]; + for(int i = 0; i < col; i++) + sum[i] = 0; + + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] += inp[j + i*row]; + } + } + + + + for(int i = 0; i < col; i++) + xbar[i] = sum[i]/row; + + float one[row]; // Creating a matrix of ones + sonesa(one,row,1); + + float prod[row*col]; + smulma(one, row, 1, xbar, 1, col, prod); + + + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; +} diff --git a/src/c/statisticsFunctions/center/zcentera.c b/src/c/statisticsFunctions/center/zcentera.c new file mode 100644 index 00000000..22ce70d7 --- /dev/null +++ b/src/c/statisticsFunctions/center/zcentera.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "center.h" +#include "doubleComplex.h" +#include "sqrt.h" + +void zcentera (doubleComplex* inp, int row, int col, doubleComplex* out) +{ + doubleComplex sum = 0, xbar = 0, sigma = 0; + for(int i = 0; i < row*col; i++) // Findinag the maen of all the elements of the matrix + sum = zadds(sum,inp[i]); + xbar = zrdivs(sum,(row*col)); + + doubleComplex one[row*col]; // Creating a matrix of ones + zonesa(one,row,col); + + doubleComplex prod[row*col]; + for(int i = 0; i < row*col; i++) // Applying the formula (x(i,j)-xbar)/sigma + prod[i] = zmuls(one[i],xbar); + + for(int i = 0; i < row*col; i++) + out[i] = zdiffs(inp[i], prod[i]); +} diff --git a/src/c/statisticsFunctions/center/zcentercola.c b/src/c/statisticsFunctions/center/zcentercola.c new file mode 100644 index 00000000..8a838bc5 --- /dev/null +++ b/src/c/statisticsFunctions/center/zcentercola.c @@ -0,0 +1,42 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "center.h" +#include "doubleComplex.h" +#include "sqrt.h" + +void zcentercola (doubleComplex* inp, int row, int col, doubleComplex* out) +{ + + doubleComplex sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = DoubleComplex(0,0); + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] = zadds(sum[i], inp[i + j*row]); + } + } + + + for(int i = 0; i < row; i++) + xbar[i] = zrdivs(sum[i], col); + + doubleComplex one[col]; // Creating a matrix of ones + zonesa(one,1,col); + + + doubleComplex prod[row*col]; + zmulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = zdiffs(inp[i], prod[i]); +} diff --git a/src/c/statisticsFunctions/center/zcenterrowa.c b/src/c/statisticsFunctions/center/zcenterrowa.c new file mode 100644 index 00000000..cddd3403 --- /dev/null +++ b/src/c/statisticsFunctions/center/zcenterrowa.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "center.h" +#include "doubleComplex.h" +#include "sqrt.h" + +void zcenterrowa (doubleComplex* inp, int row, int col, doubleComplex* out) +{ + + doubleComplex sum[col], xbar[col]; + for(int i = 0; i < col; i++) + sum[i] = DoubleComplex(0,0); + + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] = zadds(sum[i], inp[j + i*row]); + } + } + + + + for(int i = 0; i < col; i++) + xbar[i] = zrdivs(sum[i], row); + + doubleComplex one[row]; // Creating a matrix of ones + zonesa(one,row,1); + + doubleComplex prod[row*col]; + zmulma(one, row, 1, xbar, 1, col, prod); + + + + for(int i = 0; i< row*col; i++) + out[i] = zdiffs(inp[i], prod[i]); +} diff --git a/src/c/statisticsFunctions/correl/dcorrelfres.c b/src/c/statisticsFunctions/correl/dcorrelfres.c new file mode 100644 index 00000000..7d4c718a --- /dev/null +++ b/src/c/statisticsFunctions/correl/dcorrelfres.c @@ -0,0 +1,56 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +double dcorrelfres (double* inp1, int sr1, int sc1, double* inp2, int sr2, int sc2, double* inp3, int sr3, int sc3) +{ + double p1[sr3], p2[sc3], m1 = 0, m2 = 0, s1 = 0, s2 = 0, s3 = 0, diff1[sr1*sc1], diff2[sr2*sc2], sum = 0, prod[sr3]; + + double fr[sr3*sc3]; + + for(int i = 0; i < sr3*sc3; i++) + s3 += inp3[i]; + + for(int i = 0; i < sr3*sc3; i++) + fr[i] = inp3[i]/s3; + + + + dcolumnsuma(fr, sr3, sc3, p1); + drowsuma(fr, sr3, sc3, p2); + + + + m1 = dmulv(inp1, p1, sr3); + m2 = dmulv(inp2, p2, sc3); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = pow(inp1[i] - m1, 2); + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = pow(inp2[i] - m2, 2); + + + s1 = dsqrts(dmulv(diff1, p1, sr3)); + s2 = dsqrts(dmulv(p2, diff2, sc3)); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = inp1[i] - m1; + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = inp2[i] - m2; + + dmulma(fr, sr3, sc3, diff2, sc2, 1, prod); + + return dmulv(diff1, prod, sr3)/(s1*s2); +} diff --git a/src/c/statisticsFunctions/correl/dcorrels.c b/src/c/statisticsFunctions/correl/dcorrels.c new file mode 100644 index 00000000..eda07fc1 --- /dev/null +++ b/src/c/statisticsFunctions/correl/dcorrels.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +double dcorrels (double* inp1, int sr1, int sc1, double* inp2, int sr2, int sc2) +{ + double m1 = 0, m2 = 0, s1 = 0, s2 = 0, diff1[sr1*sc1], diff2[sr2*sc2], sum = 0; + m1 = dmeana(inp1, sr1*sc1); + m2 = dmeana(inp2, sr2*sc2); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = pow(inp1[i] - m1, 2); + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = pow(inp2[i] - m2, 2); + + + s1 = dsqrts(dsuma(diff1, sr1*sc1)); + s2 = dsqrts(dsuma(diff2, sr2*sc2)); + + for(int i = 0; i < sr2*sc2; i++) + sum += (inp1[i] - m1) * (inp2[i] - m2); + + return sum / (s1*s2); +} diff --git a/src/c/statisticsFunctions/correl/scorrelfres.c b/src/c/statisticsFunctions/correl/scorrelfres.c new file mode 100644 index 00000000..2d056a5b --- /dev/null +++ b/src/c/statisticsFunctions/correl/scorrelfres.c @@ -0,0 +1,56 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +float scorrelfres (float* inp1, int sr1, int sc1, float* inp2, int sr2, int sc2, float* inp3, int sr3, int sc3) +{ + float p1[sr3], p2[sc3], m1 = 0, m2 = 0, s1 = 0, s2 = 0, s3 = 0, diff1[sr1*sc1], diff2[sr2*sc2], sum = 0, prod[sr3]; + + float fr[sr3*sc3]; + + for(int i = 0; i < sr3*sc3; i++) + s3 += inp3[i]; + + for(int i = 0; i < sr3*sc3; i++) + fr[i] = inp3[i]/s3; + + + + scolumnsuma(fr, sr3, sc3, p1); + srowsuma(fr, sr3, sc3, p2); + + + + m1 = smulv(inp1, p1, sr3); + m2 = smulv(inp2, p2, sc3); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = pow(inp1[i] - m1, 2); + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = pow(inp2[i] - m2, 2); + + + s1 = ssqrts(smulv(diff1, p1, sr3)); + s2 = ssqrts(smulv(p2, diff2, sc3)); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = inp1[i] - m1; + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = inp2[i] - m2; + + smulma(fr, sr3, sc3, diff2, sc2, 1, prod); + + return smulv(diff1, prod, sr3)/(s1*s2); +} diff --git a/src/c/statisticsFunctions/correl/scorrels.c b/src/c/statisticsFunctions/correl/scorrels.c new file mode 100644 index 00000000..892d8762 --- /dev/null +++ b/src/c/statisticsFunctions/correl/scorrels.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +float scorrels (float* inp1, int sr1, int sc1, float* inp2, int sr2, int sc2) +{ + float m1 = 0, m2 = 0, s1 = 0, s2 = 0, diff1[sr1*sc1], diff2[sr2*sc2], sum = 0; + m1 = smeana(inp1, sr1*sc1); + m2 = smeana(inp2, sr2*sc2); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = pow(inp1[i] - m1, 2); + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = pow(inp2[i] - m2, 2); + + + s1 = ssqrts(ssuma(diff1, sr1*sc1)); + s2 = ssqrts(ssuma(diff2, sr2*sc2)); + + for(int i = 0; i < sr2*sc2; i++) + sum += (inp1[i] - m1) * (inp2[i] - m2); + + return sum / (s1*s2); +} diff --git a/src/c/statisticsFunctions/correl/zcorrelfres.c b/src/c/statisticsFunctions/correl/zcorrelfres.c new file mode 100644 index 00000000..b026c58a --- /dev/null +++ b/src/c/statisticsFunctions/correl/zcorrelfres.c @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "pow.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" +#include "doubleComplex.h" + +doubleComplex zcorrelfres (doubleComplex* inp1, int sr1, int sc1, doubleComplex* inp2, int sr2, int sc2, doubleComplex* inp3, int sr3, int sc3) +{ + doubleComplex p1[sr3], p2[sc3], m1 = 0, m2 = 0, s1 = 0, s2 = 0, s3 = 0, diff1[sr1*sc1], diff2[sr2*sc2], sum = 0, prod[sr3]; + + doubleComplex fr[sr3*sc3]; + + for(int i = 0; i < sr3*sc3; i++) + s3 = zadds(s3, inp3[i]); + + for(int i = 0; i < sr3*sc3; i++) + fr[i] = zrdivs(inp3[i],s3); + + + + zcolumnsuma(fr, sr3, sc3, p1); + zrowsuma(fr, sr3, sc3, p2); + + + + m1 = zmulv(inp1, p1, sr3); + m2 = zmulv(inp2, p2, sc3); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = zpows(zdiffs(inp1[i], m1), DoubleComplex(2,0)); + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = zpows(zdiffs(inp2[i], m2), DoubleComplex(2,0)); + + + s1 = zsqrts(zmulv(diff1, p1, sr3)); + s2 = zsqrts(zmulv(p2, diff2, sc3)); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = zdiffs(inp1[i], m1); + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = zdiffs(inp2[i], m2); + + zmulma(fr, sr3, sc3, diff2, sc2, 1, prod); + + return zrdivs(zmulv(diff1, prod, sr3), zmuls(s1, s2)); +} diff --git a/src/c/statisticsFunctions/correl/zcorrels.c b/src/c/statisticsFunctions/correl/zcorrels.c new file mode 100644 index 00000000..818a6800 --- /dev/null +++ b/src/c/statisticsFunctions/correl/zcorrels.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "pow.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" +#include "doubleComplex.h" + +doubleComplex zcorrels (doubleComplex* inp1, int sr1, int sc1, doubleComplex* inp2, int sr2, int sc2) +{ + doubleComplex m1 = 0, m2 = 0, s1 = 0, s2 = 0, diff1[sr1*sc1], diff2[sr2*sc2], sum = 0; + m1 = zmeana(inp1, sr1*sc1); + m2 = zmeana(inp2, sr2*sc2); + + for(int i = 0; i < sr1*sc1; i++) + diff1[i] = zpows(zdiffs(inp1[i], m1), DoubleComplex(2,0)); + + for(int i = 0; i < sr2*sc2; i++) + diff2[i] = zpows(zdiffs(inp2[i], m2), DoubleComplex(2,0)); + + + s1 = zsqrts(zsuma(diff1, sr1*sc1)); + s2 = zsqrts(zsuma(diff2, sr2*sc2)); + + for(int i = 0; i < sr2*sc2; i++) + sum = zadds(sum, zmuls(zdiffs(inp1[i], m1), zdiffs(inp2[i], m2))); + + return zrdivs(sum, zmuls(s1,s2)); +} diff --git a/src/c/statisticsFunctions/covar/dcovars.c b/src/c/statisticsFunctions/covar/dcovars.c new file mode 100644 index 00000000..f67905ee --- /dev/null +++ b/src/c/statisticsFunctions/covar/dcovars.c @@ -0,0 +1,70 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +double dcovars (double* inp1, int sr1, int sc1, double* inp2, int sr2, int sc2, double* fre, int sr3, int sc3) +{ + double fr[sr3*sc3], s3 = 0, sfrr[sc3], p1[sc2*sc3], s1 = 0, d1[sc2] , one[sr1*sc1], p2[sc1 * sc2], p3[sr3*sc3], sfrc[sr3], p4[sr3], s2 = 0, d2[sr1*sc1], one2[sr2*sc2], p5[sr1*sc1*sr2*sc2], p6[sr1*sc1*sr2*sc2],s4 = 0; + + for(int i = 0; i < sr3*sc3; i++) + s3 += fre[i]; + + for(int i = 0; i < sr3*sc3; i++) + fr[i] = fre[i]/s3; + + drowsuma(fr, sr3, sc3, sfrr); + + for(int i = 0; i < sc3; i++) + p1[i] = inp2[i] * sfrr[i]; + + for(int i = 0; i < sc3; i++) + s1 += p1[i]; + + + + for(int i = 0; i < sc2; i++) + d1[i] = inp2[i] - s1; + + donesa(one, sr1*sc1, 1); + + dmulma(one, sr1*sc1, 1, d1, 1, sc2, p2); + + for(int i = 0; i < sr3*sc3; i++) + p3[i] = fr[i] * p2[i]; + + dcolumnsuma(fr, sr3, sc3, sfrc); + + for(int i = 0; i < sr3; i++) + p4[i] = inp1[i] * sfrc[i]; + + for(int i = 0; i < sr3; i++) + s2 += p4[i]; + + for(int i = 0; i < sr1*sc1; i++) + d2[i] = inp1[i] - s2; + + donesa(one2, 1, sr2*sc2); + + dmulma(d2, sr1*sc1, 1, one2, 1, sr2*sc2, p5); + + for(int i = 0; i < sr1*sc1*sr2*sc2; i++) + p6[i] = p5[i] * p3[i]; + + + for(int i = 0; i < sr1*sc1*sr2*sc2; i++) + s4 += p6[i]; + + + return s4; + +} diff --git a/src/c/statisticsFunctions/covar/scovars.c b/src/c/statisticsFunctions/covar/scovars.c new file mode 100644 index 00000000..daff6b94 --- /dev/null +++ b/src/c/statisticsFunctions/covar/scovars.c @@ -0,0 +1,70 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +float scovars (float* inp1, int sr1, int sc1, float* inp2, int sr2, int sc2, float* fre, int sr3, int sc3) +{ + float fr[sr3*sc3], s3 = 0, sfrr[sc3], p1[sc2*sc3], s1 = 0, d1[sc2] , one[sr1*sc1], p2[sc1 * sc2], p3[sr3*sc3], sfrc[sr3], p4[sr3], s2 = 0, d2[sr1*sc1], one2[sr2*sc2], p5[sr1*sc1*sr2*sc2], p6[sr1*sc1*sr2*sc2],s4 = 0; + + for(int i = 0; i < sr3*sc3; i++) + s3 += fre[i]; + + for(int i = 0; i < sr3*sc3; i++) + fr[i] = fre[i]/s3; + + srowsuma(fr, sr3, sc3, sfrr); + + for(int i = 0; i < sc3; i++) + p1[i] = inp2[i] * sfrr[i]; + + for(int i = 0; i < sc3; i++) + s1 += p1[i]; + + + + for(int i = 0; i < sc2; i++) + d1[i] = inp2[i] - s1; + + sonesa(one, sr1*sc1, 1); + + smulma(one, sr1*sc1, 1, d1, 1, sc2, p2); + + for(int i = 0; i < sr3*sc3; i++) + p3[i] = fr[i] * p2[i]; + + scolumnsuma(fr, sr3, sc3, sfrc); + + for(int i = 0; i < sr3; i++) + p4[i] = inp1[i] * sfrc[i]; + + for(int i = 0; i < sr3; i++) + s2 += p4[i]; + + for(int i = 0; i < sr1*sc1; i++) + d2[i] = inp1[i] - s2; + + sonesa(one2, 1, sr2*sc2); + + smulma(d2, sr1*sc1, 1, one2, 1, sr2*sc2, p5); + + for(int i = 0; i < sr1*sc1*sr2*sc2; i++) + p6[i] = p5[i] * p3[i]; + + + for(int i = 0; i < sr1*sc1*sr2*sc2; i++) + s4 += p6[i]; + + + return s4; + +} diff --git a/src/c/statisticsFunctions/covar/zcovars.c b/src/c/statisticsFunctions/covar/zcovars.c new file mode 100644 index 00000000..6adbd3c9 --- /dev/null +++ b/src/c/statisticsFunctions/covar/zcovars.c @@ -0,0 +1,71 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" +#include "doubleComplex.h" + +doubleComplex zcovars (doubleComplex* inp1, int sr1, int sc1, doubleComplex* inp2, int sr2, int sc2, doubleComplex* fre, int sr3, int sc3) +{ + doubleComplex fr[sr3*sc3], s3 = 0, sfrr[sc3], p1[sc2*sc3], s1 = 0, d1[sc2] , one[sr1*sc1], p2[sc1 * sc2], p3[sr3*sc3], sfrc[sr3], p4[sr3], s2 = 0, d2[sr1*sc1], one2[sr2*sc2], p5[sr1*sc1*sr2*sc2], p6[sr1*sc1*sr2*sc2],s4 = 0; + + for(int i = 0; i < sr3*sc3; i++) + s3 = zadds(s3, fre[i]); + + for(int i = 0; i < sr3*sc3; i++) + fr[i] = zrdivs(fre[i], s3); + + zrowsuma(fr, sr3, sc3, sfrr); + + for(int i = 0; i < sc3; i++) + p1[i] = zmuls(inp2[i], sfrr[i]); + + for(int i = 0; i < sc3; i++) + s1 = zadds(s1, p1[i]); + + + + for(int i = 0; i < sc2; i++) + d1[i] = zdiffs(inp2[i], s1); + + zonesa(one, sr1*sc1, 1); + + zmulma(one, sr1*sc1, 1, d1, 1, sc2, p2); + + for(int i = 0; i < sr3*sc3; i++) + p3[i] = fr[i] * p2[i]; + + zcolumnsuma(fr, sr3, sc3, sfrc); + + for(int i = 0; i < sr3; i++) + p4[i] = zmuls(inp1[i], sfrc[i]); + + for(int i = 0; i < sr3; i++) + s2 = zadds(s2, p4[i]); + + for(int i = 0; i < sr1*sc1; i++) + d2[i] = zdiffs(inp1[i], s2); + + zonesa(one2, 1, sr2*sc2); + + zmulma(d2, sr1*sc1, 1, one2, 1, sr2*sc2, p5); + + for(int i = 0; i < sr1*sc1*sr2*sc2; i++) + p6[i] = zmuls(p5[i], p3[i]); + + + for(int i = 0; i < sr1*sc1*sr2*sc2; i++) + s4 = zadds(s4, p6[i]); + + + return s4; + +} diff --git a/src/c/statisticsFunctions/gsort/dgsorta.c b/src/c/statisticsFunctions/gsort/dgsorta.c new file mode 100644 index 00000000..8585b54e --- /dev/null +++ b/src/c/statisticsFunctions/gsort/dgsorta.c @@ -0,0 +1,94 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void dgsorta(double *in, int size, char check, double* out) +{ + double a; double fin; double in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] < in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/dgsortcola.c b/src/c/statisticsFunctions/gsort/dgsortcola.c new file mode 100644 index 00000000..56cb3e8b --- /dev/null +++ b/src/c/statisticsFunctions/gsort/dgsortcola.c @@ -0,0 +1,44 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void dgsortcola(double *in, int row, int col, char check, double* out) +{ + double inter[col]; + double temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + + dgsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/dgsortrowa.c b/src/c/statisticsFunctions/gsort/dgsortrowa.c new file mode 100644 index 00000000..cb2b819d --- /dev/null +++ b/src/c/statisticsFunctions/gsort/dgsortrowa.c @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void dgsortrowa(double *in, int row, int col, char check, double* out) +{ + double inter[row]; + double temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + dgsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/sgsorta.c b/src/c/statisticsFunctions/gsort/sgsorta.c new file mode 100644 index 00000000..35bbc93e --- /dev/null +++ b/src/c/statisticsFunctions/gsort/sgsorta.c @@ -0,0 +1,94 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void sgsorta(float *in, int size, char check, float* out) +{ + float a; float fin; float in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] < in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/sgsortcola.c b/src/c/statisticsFunctions/gsort/sgsortcola.c new file mode 100644 index 00000000..7296f7f0 --- /dev/null +++ b/src/c/statisticsFunctions/gsort/sgsortcola.c @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void sgsortcola(float *in, int row, int col, char check, float* out) +{ + float inter[col]; + float temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + sgsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + } + + +} diff --git a/src/c/statisticsFunctions/gsort/sgsortrowa.c b/src/c/statisticsFunctions/gsort/sgsortrowa.c new file mode 100644 index 00000000..220b45a5 --- /dev/null +++ b/src/c/statisticsFunctions/gsort/sgsortrowa.c @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void sgsortrowa(float *in, int row, int col, char check, float* out) +{ + float inter[row]; + float temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + sgsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/u16gsorta.c b/src/c/statisticsFunctions/gsort/u16gsorta.c new file mode 100644 index 00000000..bca7b025 --- /dev/null +++ b/src/c/statisticsFunctions/gsort/u16gsorta.c @@ -0,0 +1,94 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void u16gsorta(uint16 *in, int size, char check, uint16* out) +{ + uint16 a; uint16 fin; uint16 in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] < in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/u16gsortcola.c b/src/c/statisticsFunctions/gsort/u16gsortcola.c new file mode 100644 index 00000000..51ac7b5e --- /dev/null +++ b/src/c/statisticsFunctions/gsort/u16gsortcola.c @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void u16gsortcola(uint16* in, int row, int col, char check, uint16* out) +{ + uint16 inter[col]; + uint16 temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + u16gsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + } + + +} diff --git a/src/c/statisticsFunctions/gsort/u16gsortrowa.c b/src/c/statisticsFunctions/gsort/u16gsortrowa.c new file mode 100644 index 00000000..c8cbf4e9 --- /dev/null +++ b/src/c/statisticsFunctions/gsort/u16gsortrowa.c @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" + +void u16gsortrowa(uint16 *in, int row, int col, char check, uint16* out) +{ + uint16 inter[row]; + uint16 temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + u16gsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/zgsorta.c b/src/c/statisticsFunctions/gsort/zgsorta.c new file mode 100644 index 00000000..0620a8cb --- /dev/null +++ b/src/c/statisticsFunctions/gsort/zgsorta.c @@ -0,0 +1,96 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "abs.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zgsorta(doubleComplex *in, int size, char check, doubleComplex* out) +{ + doubleComplex a; doubleComplex fin; doubleComplex in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + +if(check == 'i') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (zabss(in_copy[i]) > zabss(in_copy[j])) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } +} + +if(check =='d') +{ + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (zabss(in_copy[i]) < zabss(in_copy[j])) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + +} + + for(int i=0; i< size; i++) + + { + out[i]= in_copy[i]; + + } + + +} diff --git a/src/c/statisticsFunctions/gsort/zgsortcola.c b/src/c/statisticsFunctions/gsort/zgsortcola.c new file mode 100644 index 00000000..2c03623d --- /dev/null +++ b/src/c/statisticsFunctions/gsort/zgsortcola.c @@ -0,0 +1,43 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" +#include "doubleComplex.h" + +void zgsortcola(doubleComplex *in, int row, int col, char check, doubleComplex* out) +{ + doubleComplex inter[col]; + doubleComplex temp[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + zgsorta( inter, col, check, temp); + + for(int k=0; k< col; k++) + { + out[i + k*row]= temp[k]; + + } + } + + +} diff --git a/src/c/statisticsFunctions/gsort/zgsortrowa.c b/src/c/statisticsFunctions/gsort/zgsortrowa.c new file mode 100644 index 00000000..f02b0b24 --- /dev/null +++ b/src/c/statisticsFunctions/gsort/zgsortrowa.c @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "gsort.h" +#include "types.h" +#include "doubleComplex.h" + +void zgsortrowa(doubleComplex *in, int row, int col, char check, doubleComplex* out) +{ + doubleComplex inter[row]; + doubleComplex temp[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + zgsorta( inter, row, check, temp); + + for(int k=0; k< row; k++) + { + out[k + i*row]= temp[k]; + + } + + } + + +} diff --git a/src/c/statisticsFunctions/includes/center.h b/src/c/statisticsFunctions/includes/center.h new file mode 100644 index 00000000..57a109b3 --- /dev/null +++ b/src/c/statisticsFunctions/includes/center.h @@ -0,0 +1,47 @@ + /* 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 __CENTER_H__ +#define __CENTER_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcentera (double* inp, int row, int col, double* out); +void dcentercola (double* inp, int row, int col, double* out); +void dcenterrowa (double* inp, int row, int col, double* out); + +void scentera (float* inp, int row, int col, float* out); +void scentercola (float* inp, int row, int col, float* out); +void scenterrowa (float* inp, int row, int col, float* out); + +void zcentera (doubleComplex* inp, int row, int col, doubleComplex* out); +void zcentercola (doubleComplex* inp, int row, int col, doubleComplex* out); +void zcenterrowa (doubleComplex* inp, int row, int col, doubleComplex* out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CENTER_H__*/ diff --git a/src/c/statisticsFunctions/includes/correl.h b/src/c/statisticsFunctions/includes/correl.h new file mode 100644 index 00000000..8a9c0365 --- /dev/null +++ b/src/c/statisticsFunctions/includes/correl.h @@ -0,0 +1,48 @@ + /* 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 __CORREL_H__ +#define __CORREL_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dcorrels (double* inp1, int sr1, int sc1, double* inp2, int sr2, int sc2); +double dcorrelfres (double* inp1, int sr1, int sc1, double* inp2, int sr2, int sc2, double* inp3, int sr3, int sc3); + +float scorrels (float* inp1, int sr1, int sc1, float* inp2, int sr2, int sc2); +float scorrelfres (float* inp1, int sr1, int sc1, float* inp2, int sr2, int sc2, float* inp3, int sr3, int sc3); + +doubleComplex zcorrels (doubleComplex* inp1, int sr1, int sc1, doubleComplex* inp2, int sr2, int sc2); +doubleComplex zcorrelfres (doubleComplex* inp1, int sr1, int sc1, doubleComplex* inp2, int sr2, int sc2, doubleComplex* inp3, int sr3, int sc3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CORREL_H__*/ diff --git a/src/c/statisticsFunctions/includes/covar.h b/src/c/statisticsFunctions/includes/covar.h new file mode 100644 index 00000000..4f37f852 --- /dev/null +++ b/src/c/statisticsFunctions/includes/covar.h @@ -0,0 +1,43 @@ + /* 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 __COVAR_H__ +#define __COVAR_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" +#include "sum.h" +#include "correl.h" +#include "matrix.h" +#include "mean.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dcovars (double* inp1, int sr1, int sc1, double* inp2, int sr2, int sc2, double* fre, int sr3, int sc3); +float scovars (float* inp1, int sr1, int sc1, float* inp2, int sr2, int sc2, float* fre, int sr3, int sc3); +doubleComplex zcovars (doubleComplex* inp1, int sr1, int sc1, doubleComplex* inp2, int sr2, int sc2, doubleComplex* fre, int sr3, int sc3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__COVAR_H__*/ diff --git a/src/c/statisticsFunctions/includes/gsort.h b/src/c/statisticsFunctions/includes/gsort.h new file mode 100644 index 00000000..a4d0870e --- /dev/null +++ b/src/c/statisticsFunctions/includes/gsort.h @@ -0,0 +1,46 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __GSORT_H__ +#define __GSORT_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dgsorta(double *in, int size, char check, double* out); +void dgsortcola(double *in, int row, int col, char check, double* out); +void dgsortrowa(double *in, int row, int col, char check, double* out); + +void sgsorta(float *in, int size, char check, float* out); +void sgsortcola(float *in, int row, int col, char check, float* out); +void sgsortrowa(float *in, int row, int col, char check, float* out); + +void u16gsorta(uint16 *in, int size, char check, uint16* out); +void u16gsortcola(uint16 *in, int row, int col, char check, uint16* out); +void u16gsortrowa(uint16 *in, int row, int col, char check, uint16* out); + +void zgsorta(doubleComplex *in, int size, char check, doubleComplex* out); +void zgsortcola(doubleComplex *in, int row, int col, char check, doubleComplex* out); +void zgsortrowa(doubleComplex*in, int row, int col, char check, doubleComplex* out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__GSORT_H__*/ diff --git a/src/c/statisticsFunctions/includes/mad.h b/src/c/statisticsFunctions/includes/mad.h new file mode 100644 index 00000000..29032deb --- /dev/null +++ b/src/c/statisticsFunctions/includes/mad.h @@ -0,0 +1,42 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __MAD_H__ +#define __MAD_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmada(double* , int ); +void dmadrowa(double*, int, int, double*); +void dmadcola(double*, int, int, double*); + +float smada(float* , int ); +void smadrowa(float*, int, int, float*); +void smadcola(float*, int, int, float*); + +doubleComplex zmada(doubleComplex* , int ); +void zmadrowa(doubleComplex*, int, int, doubleComplex*); +void zmadcola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MAD_H__*/ diff --git a/src/c/statisticsFunctions/includes/median.h b/src/c/statisticsFunctions/includes/median.h new file mode 100644 index 00000000..accb5df0 --- /dev/null +++ b/src/c/statisticsFunctions/includes/median.h @@ -0,0 +1,46 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __MEDIAN_H__ +#define __MEDIAN_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmediana(double* , int ); +void dmedianrowa(double*, int, int, double*); +void dmediancola(double*, int, int, double*); + +float smediana(float* , int ); +void smedianrowa(float*, int, int, float*); +void smediancola(float*, int, int, float*); + +uint16 u16mediana(uint16* , int ); +void u16medianrowa(uint16*, int, int, uint16*); +void u16mediancola(uint16*, int, int, uint16*); + +doubleComplex zmediana(doubleComplex* , int ); +void zmedianrowa(doubleComplex*, int, int, doubleComplex*); +void zmediancola(doubleComplex*, int, int, doubleComplex*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MATRIX_H__*/ diff --git a/src/c/statisticsFunctions/includes/moment.h b/src/c/statisticsFunctions/includes/moment.h new file mode 100644 index 00000000..3f419d06 --- /dev/null +++ b/src/c/statisticsFunctions/includes/moment.h @@ -0,0 +1,42 @@ + /* 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 __MOMENT_H__ +#define __MOMENT_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "pow.h" +#include "addition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmoments (double* inp, int size, double ord); +void dmomentrowa (double* inp, int row, int col, double ord, double* out); +void dmomentcola (double* inp, int row, int col, double ord, double* out); + +float smoments (float* inp, int size, double ord); +void smomentrowa (float* inp, int row, int col, double ord, float* out); +void smomentcola (float* inp, int row, int col, double ord, float* out); + +doubleComplex zmoments (doubleComplex* inp, int size, double ord); +void zmomentrowa (doubleComplex* inp, int row, int col, double ord, doubleComplex* out); +void zmomentcola (doubleComplex* inp, int row, int col, double ord, doubleComplex* out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MOMENT_H__*/ diff --git a/src/c/statisticsFunctions/includes/mvcorrel.h b/src/c/statisticsFunctions/includes/mvcorrel.h new file mode 100644 index 00000000..f1ed94cd --- /dev/null +++ b/src/c/statisticsFunctions/includes/mvcorrel.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __MVCORREL_H__ +#define __MVCORREL_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmvcorrela(double* , int, int, double* ); +double dmvcorrel1a( int, int); + +void smvcorrela(float* , int, int, float* ); +float smvcorrel1a( int, int); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MVCORREL_H__*/ diff --git a/src/c/statisticsFunctions/includes/nanmedian.h b/src/c/statisticsFunctions/includes/nanmedian.h new file mode 100644 index 00000000..767dbc90 --- /dev/null +++ b/src/c/statisticsFunctions/includes/nanmedian.h @@ -0,0 +1,44 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __NANMEDIAN_H__ +#define __NANMEDIAN_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmediana (double* , int); +void dnanmedianrowa (double*, int , int, double*); +void dnanmediancola (double*, int , int, double*); + +float snanmediana (float* , int); +void snanmedianrowa (float*, int , int, float*); +void snanmediancola (float*, int , int, float*); + +doubleComplex znanmediana (doubleComplex* , int); +void znanmedianrowa (doubleComplex*, int , int, doubleComplex*); +void znanmediancola (doubleComplex*, int , int, doubleComplex*); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/statisticsFunctions/includes/nanstdev.h b/src/c/statisticsFunctions/includes/nanstdev.h new file mode 100644 index 00000000..5c140939 --- /dev/null +++ b/src/c/statisticsFunctions/includes/nanstdev.h @@ -0,0 +1,40 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __NANSTDEV_H__ +#define __NANSTDEV_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanstdeva (double* , int); +void dnanstdevrowa (double*, int , int, double*); +void dnanstdevcola (double*, int , int, double*); + +float snanstdeva (float* , int); +void snanstdevrowa (float*, int , int, float*); +void snanstdevcola (float*, int , int, float*); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/statisticsFunctions/includes/statMax.h b/src/c/statisticsFunctions/includes/statMax.h index 3538bc1a..8e5d12b9 100644 --- a/src/c/statisticsFunctions/includes/statMax.h +++ b/src/c/statisticsFunctions/includes/statMax.h @@ -14,28 +14,57 @@ #define __STAT_MAX_H__ #include "dynlib_statisticsfunctions.h" +#include "types.h" #ifdef __cplusplus extern "C" { #endif +//#define max(a,b) (a>=b?a:b) + +#define maxa(a,size1,b,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=max(a[i],b[i]);\ + } + /* -** \brief Sum of a scalar element, just returns it +** \brief max of a scalar element, just returns it */ -#define smaxs(in) in +#define smaxs(in) in #define srowmaxs(in) in #define scolumnmaxs(in) in #define smatlabmaxs(in) in /* -** \brief Sum of a scalar element, just returns it +** \brief max of a scalar element, just returns it */ -#define dmaxs(in) in +#define dmaxs(in) in #define drowmaxs(in) in #define dcolumnmaxs(in) in #define dmatlabmaxs(in) in /* +** \brief max of a scalar element, just returns it +*/ +#define u8maxs(in) (uint8)in +#define u8rowmaxs(in) (uint8)in +#define u8columnmaxs(in) (uint8)in +#define u8matlabmaxs(in) (uint8)in +#define u16maxs(in) (uint16)in +#define u16rowmaxs(in) (uint16)in +#define u16columnmaxs(in) (uint16)in +#define u16matlabmaxs(in) (uint16)in +#define i8maxs(in) (int8)in +#define i8rowmaxs(in) (int8)in +#define i8columnmaxs(in) (int8)in +#define i8matlabmaxs(in) (int8)in +#define i16maxs(in) (int16)in +#define i16rowmaxs(in) (int16)in +#define i16columnmaxs(in) (int16)in +#define i16matlabmaxs(in) (int16)in + + + +/* ** \brief Sum of a float array ** \param in the float array to process ** \param size, the size of the array @@ -55,9 +84,47 @@ EXTERN_STATFUNC double dmaxa(double *in, int size); EXTERN_STATFUNC void drowmaxa(double *in, int lines, int columns, double* out); EXTERN_STATFUNC void dcolumnmaxa(double *in, int lines, int columns, double* out); +/* +** \brief Sum of a uint8 array +** \param in the uint8 array to process +** \param size, the size of the array +** \returns the max. +*/ +EXTERN_STATFUNC uint8 u8maxa(uint8 *in, int size); +EXTERN_STATFUNC void u8rowmaxa(uint8 *in, int lines, int columns, uint8* out); +EXTERN_STATFUNC void u8columnmaxa(uint8 *in, int lines, int columns, uint8* out); + +/* +** \brief Sum of a uint16 array +** \param in the uint16 array to process +** \param size, the size of the array +** \returns the max. +*/ +EXTERN_STATFUNC uint16 u16maxa(uint16 *in, int size); +EXTERN_STATFUNC void u16rowmaxa(uint16 *in, int lines, int columns, uint16* out); +EXTERN_STATFUNC void u16columnmaxa(uint16 *in, int lines, int columns, uint16* out); + +/* +** \brief Sum of a int8 array +** \param in the int8 array to process +** \param size, the size of the array +** \returns the max. +*/ +EXTERN_STATFUNC int8 i8maxa(int8 *in, int size); +EXTERN_STATFUNC void i8rowmaxa(int8 *in, int lines, int columns, int8* out); +EXTERN_STATFUNC void i8columnmaxa(int8 *in, int lines, int columns, int8* out); + +/* +** \brief Sum of a int16 array +** \param in the int16 array to process +** \param size, the size of the array +** \returns the max. +*/ +EXTERN_STATFUNC int16 i16maxa(int16 *in, int size); +EXTERN_STATFUNC void i16rowmaxa(int16 *in, int lines, int columns, int16* out); +EXTERN_STATFUNC void i16columnmaxa(int16 *in, int lines, int columns, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif - - #endif /* !__STAT_MAX_H__ */ diff --git a/src/c/statisticsFunctions/includes/statMin.h b/src/c/statisticsFunctions/includes/statMin.h index 9528d9f4..f3b8268a 100644 --- a/src/c/statisticsFunctions/includes/statMin.h +++ b/src/c/statisticsFunctions/includes/statMin.h @@ -14,28 +14,57 @@ #define __STAT_MIN_H__ #include "dynlib_statisticsfunctions.h" +#include "types.h" #ifdef __cplusplus extern "C" { #endif +//#define min(a,b) (a<=b?a:b) + +#define mina(a,size1,b,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=min(a[i],b[i]);\ + } + /* -** \brief Sum of a scalar element, just returns it +** \brief min of a scalar element, just returns it */ #define smins(in) in #define srowmins(in) in -#define scolumnmins(in) in +#define scolumnmins(in) in #define smatlabmins(in) in /* -** \brief Sum of a scalar element, just returns it +** \brief min of a scalar element, just returns it */ #define dmins(in) in #define drowmins(in) in -#define dcolumnmins(in) in +#define dcolumnmins(in) in #define dmatlabmins(in) in /* +** \brief min of a scalar element, just returns it +*/ +#define u8mins(in) (uint8)in +#define u8rowmins(in) (uint8)in +#define u8columnmins(in) (uint8)in +#define u8matlabmins(in) (uint8)in +#define u16mins(in) (uint16)in +#define u16rowmins(in) (uint16)in +#define u16columnmins(in) (uint16)in +#define u16matlabmins(in) (uint16)in +#define i8mins(in) (int8)in +#define i8rowmins(in) (int8)in +#define i8columnmins(in) (int8)in +#define i8matlabmins(in) (int8)in +#define i16mins(in) (int16)in +#define i16rowmins(in) (int16)in +#define i16columnmins(in) (int16)in +#define i16matlabmins(in) (int16)in + + + +/* ** \brief Sum of a float array ** \param in the float array to process ** \param size, the size of the array @@ -55,9 +84,47 @@ EXTERN_STATFUNC double dmina(double *in, int size); EXTERN_STATFUNC void drowmina(double *in, int lines, int columns, double* out); EXTERN_STATFUNC void dcolumnmina(double *in, int lines, int columns, double* out); +/* +** \brief Sum of a uint8 array +** \param in the uint8 array to process +** \param size, the size of the array +** \returns the min. +*/ +EXTERN_STATFUNC uint8 u8mina(uint8 *in, int size); +EXTERN_STATFUNC void u8rowmina(uint8 *in, int lines, int columns, uint8* out); +EXTERN_STATFUNC void u8columnmina(uint8 *in, int lines, int columns, uint8* out); + +/* +** \brief Sum of a uint16 array +** \param in the uint16 array to process +** \param size, the size of the array +** \returns the min. +*/ +EXTERN_STATFUNC uint16 u16mina(uint16 *in, int size); +EXTERN_STATFUNC void u16rowmina(uint16 *in, int lines, int columns, uint16* out); +EXTERN_STATFUNC void u16columnmina(uint16 *in, int lines, int columns, uint16* out); + +/* +** \brief Sum of a int8 array +** \param in the int8 array to process +** \param size, the size of the array +** \returns the min. +*/ +EXTERN_STATFUNC int8 i8mina(int8 *in, int size); +EXTERN_STATFUNC void i8rowmina(int8 *in, int lines, int columns, int8* out); +EXTERN_STATFUNC void i8columnmina(int8 *in, int lines, int columns, int8* out); + +/* +** \brief Sum of a int16 array +** \param in the int16 array to process +** \param size, the size of the array +** \returns the min. +*/ +EXTERN_STATFUNC int16 i16mina(int16 *in, int size); +EXTERN_STATFUNC void i16rowmina(int16 *in, int lines, int columns, int16* out); +EXTERN_STATFUNC void i16columnmina(int16 *in, int lines, int columns, int16* out); + #ifdef __cplusplus } /* extern "C" */ #endif - - #endif /* !__STAT_MIN_H__ */ diff --git a/src/c/statisticsFunctions/includes/stdev.h b/src/c/statisticsFunctions/includes/stdev.h new file mode 100644 index 00000000..16b4697a --- /dev/null +++ b/src/c/statisticsFunctions/includes/stdev.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __STDEV_H__ +#define __STDEV_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dstdeva(double* , int ); +void dstdevrowa(double*, int, int, double*); +void dstdevcola(double*, int, int, double*); + +float sstdeva(float* , int ); +void sstdevrowa(float*, int, int, float*); +void sstdevcola(float*, int, int, float*); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__STDEV_H__*/ diff --git a/src/c/statisticsFunctions/includes/strange.h b/src/c/statisticsFunctions/includes/strange.h new file mode 100644 index 00000000..0c783ad0 --- /dev/null +++ b/src/c/statisticsFunctions/includes/strange.h @@ -0,0 +1,43 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __STRANGE_H__ +#define __STRANGE_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dstrangea (double* , int); +void dstrangerowa (double*, int , int, double*); +void dstrangecola (double*, int , int, double*); + +float sstrangea (float* , int); +void sstrangerowa (float*, int , int, float*); +void sstrangecola (float*, int , int, float*); + +uint16 u16strangea (uint16* , int); +void u16strangerowa (uint16*, int , int, uint16*); +void u16strangecola (uint16*, int , int, uint16*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/statisticsFunctions/includes/wcenter.h b/src/c/statisticsFunctions/includes/wcenter.h new file mode 100644 index 00000000..3919fd37 --- /dev/null +++ b/src/c/statisticsFunctions/includes/wcenter.h @@ -0,0 +1,47 @@ + /* 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 __WCENTER_H__ +#define __WCENTER_H__ +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "sqrt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dwcentera (double* inp, int row, int col, double* out); +void dwcentercola (double* inp, int row, int col, double* out); +void dwcenterrowa (double* inp, int row, int col, double* out); + +void swcentera (float* inp, int row, int col, float* out); +void swcentercola (float* inp, int row, int col, float* out); +void swcenterrowa (float* inp, int row, int col, float* out); + +void zwcentera (doubleComplex* inp, int row, int col, doubleComplex* out); +void zwcentercola (doubleComplex* inp, int row, int col, doubleComplex* out); +void zwcenterrowa (doubleComplex* inp, int row, int col, doubleComplex* out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__WCENTER_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_center.h b/src/c/statisticsFunctions/interfaces/int_center.h new file mode 100644 index 00000000..041937e0 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_center.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 __INT_CENTER_H__ +#define __INT_CENTER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2centerd2(in1,size, out) dcentera(in1,size[0],size[1],out) +#define d2g2centerd2(in1, size, in2, size2 ,out) (in2[0] == 'r') ? dcenterrowa(in1, size[0], size[1], out) : dcentercola(in1, size[0], size[1], out) +#define d2d0centerd2(in1, size, in2 ,out) (in2 == 1) ? dcenterrowa(in1, size[0], size[1], out) : dcentercola(in1, size[0], size[1], out) + +#define s2centers2(in1,size, out) scentera(in1,size[0],size[1],out) +#define s2g2centers2(in1, size, in2, size2 ,out) (in2[0] == 'r') ? scenterrowa(in1, size[0], size[1], out) : scentercola(in1, size[0], size[1], out) +#define s2d0centers2(in1, size, in2 ,out) (in2 == 1) ? scenterrowa(in1, size[0], size[1], out) : scentercola(in1, size[0], size[1], out) + +#define z2centerz2(in1,size, out) zcentera(in1,size[0],size[1],out) +#define z2g2centerz2(in1, size, in2, size2 ,out) (in2[0] == 'r') ? zcenterrowa(in1, size[0], size[1], out) : zcentercola(in1, size[0], size[1], out) +#define z2d0centerz2(in1, size, in2 ,out) (in2 == 1) ? zcenterrowa(in1, size[0], size[1], out) : zcentercola(in1, size[0], size[1], out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CENTER_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_correl.h b/src/c/statisticsFunctions/interfaces/int_correl.h new file mode 100644 index 00000000..8dd5c31e --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_correl.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 __INT_CORREL_H__ +#define __INT_CORREL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d2d2correld0(in1, size, in2, size2) dcorrels(in1, size[0], size[1], in2, size2[0], size2[1]) +#define d2d2d2correld0(in1, size, in2, size2, in3, size3) dcorrelfres(in1, size[0], size[1], in2, size2[0], size2[1], in3, size3[0], size3[1]) + +#define s2s2correls0(in1, size, in2, size2) scorrels(in1, size[0], size[1], in2, size2[0], size2[1]) +#define s2s2s2correls0(in1, size, in2, size2, in3, size3) scorrelfres(in1, size[0], size[1], in2, size2[0], size2[1], in3, size3[0], size3[1]) + +#define z2z2correlz0(in1, size, in2, size2) zcorrels(in1, size[0], size[1], in2, size2[0], size2[1]) +#define z2z2z2correlz0(in1, size, in2, size2, in3, size3) zcorrelfres(in1, size[0], size[1], in2, size2[0], size2[1], in3, size3[0], size3[1]) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CORREL_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_covar.h b/src/c/statisticsFunctions/interfaces/int_covar.h new file mode 100644 index 00000000..5ebef22f --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_covar.h @@ -0,0 +1,29 @@ + /* 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_COVAR_H__ +#define __INT_COVAR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d2d2d2covard0(in1, size, in2, size2, in3, size3) dcovars(in1, size[0], size[1], in2, size2[0], size2[1], in3, size3[0], size3[1]) +#define s2s2s2covars0(in1, size, in2, size2, in3, size3) scovars(in1, size[0], size[1], in2, size2[0], size2[1], in3, size3[0], size3[1]) +#define z2z2z2covarz0(in1, size, in2, size2, in3, size3) zcovars(in1, size[0], size[1], in2, size2[0], size2[1], in3, size3[0], size3[1]) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_COVAR_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_gsort.h b/src/c/statisticsFunctions/interfaces/int_gsort.h new file mode 100644 index 00000000..d1e9bb97 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_gsort.h @@ -0,0 +1,43 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_GSORT_H__ +#define __INT_GSORT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2gsortd2(in1, size, out) dgsorta(in1, size[0]* size[1], 'd', out) +#define d2g2gsortd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dgsortrowa(in1, size1[0], size1[1],'d', out) :dgsortcola(in1, size1[0], size1[1],'d', out) +#define d2g2g2gsortd2(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? dgsortrowa(in1, size1[0], size1[1],in3[0], out) :dgsortcola(in1, size1[0], size1[1],in3[0], out) + +#define s2gsorts2(in1, size, out) sgsorta(in1, size[0]* size[1], 'd', out) +#define s2g2gsorts2(in1, size1, in2, size2, out) (in2[0]== 'r') ? sgsortrowa(in1, size1[0], size1[1],'d', out) :sgsortcola(in1, size1[0], size1[1],'d', out) +#define s2g2g2gsorts2(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? sgsortrowa(in1, size1[0], size1[1],in3[0], out) :sgsortcola(in1, size1[0], size1[1],in3[0], out) + +#define u162gsortu162(in1, size, out) u16gsorta(in1, size[0]* size[1], 'd', out) +#define u162g2gsortu162(in1, size1, in2, size2, out) (in2[0]== 'r') ? u16gsortrowa(in1, size1[0], size1[1],'d', out) :u16gsortcola(in1, size1[0], size1[1],'d', out) +#define u162g2g2gsortu162(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? u16gsortrowa(in1, size1[0], size1[1],in3[0], out) :u16gsortcola(in1, size1[0], size1[1],in3[0], out) + +#define z2gsortz2(in1, size, out) zgsorta(in1, size[0]* size[1], 'd', out) +#define z2g2gsortz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zgsortrowa(in1, size1[0], size1[1],'d', out) :zgsortcola(in1, size1[0], size1[1],'d', out) +#define z2g2g2gsortz2(in1, size1, in2, size2, in3, size3, out) (in2[0]== 'r') ? zgsortrowa(in1, size1[0], size1[1],in3[0], out) :zgsortcola(in1, size1[0], size1[1],in3[0], out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_GSORT_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_mad.h b/src/c/statisticsFunctions/interfaces/int_mad.h new file mode 100644 index 00000000..956323da --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_mad.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_MAD_H__ +#define __INT_MAD_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2madd0(in1, size) dmada(in1, size[0]* size[1]) +#define d2g2madd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dmadrowa(in1, size1[0], size1[1], out) :dmadcola(in1, size1[0], size1[1], out) + +#define s2mads0(in1, size) smada(in1, size[0]* size[1]) +#define s2g2mads2(in1, size1, in2, size2, out) (in2[0]== 'r') ? smadrowa(in1, size1[0], size1[1], out) :smadcola(in1, size1[0], size1[1], out) + +#define z2madz0(in1, size) zmada(in1, size[0]* size[1]) +#define z2g2madz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zmadrowa(in1, size1[0], size1[1], out) :zmadcola(in1, size1[0], size1[1], out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MAD_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_median.h b/src/c/statisticsFunctions/interfaces/int_median.h new file mode 100644 index 00000000..e9f3578b --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_median.h @@ -0,0 +1,39 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_MEDIAN_H__ +#define __INT_MEDIAN_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2mediand0(in1, size) dmediana(in1, size[0]* size[1]) +#define d2g2mediand2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dmedianrowa(in1, size1[0], size1[1], out) :dmediancola(in1, size1[0], size1[1], out) + +#define s2medians0(in1, size) smediana(in1, size[0]* size[1]) +#define s2g2medians2(in1, size1, in2, size2, out) (in2[0]== 'r') ? smedianrowa(in1, size1[0], size1[1], out) :smediancola(in1, size1[0], size1[1], out) + +#define u162medianu160(in1, size) u16mediana(in1, size[0]* size[1]) +#define u162g2medianu162(in1, size1, in2, size2, out) (in2[0]== 'r') ? u16medianrowa(in1, size1[0], size1[1], out) :u16mediancola(in1, size1[0], size1[1], out) + +#define z2medianz0(in1, size) zmediana(in1, size[0]* size[1]) +#define z2g2medianz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zmedianrowa(in1, size1[0], size1[1], out) :zmediancola(in1, size1[0], size1[1], out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MEDIAN_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_moment.h b/src/c/statisticsFunctions/interfaces/int_moment.h new file mode 100644 index 00000000..5e9a0362 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_moment.h @@ -0,0 +1,33 @@ + /* 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_MOMENT_H__ +#define __INT_MOMENT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2d0momentd0(in1,size,in2) dmoments(in1,size[0]*size[1], in2) +#define d2d0g2momentd2(in1, size, in2, in3, size2 ,out) (in3[0] == 'r') ? dmomentrowa(in1, size[0], size[1], in2, out) : dmomentcola(in1, size[0], size[1], in2, out) + +#define s2d0moments0(in1,size,in2) smoments(in1,size[0]*size[1], in2) +#define s2d0g2moments2(in1, size, in2, in3, size2 ,out) (in3[0] == 'r') ? smomentrowa(in1, size[0], size[1], in2, out) : smomentcola(in1, size[0], size[1], in2, out) + +#define z2d0momentz0(in1,size,in2) zmoments(in1,size[0]*size[1], in2) +#define z2d0g2momentz2(in1, size, in2, in3, size2 ,out) (in3[0] == 'r') ? zmomentrowa(in1, size[0], size[1], in2, out) : zmomentcola(in1, size[0], size[1], in2, out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MOMENT_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_mvcorrel.h b/src/c/statisticsFunctions/interfaces/int_mvcorrel.h new file mode 100644 index 00000000..481841fb --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_mvcorrel.h @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_MVCORREL_H__ +#define __INT_MVCORREL_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2mvcorreld2(in1, size, out) dmvcorrela(in1, size[0] ,size[1], out) +#define d2mvcorreld0(in1, size) dmvcorrel1a( size[0], size[1] ) +#define d0mvcorreld0(in1) dmvcorrel1a( 1,1 ) + +#define s2mvcorrels2(in1, size, out) smvcorrela(in1, size[0] ,size[1], out) +#define s2mvcorrels0(in1, size) smvcorrel1a( size[0], size[1] ) +#define s0mvcorrels0(in1) smvcorrel1a( 1,1 ) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MVCORREL_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_nanmedian.h b/src/c/statisticsFunctions/interfaces/int_nanmedian.h new file mode 100644 index 00000000..6fd08b46 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_nanmedian.h @@ -0,0 +1,26 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_NANMEDIAN_H__ +#define __INT_NANMEDIAN_H__ + +#define d2nanmediand0(in1, size) dnanmediana(in1,size[0]* size[1]) +#define d2g2nanmediand2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmedianrowa(in1, size1[0], size1[1], out) : dnanmediancola(in1, size1[0] , size1[1], out) + +#define s2nanmedians0(in1, size) snanmediana(in1,size[0]* size[1]) +#define s2g2nanmedians2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanmedianrowa(in1, size1[0], size1[1], out) : snanmediancola(in1, size1[0] , size1[1], out) + +#define z2nanmedianz0(in1, size) znanmediana(in1,size[0]* size[1]) +#define z2g2nanmedianz2(in1, size1, in2, size2, out) (in2[0]=='r') ? znanmedianrowa(in1, size1[0], size1[1], out) : znanmediancola(in1, size1[0] , size1[1], out) + + +#endif diff --git a/src/c/statisticsFunctions/interfaces/int_nanstdev.h b/src/c/statisticsFunctions/interfaces/int_nanstdev.h new file mode 100644 index 00000000..1d652ee1 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_nanstdev.h @@ -0,0 +1,23 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_NANSTDEV_H__ +#define __INT_NANSTDEV_H__ + +#define d2nanstdevd0(in1, size) dnanstdeva(in1,size[0]* size[1]) +#define d2g2nanstdevd2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanstdevrowa(in1, size1[0], size1[1], out) : dnanstdevcola(in1, size1[0] , size1[1], out) + +#define s2nanstdevs0(in1, size) snanstdeva(in1,size[0]* size[1]) +#define s2g2nanstdevs2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanstdevrowa(in1, size1[0], size1[1], out) : snanstdevcola(in1, size1[0] , size1[1], out) + + +#endif diff --git a/src/c/statisticsFunctions/interfaces/int_statMax.h b/src/c/statisticsFunctions/interfaces/int_statMax.h new file mode 100644 index 00000000..6d28186b --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_statMax.h @@ -0,0 +1,161 @@ +/* + * 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 + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_STATMAX_H__ +#define __INT_STATMAX_H__ +//#ifndef __INT_MAX_H__ +//#define __INT_MAX_H__ + +#define s0maxs0(in) in + +#define d0maxd0(in) in + +#define u80maxu80(in) (uint8)in + +#define u160maxu160(in) (uint16)in + +#define i80maxi80(in) (int8)in + +#define i160maxi160(in) (int16)in + +#define s2maxs0(in,size) smaxa(in, size[0]*size[1]) + +#define d2maxd0(in,size) dmaxa(in, size[0]*size[1]) + +#define c2maxc0(in,size) cmaxa(in, size[0]*size[1]) + +#define z2maxz0(in,size) zmaxa(in, size[0]*size[1]) + +#define u82maxu80(in,size) u8maxa(in, size[0]*size[1]) + +#define u162maxu160(in,size) u16maxa(in, size[0]*size[1]) + +#define i82maxi80(in,size) i8maxa(in, size[0]*size[1]) + +#define i162maxi160(in,size) i16maxa(in, size[0]*size[1]) + + + +#define s0s0maxs0(in1,in2) max(in1,in2) + +#define d0d0maxd0(in1,in2) max(in1,in2) + +#define u80u80maxu80(in1,in2) max(in1,in2) + +#define u160u160maxu160(in1,in2) max(in1,in2) + +#define i80i80maxi80(in1,in2) max(in1,in2) + +#define i160i160maxi160(in1,in2) max(in1,in2) + +#define s2s2maxs2(in1,size1,in2,size2,out) maxa(in1, size1, in2, size2, out) + +#define d2d2maxd2(in1,size1,in2,size2,out) maxa(in1, size1, in2, size2, out) + +#define u82u82maxu82(in1,size1,in2,size2,out) maxa(in1, size1, in2, size2, out) + +#define u162u162maxu162(in1,size1,in2,size2,out) maxa(in1, size1, in2, size2, out) + +#define i82i82maxi82(in1,size1,in2,size2,out) maxa(in1, size1, in2, size2, out) + +#define i162i162maxi162(in1,size1,in2,size2,out) maxa(in1, size1, in2, size2, out) + + +#define s2s0maxs2(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1[i],in2);\ + } + +#define d2d0maxd2(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1[i],in2);\ + } + +#define u82u80maxu82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1[i],in2);\ + } + +#define u162u160maxu162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1[i],in2);\ + } + +#define i82i80maxi82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1[i],in2);\ + } + +#define i162i160maxi162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1[i],in2);\ + } + +#define s0s2maxs2(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1,in2[i]);\ + } + +#define d0d2maxd2(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1,in2[i]);\ + } + +#define u80u82maxu82(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1,in2[i]);\ + } + +#define u160u162maxu162(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1,in2[i]);\ + } + +#define i80i82maxi82(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1,in2[i]);\ + } + +#define i160i162maxi162(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=max(in1,in2[i]);\ + } + +/*'r' and 'c' case */ +#define s0g2maxs0(in1,in2,size2) (in2[0]=='r') ? srowmaxs(in1) : scolumnmaxs(in1) + +#define d0g2maxd0(in1,in2,size2) (in2[0]=='r') ? drowmaxs(in1) : dcolumnmaxs(in1) + +#define c0g2maxc0(in1,in2,size2) (in2[0]=='r') ? crowmaxs(in1) : ccolumnmaxs(in1) + +#define z0g2maxz0(in1,in2,size2) (in2[0]=='r') ? zrowmaxs(in1) : zcolumnmaxs(in1) + +#define u80g2maxu80(in1,in2,size2) (in2[0]=='r') ? u8rowmaxs(in1) : u8columnmaxs(in1) + +#define u160g2maxu160(in1,in2,size2) (in2[0]=='r') ? u16rowmaxs(in1) : u16columnmaxs(in1) + +#define i80g2maxi80(in1,in2,size2) (in2[0]=='r') ? i8rowmaxs(in1) : i8columnmaxs(in1) + +#define i160g2maxi160(in1,in2,size2) (in2[0]=='r') ? i16rowmaxs(in1) : i16columnmaxs(in1) + + +#define s2g2maxs2(in1,size1,in2,size2,out) (in2[0]=='r') ? srowmaxa(in1,size1[0],size1[1],out) : scolumnmaxa(in1,size1[0],size1[1],out) + +#define d2g2maxd2(in1,size1,in2,size2,out) (in2[0]=='r') ? drowmaxa(in1,size1[0],size1[1],out) : dcolumnmaxa(in1,size1[0],size1[1],out) + +#define c2g2maxc2(in1,size1,in2,size2,out) (in2[0]=='r') ? crowmaxa(in1,size1[0],size1[1],out) : ccolumnmaxa(in1,size1[0],size1[1],out) + +#define z2g2maxz2(in1,size1,in2,size2,out) (in2[0]=='r') ? zrowmaxa(in1,size1[0],size1[1],out) : zcolumnmaxa(in1,size1[0],size1[1],out) + +#define u82g2maxu82(in1,size1,in2,size2,out) (in2[0]=='r') ? u8rowmaxa(in1,size1[0],size1[1],out) : u8columnmaxa(in1,size1[0],size1[1],out) + +#define u162g2maxu162(in1,size1,in2,size2,out) (in2[0]=='r') ? u16rowmaxa(in1,size1[0],size1[1],out) : u16columnmaxa(in1,size1[0],size1[1],out) + +#define i82g2maxi82(in1,size1,in2,size2,out) (in2[0]=='r') ? i8rowmaxa(in1,size1[0],size1[1],out) : i8columnmaxa(in1,size1[0],size1[1],out) + +#define i162g2maxi162(in1,size1,in2,size2,out) (in2[0]=='r') ? i16rowmaxa(in1,size1[0],size1[1],out) : i16columnmaxa(in1,size1[0],size1[1],out) + + + + + +#endif /* !__INT_STATMAX_H__ */ diff --git a/src/c/statisticsFunctions/interfaces/int_statMin.h b/src/c/statisticsFunctions/interfaces/int_statMin.h new file mode 100644 index 00000000..39187efe --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_statMin.h @@ -0,0 +1,162 @@ +/* + * 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 + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_STATMIN_H__ +#define __INT_STATMIN_H__ +//#ifndef __INT_MIN_H__ +//#define __INT_MIN_H__ + +#define s0mins0(in) in + +#define d0mind0(in) in + +#define u80minu80(in) (uint8)in + +#define u160minu160(in) (uint16)in + +#define i80mini80(in) (int8)in + +#define i160mini160(in) (int16)in + +#define s2mins0(in,size) smina(in, size[0]*size[1]) + +#define d2mind0(in,size) dmina(in, size[0]*size[1]) + +#define c2minc0(in,size) cmina(in, size[0]*size[1]) + +#define z2minz0(in,size) zmina(in, size[0]*size[1]) + +#define u82minu80(in,size) u8mina(in, size[0]*size[1]) + +#define u162minu160(in,size) u16mina(in, size[0]*size[1]) + +#define i82mini80(in,size) i8mina(in, size[0]*size[1]) + +#define i162mini160(in,size) i16mina(in, size[0]*size[1]) + + + +#define s0s0mins0(in1,in2) min(in1,in2) + +#define d0d0mind0(in1,in2) min(in1,in2) + +#define u80u80minu80(in1,in2) min(in1,in2) + +#define u160u160minu160(in1,in2) min(in1,in2) + +#define i80i80mini80(in1,in2) min(in1,in2) + +#define i160i160mini160(in1,in2) min(in1,in2) + +#define s2s2mins2(in1,size1,in2,size2,out) mina(in1, size1, in2, size2, out) + +#define d2d2mind2(in1,size1,in2,size2,out) mina(in1, size1, in2, size2, out) + +#define u82u82minu82(in1,size1,in2,size2,out) mina(in1, size1, in2, size2, out) + +#define u162u162minu162(in1,size1,in2,size2,out) mina(in1, size1, in2, size2, out) + +#define i82i82mini82(in1,size1,in2,size2,out) mina(in1, size1, in2, size2, out) + +#define i162i162mini162(in1,size1,in2,size2,out) mina(in1, size1, in2, size2, out) + + +#define s2s0mins2(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1[i],in2);\ + } + +#define d2d0mind2(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1[i],in2);\ + } + +#define u82u80minu82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1[i],in2);\ + } + +#define u162u160minu162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1[i],in2);\ + } + +#define i82i80mini82(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1[i],in2);\ + } + +#define i162i160mini162(in1,size,in2,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1[i],in2);\ + } + +#define s0s2mins2(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1,in2[i]);\ + } + +#define d0d2mind2(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1,in2[i]);\ + } + +#define u80u82minu82(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1,in2[i]);\ + } + +#define u160u162minu162(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1,in2[i]);\ + } + +#define i80i82mini82(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1,in2[i]);\ + } + +#define i160i162mini162(in1,in2,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=min(in1,in2[i]);\ + } + + +/*'r' and 'c' case */ +#define s0g2mins0(in1,in2,size2) (in2[0]=='r') ? srowmins(in1) : scolumnmins(in1) + +#define d0g2mind0(in1,in2,size2) (in2[0]=='r') ? drowmins(in1) : dcolumnmins(in1) + +#define c0g2minc0(in1,in2,size2) (in2[0]=='r') ? crowmins(in1) : ccolumnmins(in1) + +#define z0g2minz0(in1,in2,size2) (in2[0]=='r') ? zrowmins(in1) : zcolumnmins(in1) + +#define u80g2minu80(in1,in2,size2) (in2[0]=='r') ? u8rowmins(in1) : u8columnmins(in1) + +#define u160g2minu160(in1,in2,size2) (in2[0]=='r') ? u16rowmins(in1) : u16columnmins(in1) + +#define i80g2mini80(in1,in2,size2) (in2[0]=='r') ? i8rowmins(in1) : i8columnmins(in1) + +#define i160g2mini160(in1,in2,size2) (in2[0]=='r') ? i16rowmins(in1) : i16columnmins(in1) + + +#define s2g2mins2(in1,size,in2,size2,out) (in2[0]=='r') ? srowmina(in1,size[0],size[1],out) : scolumnmina(in1,size[0],size[1],out) + +#define d2g2mind2(in1,size,in2,size2,out) (in2[0]=='r') ? drowmina(in1,size[0],size[1],out) : dcolumnmina(in1,size[0],size[1],out) + +#define c2g2minc2(in1,size,in2,size2,out) (in2[0]=='r') ? crowmina(in1,size[0],size[1],out) : ccolumnmina(in1,size[0],size[1],out) + +#define z2g2minz2(in1,size,in2,size2,out) (in2[0]=='r') ? zrowmina(in1,size[0],size[1],out) : zcolumnmina(in1,size[0],size[1],out) + +#define u82g2minu82(in1,size,in2,size2,out) (in2[0]=='r') ? u8rowmina(in1,size[0],size[1],out) : u8columnmina(in1,size[0],size[1],out) + +#define u162g2minu162(in1,size,in2,size2,out) (in2[0]=='r') ? u16rowmina(in1,size[0],size[1],out) : u16columnmina(in1,size[0],size[1],out) + +#define i82g2mini82(in1,size,in2,size2,out) (in2[0]=='r') ? i8rowmina(in1,size[0],size[1],out) : i8columnmina(in1,size[0],size[1],out) + +#define i162g2mini162(in1,size,in2,size2,out) (in2[0]=='r') ? i16rowmina(in1,size[0],size[1],out) : i16columnmina(in1,size[0],size[1],out) + + + + + +#endif /* !__INT_STATMIN_H__ */ diff --git a/src/c/statisticsFunctions/interfaces/int_stdev.h b/src/c/statisticsFunctions/interfaces/int_stdev.h new file mode 100644 index 00000000..1e0b6a36 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_stdev.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __INT_STDEV_H__ +#define __INT_STDEV_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2stdevd0(in1, size) dstdeva(in1, size[0]* size[1]) +#define d2g2stdevd2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dstdevrowa(in1, size1[0], size1[1], out) :dstdevcola(in1, size1[0], size1[1], out) + +#define s2stdevs0(in1, size) sstdeva(in1, size[0]* size[1]) +#define s2g2stdevs2(in1, size1, in2, size2, out) (in2[0]== 'r') ? sstdevrowa(in1, size1[0], size1[1], out) :sstdevcola(in1, size1[0], size1[1], out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_STDEV_H__*/ diff --git a/src/c/statisticsFunctions/interfaces/int_strange.h b/src/c/statisticsFunctions/interfaces/int_strange.h new file mode 100644 index 00000000..133ec2b6 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_strange.h @@ -0,0 +1,26 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_STRANGE_H__ +#define __INT_STRANGE_H__ + +#define d2stranged0(in1, size) dstrangea(in1,size[0]* size[1]) +#define d2g2stranged2(in1, size1, in2, size2, out) (in2[0]=='r') ? dstrangerowa(in1, size1[0], size1[1], out) : dstrangecola(in1, size1[0] , size1[1], out) + +#define s2stranges0(in1, size) sstrangea(in1,size[0]* size[1]) +#define s2g2stranges2(in1, size1, in2, size2, out) (in2[0]=='r') ? sstrangerowa(in1, size1[0], size1[1], out) : sstrangecola(in1, size1[0] , size1[1], out) + +#define u162strangeu160(in1, size) u16strangea(in1,size[0]* size[1]) +#define u162g2strangeu162(in1, size1, in2, size2, out) (in2[0]=='r') ? u16strangerowa(in1, size1[0], size1[1], out) : u16strangecola(in1, size1[0] , size1[1], out) + + +#endif diff --git a/src/c/statisticsFunctions/interfaces/int_wcenter.h b/src/c/statisticsFunctions/interfaces/int_wcenter.h new file mode 100644 index 00000000..38273af1 --- /dev/null +++ b/src/c/statisticsFunctions/interfaces/int_wcenter.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 __INT_WCENTER_H__ +#define __INT_WCENTER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2wcenterd2(in1,size, out) dwcentera(in1,size[0],size[1],out) +#define d2g2wcenterd2(in1, size, in2, size2 ,out) (in2[0] == 'r') ? dwcenterrowa(in1, size[0], size[1], out) : dwcentercola(in1, size[0], size[1], out) +#define d2d0wcenterd2(in1, size, in2 ,out) (in2 == 1) ? dwcenterrowa(in1, size[0], size[1], out) : dwcentercola(in1, size[0], size[1], out) + +#define s2wcenters2(in1,size, out) swcentera(in1,size[0],size[1],out) +#define s2g2wcenters2(in1, size, in2, size2 ,out) (in2[0] == 'r') ? swcenterrowa(in1, size[0], size[1], out) : swcentercola(in1, size[0], size[1], out) +#define s2d0wcenters2(in1, size, in2 ,out) (in2 == 1) ? swcenterrowa(in1, size[0], size[1], out) : swcentercola(in1, size[0], size[1], out) + +#define z2wcenterz2(in1,size, out) zwcentera(in1,size[0],size[1],out) +#define z2g2wcenterz2(in1, size, in2, size2 ,out) (in2[0] == 'r') ? zwcenterrowa(in1, size[0], size[1], out) : zwcentercola(in1, size[0], size[1], out) +#define z2d0wcenterz2(in1, size, in2 ,out) (in2 == 1) ? zwcenterrowa(in1, size[0], size[1], out) : zwcentercola(in1, size[0], size[1], out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_WCENTER_H__*/ diff --git a/src/c/statisticsFunctions/mad/dmada.c b/src/c/statisticsFunctions/mad/dmada.c new file mode 100644 index 00000000..907f78a8 --- /dev/null +++ b/src/c/statisticsFunctions/mad/dmada.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +double dmada(double *in, int size) +{ + double fin = 0; double mean; + + mean= dmeana(in, size); + + for(int i=0; i< size; i++) + { + + fin = dadds(fin, dabss(mean-in[i])); + + } + +fin= fin/size; + + + return fin; +} diff --git a/src/c/statisticsFunctions/mad/dmadcola.c b/src/c/statisticsFunctions/mad/dmadcola.c new file mode 100644 index 00000000..381f85ca --- /dev/null +++ b/src/c/statisticsFunctions/mad/dmadcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void dmadcola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dmada( inter, col); + + } +} diff --git a/src/c/statisticsFunctions/mad/dmadrowa.c b/src/c/statisticsFunctions/mad/dmadrowa.c new file mode 100644 index 00000000..2b47ba06 --- /dev/null +++ b/src/c/statisticsFunctions/mad/dmadrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void dmadrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dmada( inter, row); + + } + +} diff --git a/src/c/statisticsFunctions/mad/smada.c b/src/c/statisticsFunctions/mad/smada.c new file mode 100644 index 00000000..241e337d --- /dev/null +++ b/src/c/statisticsFunctions/mad/smada.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +float smada(float *in, int size) +{ + float fin = 0; float mean; + + mean= smeana(in, size); + + for(int i=0; i< size; i++) + { + + fin = sadds(fin, sabss(mean-in[i])); + + } + +fin= fin/size; + + + return fin; +} diff --git a/src/c/statisticsFunctions/mad/smadcola.c b/src/c/statisticsFunctions/mad/smadcola.c new file mode 100644 index 00000000..c6f5e753 --- /dev/null +++ b/src/c/statisticsFunctions/mad/smadcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void smadcola(float* in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= smada( inter, col); + + } +} diff --git a/src/c/statisticsFunctions/mad/smadrowa.c b/src/c/statisticsFunctions/mad/smadrowa.c new file mode 100644 index 00000000..3fbd917b --- /dev/null +++ b/src/c/statisticsFunctions/mad/smadrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "uint16.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void smadrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= smada( inter, row); + + } + +} diff --git a/src/c/statisticsFunctions/mad/zmada.c b/src/c/statisticsFunctions/mad/zmada.c new file mode 100644 index 00000000..9531e3b7 --- /dev/null +++ b/src/c/statisticsFunctions/mad/zmada.c @@ -0,0 +1,40 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "doubleComplex.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" +#include "subtraction.h" +#include "division.h" + +doubleComplex zmada(doubleComplex *in, int size) +{ + doubleComplex fin = DoubleComplex(0,0); doubleComplex mean; + + mean= zmeana(in, size); + + for(int i=0; i< size; i++) + { + + fin = zadds(fin, zabss(zdiffs(mean,in[i]))); + + } + +fin= zrdivs(fin,size); + + + return fin; +} diff --git a/src/c/statisticsFunctions/mad/zmadcola.c b/src/c/statisticsFunctions/mad/zmadcola.c new file mode 100644 index 00000000..a70841b3 --- /dev/null +++ b/src/c/statisticsFunctions/mad/zmadcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "doubleComplex.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void zmadcola(doubleComplex* in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= zmada( inter, col); + + } +} diff --git a/src/c/statisticsFunctions/mad/zmadrowa.c b/src/c/statisticsFunctions/mad/zmadrowa.c new file mode 100644 index 00000000..c279322c --- /dev/null +++ b/src/c/statisticsFunctions/mad/zmadrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mad.h" +#include "types.h" +#include "doubleComplex.h" +#include "mean.h" +#include "addition.h" +#include "abs.h" + +void zmadrowa(doubleComplex* in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= zmada( inter, row); + + } + +} diff --git a/src/c/statisticsFunctions/max/dcolumnmaxa.c b/src/c/statisticsFunctions/max/dcolumnmaxa.c index ae0bbd47..ec717778 100644 --- a/src/c/statisticsFunctions/max/dcolumnmaxa.c +++ b/src/c/statisticsFunctions/max/dcolumnmaxa.c @@ -16,9 +16,10 @@ void dcolumnmaxa(double *in, int rows, int columns, double* out) { int i = 0, j = 0; for (i = 0; i < rows; i++) { - out[i]=in[i]; + out[i]=in[i*columns]; for (j=0;j<columns;j++) - if (in[i+j*rows]>out[i]) out[i] = in[i+j*rows]; + if (in[i+j*rows]>out[i]) + out[i] = in[i+j*rows]; } } diff --git a/src/c/statisticsFunctions/max/dmaxa.c b/src/c/statisticsFunctions/max/dmaxa.c index 5e2145e3..7292f3cd 100644 --- a/src/c/statisticsFunctions/max/dmaxa.c +++ b/src/c/statisticsFunctions/max/dmaxa.c @@ -18,7 +18,8 @@ double dmaxa(double *in, int size) { for (i = 1; i < size; ++i) { - if (in[i]>out) out = in[i]; + if (in[i]>out) + out = in[i]; } return out; diff --git a/src/c/statisticsFunctions/max/drowmaxa.c b/src/c/statisticsFunctions/max/drowmaxa.c index a3099231..596c535f 100644 --- a/src/c/statisticsFunctions/max/drowmaxa.c +++ b/src/c/statisticsFunctions/max/drowmaxa.c @@ -14,10 +14,11 @@ void drowmaxa(double *in, int rows, int columns, double* out) { int i = 0, j = 0; - - for (i = 0; i < columns; i++) { + for (i = 0; i < columns; i++) + { out[i]=in[i*rows]; for (j = 1 ; j < rows ; j++) - if (in[i*rows+j]>out[i]) out[i] = in[i*rows+j]; + if (in[i*rows+j]>out[i]) + out[i] = in[i*rows+j]; } } diff --git a/src/c/statisticsFunctions/max/i16columnmaxa.c b/src/c/statisticsFunctions/max/i16columnmaxa.c new file mode 100644 index 00000000..87cc579c --- /dev/null +++ b/src/c/statisticsFunctions/max/i16columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i16columnmaxa(int16 *in, int rows, int columns, int16* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(int16)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) + out[i] = (int16)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/max/i16maxa.c b/src/c/statisticsFunctions/max/i16maxa.c new file mode 100644 index 00000000..b2eab344 --- /dev/null +++ b/src/c/statisticsFunctions/max/i16maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +int16 i16maxa(int16 *in, int size) { + int16 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (int16)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/i16rowmaxa.c b/src/c/statisticsFunctions/max/i16rowmaxa.c new file mode 100644 index 00000000..46c4ae29 --- /dev/null +++ b/src/c/statisticsFunctions/max/i16rowmaxa.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i16rowmaxa(int16 *in, int rows, int columns, int16* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(int16)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]>out[i]) + out[i] = (int16)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/max/i8columnmaxa.c b/src/c/statisticsFunctions/max/i8columnmaxa.c new file mode 100644 index 00000000..6c7ea25c --- /dev/null +++ b/src/c/statisticsFunctions/max/i8columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i8columnmaxa(int8 *in, int rows, int columns, int8* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(int8)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) + out[i] = (int8)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/max/i8maxa.c b/src/c/statisticsFunctions/max/i8maxa.c new file mode 100644 index 00000000..d57b9957 --- /dev/null +++ b/src/c/statisticsFunctions/max/i8maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + +int8 i8maxa(int8 *in, int size) { + int8 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (int8)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/i8rowmaxa.c b/src/c/statisticsFunctions/max/i8rowmaxa.c new file mode 100644 index 00000000..677c61c7 --- /dev/null +++ b/src/c/statisticsFunctions/max/i8rowmaxa.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void i8rowmaxa(int8 *in, int rows, int columns, int8* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(int8)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]>out[i]) + out[i] = (int8)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/max/scolumnmaxa.c b/src/c/statisticsFunctions/max/scolumnmaxa.c index 71af8460..185ab985 100644 --- a/src/c/statisticsFunctions/max/scolumnmaxa.c +++ b/src/c/statisticsFunctions/max/scolumnmaxa.c @@ -16,7 +16,7 @@ void scolumnmaxa(float *in, int rows, int columns, float* out) { int i = 0, j = 0; for (i = 0; i < rows; i++) { - out[i]=in[i]; + out[i]=in[i*columns]; for (j=0;j<columns;j++) if (in[i+j*rows]>out[i]) out[i] = in[i+j*rows]; } diff --git a/src/c/statisticsFunctions/max/smaxa.c b/src/c/statisticsFunctions/max/smaxa.c index f47fcffe..3410faea 100644 --- a/src/c/statisticsFunctions/max/smaxa.c +++ b/src/c/statisticsFunctions/max/smaxa.c @@ -9,9 +9,9 @@ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * */ - #include "statMax.h" + float smaxa(float *in, int size) { float out = in[0]; int i = 0; diff --git a/src/c/statisticsFunctions/max/srowmaxa.c b/src/c/statisticsFunctions/max/srowmaxa.c index c87ccf7f..8f3b30ee 100644 --- a/src/c/statisticsFunctions/max/srowmaxa.c +++ b/src/c/statisticsFunctions/max/srowmaxa.c @@ -9,9 +9,9 @@ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * */ - #include "statMax.h" + void srowmaxa(float *in, int rows, int columns, float* out) { int i = 0, j = 0; diff --git a/src/c/statisticsFunctions/max/testDoubleMax.c b/src/c/statisticsFunctions/max/testDoubleMax.c index 81c50324..883b427f 100644 --- a/src/c/statisticsFunctions/max/testDoubleMax.c +++ b/src/c/statisticsFunctions/max/testDoubleMax.c @@ -11,8 +11,8 @@ */ - #include "statMax.h" +//#include "max.h" #include "assert.h" #include "stdio.h" diff --git a/src/c/statisticsFunctions/max/testFloatMax.c b/src/c/statisticsFunctions/max/testFloatMax.c index 7741aef4..cb572f7e 100644 --- a/src/c/statisticsFunctions/max/testFloatMax.c +++ b/src/c/statisticsFunctions/max/testFloatMax.c @@ -13,6 +13,7 @@ #include "statMax.h" +//#include "max.h" #include "assert.h" #include "stdio.h" diff --git a/src/c/statisticsFunctions/max/u16columnmaxa.c b/src/c/statisticsFunctions/max/u16columnmaxa.c new file mode 100644 index 00000000..5b4f4236 --- /dev/null +++ b/src/c/statisticsFunctions/max/u16columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +void u16columnmaxa(uint16 *in, int rows, int columns, uint16* out) { + int i = 0, j = 0; + + + for (i = 0; i < rows; i++) { + out[i]=(uint16)in[i]; + for (j=0;j<columns;j++) + if (in[i+j*rows]>out[i]) + out[i] = (uint16)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/max/u16maxa.c b/src/c/statisticsFunctions/max/u16maxa.c new file mode 100644 index 00000000..7c9078d5 --- /dev/null +++ b/src/c/statisticsFunctions/max/u16maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + +uint16 u16maxa(uint16 *in, int size) { + uint16 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (uint16)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/u16rowmaxa.c b/src/c/statisticsFunctions/max/u16rowmaxa.c new file mode 100644 index 00000000..eacbe848 --- /dev/null +++ b/src/c/statisticsFunctions/max/u16rowmaxa.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + +void u16rowmaxa(uint16 *in, int rows, int columns, uint16* out) { + int i = 0, j = 0; + //out = malloc(columns*sizeof(uint16)); + for (i = 0; i < columns; i++) + { + out[i]=(uint16)in[i]; + for (j = 1 ; j < rows ; j++) + { + if (in[j*columns+i]>out[i]) + out[i] = (uint16)in[j*columns+i]; + } + } + +} diff --git a/src/c/statisticsFunctions/max/u8columnmaxa.c b/src/c/statisticsFunctions/max/u8columnmaxa.c new file mode 100644 index 00000000..ac9bc086 --- /dev/null +++ b/src/c/statisticsFunctions/max/u8columnmaxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + + +void u8columnmaxa(uint8 *in, int rows, int columns, uint8* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) +{ + out[i]=(uint8)in[0]; + for (j=0;j<columns;j++) + if (in[j]>out[i]) + out[i] = (uint8)in[j]; + } + +} diff --git a/src/c/statisticsFunctions/max/u8maxa.c b/src/c/statisticsFunctions/max/u8maxa.c new file mode 100644 index 00000000..3f84af41 --- /dev/null +++ b/src/c/statisticsFunctions/max/u8maxa.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMax.h" + +uint8 u8maxa(uint8 *in, int size) { + uint8 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]>out) + out = (uint8)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/max/u8rowmaxa.c b/src/c/statisticsFunctions/max/u8rowmaxa.c new file mode 100644 index 00000000..0ddae26d --- /dev/null +++ b/src/c/statisticsFunctions/max/u8rowmaxa.c @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "statMax.h" + + +void u8rowmaxa(uint8 *in, int rows, int columns, uint8* out) { + int i = 0, j = 0; + + + for (i = 0; i < columns; i++) + { + out[i]=(uint8)in[0]; + for (j = 0 ; j < rows ; j++) + { + if (in[j]>out[i]) + out[i] = (uint8)in[j]; + } + } +} diff --git a/src/c/statisticsFunctions/median/dmediana.c b/src/c/statisticsFunctions/median/dmediana.c new file mode 100644 index 00000000..8b37fd16 --- /dev/null +++ b/src/c/statisticsFunctions/median/dmediana.c @@ -0,0 +1,60 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +double dmediana(double *in, int size) +{ + double a; double fin; double in_copy[size]; +for(int i=0; i< size; i++) + in_copy[i]= in[i]; + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + + if(size%2 ==0) + { + fin= (in_copy[size/2]+ in_copy[(size/2)-1])/2; + } + else + { + fin= in_copy[(size-1)/2]; + } + + return fin; +} diff --git a/src/c/statisticsFunctions/median/dmediancola.c b/src/c/statisticsFunctions/median/dmediancola.c new file mode 100644 index 00000000..b3ff4fb8 --- /dev/null +++ b/src/c/statisticsFunctions/median/dmediancola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void dmediancola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dmediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/median/dmedianrowa.c b/src/c/statisticsFunctions/median/dmedianrowa.c new file mode 100644 index 00000000..4b5879c5 --- /dev/null +++ b/src/c/statisticsFunctions/median/dmedianrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void dmedianrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dmediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/median/smediana.c b/src/c/statisticsFunctions/median/smediana.c new file mode 100644 index 00000000..0d427e10 --- /dev/null +++ b/src/c/statisticsFunctions/median/smediana.c @@ -0,0 +1,59 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +float smediana(float *in, int size) +{ + float a; float fin; float in_copy[size]; + +for(int i=0; i< size; i++) + in_copy[i]= in[i]; + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + if(size%2 ==0) + { + fin= (in_copy[size/2]+ in_copy[(size/2)-1])/2; + } + else + { + fin= in_copy[(size-1)/2]; + } + + return fin; +} diff --git a/src/c/statisticsFunctions/median/smediancola.c b/src/c/statisticsFunctions/median/smediancola.c new file mode 100644 index 00000000..2fc4eaf1 --- /dev/null +++ b/src/c/statisticsFunctions/median/smediancola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void smediancola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= smediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/median/smedianrowa.c b/src/c/statisticsFunctions/median/smedianrowa.c new file mode 100644 index 00000000..aab59382 --- /dev/null +++ b/src/c/statisticsFunctions/median/smedianrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void smedianrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= smediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/median/u16mediana.c b/src/c/statisticsFunctions/median/u16mediana.c new file mode 100644 index 00000000..85cfedce --- /dev/null +++ b/src/c/statisticsFunctions/median/u16mediana.c @@ -0,0 +1,59 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +uint16 u16mediana(uint16 *in, int size) +{ + uint16 a; uint16 fin; uint16 in_copy[size]; + +for(int i=0; i< size; i++) + in_copy[i]= in[i]; + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + if(size%2 ==0) + { + fin= (in_copy[size/2]+ in_copy[(size/2)-1])/2; + } + else + { + fin= in_copy[(size-1)/2]; + } + + return fin; +} diff --git a/src/c/statisticsFunctions/median/u16mediancola.c b/src/c/statisticsFunctions/median/u16mediancola.c new file mode 100644 index 00000000..77952a35 --- /dev/null +++ b/src/c/statisticsFunctions/median/u16mediancola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void u16mediancola(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= u16mediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/median/u16medianrowa.c b/src/c/statisticsFunctions/median/u16medianrowa.c new file mode 100644 index 00000000..8e5b98ef --- /dev/null +++ b/src/c/statisticsFunctions/median/u16medianrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" + +void u16medianrowa(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= u16mediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/median/zmediana.c b/src/c/statisticsFunctions/median/zmediana.c new file mode 100644 index 00000000..36804562 --- /dev/null +++ b/src/c/statisticsFunctions/median/zmediana.c @@ -0,0 +1,66 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +#include "addition.h" +#include "division.h" +#include "abs.h" + +doubleComplex zmediana(doubleComplex *in, int size) +{ + doubleComplex a; doubleComplex fin; doubleComplex middle; doubleComplex in_copy[size]; + +for(int i=0; i< size; i++) + in_copy[i]= in[i]; + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (zabss(in_copy[i]) > zabss(in_copy[j])) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + + + if(size%2 ==0) + { + middle= zadds(in_copy[size/2], in_copy[(size/2)-1]); + fin= zrdivs(middle, DoubleComplex(2,0)); + } + else + { + fin= in_copy[(size-1)/2]; + } + + return fin; +} diff --git a/src/c/statisticsFunctions/median/zmediancola.c b/src/c/statisticsFunctions/median/zmediancola.c new file mode 100644 index 00000000..d709d98b --- /dev/null +++ b/src/c/statisticsFunctions/median/zmediancola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zmediancola(doubleComplex *in, int row, int col, doubleComplex * out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= zmediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/median/zmedianrowa.c b/src/c/statisticsFunctions/median/zmedianrowa.c new file mode 100644 index 00000000..ab2e0d4a --- /dev/null +++ b/src/c/statisticsFunctions/median/zmedianrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "median.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void zmedianrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= zmediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/min/dcolumnmina.c b/src/c/statisticsFunctions/min/dcolumnmina.c index e12cb8ff..6f0b3c1a 100644 --- a/src/c/statisticsFunctions/min/dcolumnmina.c +++ b/src/c/statisticsFunctions/min/dcolumnmina.c @@ -16,7 +16,7 @@ void dcolumnmina(double *in, int rows, int columns, double* out) { int i = 0, j = 0; for (i = 0; i < rows; i++) { - out[i]=in[i]; + out[i]=in[i*columns]; for (j=0;j<columns;j++) if (in[i+j*rows]<out[i]) out[i] = in[i+j*rows]; } diff --git a/src/c/statisticsFunctions/min/i16columnmina.c b/src/c/statisticsFunctions/min/i16columnmina.c new file mode 100644 index 00000000..64ec334b --- /dev/null +++ b/src/c/statisticsFunctions/min/i16columnmina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +void i16columnmina(int16 *in, int rows, int columns, int16* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(int16)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]<out[i]) + out[i] = (int16)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/min/i16mina.c b/src/c/statisticsFunctions/min/i16mina.c new file mode 100644 index 00000000..402b946e --- /dev/null +++ b/src/c/statisticsFunctions/min/i16mina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +int16 i16mina(int16 *in, int size) { + int16 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]<out) + out = (int16)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/min/i16rowmina.c b/src/c/statisticsFunctions/min/i16rowmina.c new file mode 100644 index 00000000..51f575a6 --- /dev/null +++ b/src/c/statisticsFunctions/min/i16rowmina.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +void i16rowmina(int16 *in, int rows, int columns, int16* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(int16)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]<out[i]) + out[i] = (int16)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/min/i8columnmina.c b/src/c/statisticsFunctions/min/i8columnmina.c new file mode 100644 index 00000000..041bc9b4 --- /dev/null +++ b/src/c/statisticsFunctions/min/i8columnmina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +void i8columnmina(int8 *in, int rows, int columns, int8* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(int8)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]<out[i]) + out[i] = (int8)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/min/i8mina.c b/src/c/statisticsFunctions/min/i8mina.c new file mode 100644 index 00000000..f7acac73 --- /dev/null +++ b/src/c/statisticsFunctions/min/i8mina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +int8 i8mina(int8 *in, int size) { + int8 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]<out) + out = (int8)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/min/i8rowmina.c b/src/c/statisticsFunctions/min/i8rowmina.c new file mode 100644 index 00000000..1c573823 --- /dev/null +++ b/src/c/statisticsFunctions/min/i8rowmina.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +void i8rowmina(int8 *in, int rows, int columns, int8* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(int8)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]<out[i]) + out[i] = (int8)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/min/scolumnmina.c b/src/c/statisticsFunctions/min/scolumnmina.c index 79fac41a..8e19b1de 100644 --- a/src/c/statisticsFunctions/min/scolumnmina.c +++ b/src/c/statisticsFunctions/min/scolumnmina.c @@ -16,7 +16,7 @@ void scolumnmina(float *in, int rows, int columns, float* out) { int i = 0, j = 0; for (i = 0; i < rows; i++) { - out[i]=in[i]; + out[i]=in[i*columns]; for (j=0;j<columns;j++) if (in[i+j*rows]<out[i]) out[i] = in[i+j*rows]; } diff --git a/src/c/statisticsFunctions/min/u16columnmina.c b/src/c/statisticsFunctions/min/u16columnmina.c new file mode 100644 index 00000000..1df155d2 --- /dev/null +++ b/src/c/statisticsFunctions/min/u16columnmina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +void u16columnmina(uint16 *in, int rows, int columns, uint16* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(uint16)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]<out[i]) + out[i] = (uint16)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/min/u16mina.c b/src/c/statisticsFunctions/min/u16mina.c new file mode 100644 index 00000000..e09f0449 --- /dev/null +++ b/src/c/statisticsFunctions/min/u16mina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +uint16 u16mina(uint16 *in, int size) { + uint16 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]<out) + out = (uint16)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/min/u16rowmina.c b/src/c/statisticsFunctions/min/u16rowmina.c new file mode 100644 index 00000000..dc4ba080 --- /dev/null +++ b/src/c/statisticsFunctions/min/u16rowmina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "statMin.h" + +void u16rowmina(uint16 *in, int rows, int columns, uint16* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(uint16)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]<out[i]) + out[i] = (uint16)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/min/u8columnmina.c b/src/c/statisticsFunctions/min/u8columnmina.c new file mode 100644 index 00000000..07269fa4 --- /dev/null +++ b/src/c/statisticsFunctions/min/u8columnmina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +void u8columnmina(uint8 *in, int rows, int columns, uint8* out) { + int i = 0, j = 0; + + for (i = 0; i < rows; i++) { + out[i]=(uint8)in[i*columns]; + for (j=0;j<columns;j++) + if (in[i+j*rows]<out[i]) + out[i] = (uint8)in[i+j*rows]; + } + +} diff --git a/src/c/statisticsFunctions/min/u8mina.c b/src/c/statisticsFunctions/min/u8mina.c new file mode 100644 index 00000000..579d1b3c --- /dev/null +++ b/src/c/statisticsFunctions/min/u8mina.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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +uint8 u8mina(uint8 *in, int size) { + uint8 out = in[0]; + int i = 0; + + for (i = 1; i < size; ++i) + { + if (in[i]<out) + out = (uint8)in[i]; + } + return out; + +} diff --git a/src/c/statisticsFunctions/min/u8rowmina.c b/src/c/statisticsFunctions/min/u8rowmina.c new file mode 100644 index 00000000..2f1de4f1 --- /dev/null +++ b/src/c/statisticsFunctions/min/u8rowmina.c @@ -0,0 +1,24 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "statMin.h" + +void u8rowmina(uint8 *in, int rows, int columns, uint8* out) { + int i = 0, j = 0; + + for (i = 0; i < columns; i++) { + out[i]=(uint8)in[i*rows]; + for (j = 1 ; j < rows ; j++) + if (in[i*rows+j]<out[i]) + out[i] = (uint8)in[i*rows+j]; + } +} diff --git a/src/c/statisticsFunctions/moment/dmomentcola.c b/src/c/statisticsFunctions/moment/dmomentcola.c new file mode 100644 index 00000000..538328e3 --- /dev/null +++ b/src/c/statisticsFunctions/moment/dmomentcola.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" + +void dmomentcola (double* inp, int row, int col, double ord, double* out) +{ + double vect[col]; + for(int i = 0; i < row ; i++) + { + for(int j = 0; j < col ; j++) + { + vect[j] = inp[i + j*row]; + } + out[i] = dmoments(vect, col, ord); + } + +} diff --git a/src/c/statisticsFunctions/moment/dmomentrowa.c b/src/c/statisticsFunctions/moment/dmomentrowa.c new file mode 100644 index 00000000..811aac39 --- /dev/null +++ b/src/c/statisticsFunctions/moment/dmomentrowa.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" + +void dmomentrowa (double* inp, int row, int col, double ord, double* out) +{ + double vect[row]; + for(int i = 0; i < col ; i++) + { + for(int j = 0; j < row ; j++) + { + vect[j] = inp[j + i*row]; + } + out[i] = dmoments(vect, row, ord); + } + +} diff --git a/src/c/statisticsFunctions/moment/dmoments.c b/src/c/statisticsFunctions/moment/dmoments.c new file mode 100644 index 00000000..779ffa0f --- /dev/null +++ b/src/c/statisticsFunctions/moment/dmoments.c @@ -0,0 +1,17 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" + + +double dmoments (double* inp, int size, double ord) +{ + double sum = 0; + + for(int i = 0; i < size; i++) // Elements are raised to the order and then their mean is calculated to give moment + { + sum = sum + pow(inp[i], ord); + } + + return sum/size; +} diff --git a/src/c/statisticsFunctions/moment/smomentcola.c b/src/c/statisticsFunctions/moment/smomentcola.c new file mode 100644 index 00000000..4255782c --- /dev/null +++ b/src/c/statisticsFunctions/moment/smomentcola.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" + +void smomentcola (float* inp, int row, int col, double ord, float* out) +{ + float vect[col]; + for(int i = 0; i < row ; i++) + { + for(int j = 0; j < col ; j++) + { + vect[j] = inp[i + j*row]; + } + out[i] = smoments(vect, col, ord); + } + +} diff --git a/src/c/statisticsFunctions/moment/smomentrowa.c b/src/c/statisticsFunctions/moment/smomentrowa.c new file mode 100644 index 00000000..574ebe76 --- /dev/null +++ b/src/c/statisticsFunctions/moment/smomentrowa.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" + +void smomentrowa (float* inp, int row, int col, double ord, float* out) +{ + float vect[row]; + for(int i = 0; i < col ; i++) + { + for(int j = 0; j < row ; j++) + { + vect[j] = inp[j + i*row]; + } + out[i] = smoments(vect, row, ord); + } + +} diff --git a/src/c/statisticsFunctions/moment/smoments.c b/src/c/statisticsFunctions/moment/smoments.c new file mode 100644 index 00000000..c900d815 --- /dev/null +++ b/src/c/statisticsFunctions/moment/smoments.c @@ -0,0 +1,17 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" + + +float smoments (float* inp, int size, double ord) +{ + float sum = 0; + + for(int i = 0; i < size; i++) // Elements are raised to the order and then their mean is calculated to give moment + { + sum = sum + pow(inp[i], ord); + } + + return sum/size; +} diff --git a/src/c/statisticsFunctions/moment/zmomentcola.c b/src/c/statisticsFunctions/moment/zmomentcola.c new file mode 100644 index 00000000..2b3cebb1 --- /dev/null +++ b/src/c/statisticsFunctions/moment/zmomentcola.c @@ -0,0 +1,20 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void zmomentcola (doubleComplex* inp, int row, int col, double ord, doubleComplex* out) +{ + double vect[col]; + for(int i = 0; i < row ; i++) + { + for(int j = 0; j < col ; j++) + { + vect[j] = inp[i + j*row]; + } + out[i] = zmoments(vect, col, ord); + } + +} diff --git a/src/c/statisticsFunctions/moment/zmomentrowa.c b/src/c/statisticsFunctions/moment/zmomentrowa.c new file mode 100644 index 00000000..e1e1b47d --- /dev/null +++ b/src/c/statisticsFunctions/moment/zmomentrowa.c @@ -0,0 +1,20 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +void zmomentrowa (doubleComplex* inp, int row, int col, double ord, doubleComplex* out) +{ + doubleComplex vect[row]; + for(int i = 0; i < col ; i++) + { + for(int j = 0; j < row ; j++) + { + vect[j] = inp[j + i*row]; + } + out[i] = zmoments(vect, row, ord); + } + +} diff --git a/src/c/statisticsFunctions/moment/zmoments.c b/src/c/statisticsFunctions/moment/zmoments.c new file mode 100644 index 00000000..b70df707 --- /dev/null +++ b/src/c/statisticsFunctions/moment/zmoments.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "moment.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "pow.h" +#include "addition.h" +#include "division.h" + + +doubleComplex zmoments (doubleComplex* inp, int size, double ord) +{ + doubleComplex sum = DoubleComplex(0,0); + + for(int i = 0; i < size; i++) // Elements are raised to the order and then their mean is calculated to give moment + { + sum = zadds(sum,zpows(inp[i], ord)); + } + + return zrdivs(sum,size); +} diff --git a/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c b/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c new file mode 100644 index 00000000..9971e0fb --- /dev/null +++ b/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mvcorrel.h" +#include "stdlib.h" +#include "stdio.h" +#include "types.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +double dmvcorrel1a(int lx, int cx) +{ + if(lx==1 && cx==1) + return 0; + + else + return 1; +} diff --git a/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c b/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c new file mode 100644 index 00000000..a1bacfdc --- /dev/null +++ b/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c @@ -0,0 +1,87 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mvcorrel.h" +#include "stdlib.h" +#include "stdio.h" +#include "pow.h" +#include "division.h" +#include "types.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +void dmvcorrela(double *in, int lx, int cx, double* r) +{ + double temp1[1* cx]; + double xbar[1* cx]; + double temp2[lx*1]; + double temp3[lx*cx]; + double temp4[lx*cx]; + double temp4_trans[cx*lx]; + double temp5[1* cx]; + double temp6[lx*cx]; + double std[1*cx]; + double std_trans[cx*1]; + double temp7[cx*cx]; + double temp8[cx*cx]; + + donesa ( temp2 , lx , 1 ); //temp2= ones(lx,1) + + if(lx==1) + { + dzerosa ( r , cx ,cx ); //out= zeros(lx,cx) + + } + + else + { + + drowsuma(in, lx, cx, temp1); //temp1= sum(x, "r") + + for(int i=0; i< 1*cx; i++) + xbar[i]= drdivs(temp1[i], lx); // xbar= sum(x, "r")/ lx +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("xbar[%d]= %lf\t", i, xbar[i]);*/ +/* printf("\n");*/ + + dmulma(temp2, lx,1, xbar, 1, cx, temp3 ); //temp3= ones(lx,1)*xbar + ddiffa(in, lx*cx, temp3, lx*cx, temp4); //temp4= r= x-ones(lx,1)*xbar + for(int i=0; i< lx*cx; i++) + temp6[i]= dpows(temp4[i], 2); //temp6= r.^2 + drowsuma(temp6, lx, cx, temp5); //temp5= sum(r.^2, "r") + for(int i=0; i< 1*cx; i++) + std[i]= dpows(temp5[i], 0.5); //std=(sum(r .^2,"r")) .^ (0.5) +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("std[%d]= %lf\t", i, std[i]);*/ +/* printf("\n"); */ + dtransposea ( temp4 , lx , cx, temp4_trans); //temp4_trans= r' + dtransposea ( std , 1 , cx, std_trans); //std_trans= std' + dmulma(temp4_trans, cx,lx, temp4, lx, cx, temp7 ); //temp7= r'*r + dmulma(std_trans, cx, 1, std, 1,cx, temp8); //temp8= std'*std + + drdiva (temp7, temp8, cx*cx, r); // r=(r'*r) ./ (std'*std) + + + } + + + +} diff --git a/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c b/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c new file mode 100644 index 00000000..345ce601 --- /dev/null +++ b/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mvcorrel.h" +#include "stdlib.h" +#include "stdio.h" +#include "types.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +float smvcorrel1a(int lx, int cx) +{ + if(lx==1 && cx==1) + return 0; + + else + return 1; +} diff --git a/src/c/statisticsFunctions/mvcorrel/smvcorrela.c b/src/c/statisticsFunctions/mvcorrel/smvcorrela.c new file mode 100644 index 00000000..8894ceeb --- /dev/null +++ b/src/c/statisticsFunctions/mvcorrel/smvcorrela.c @@ -0,0 +1,87 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "mvcorrel.h" +#include "stdlib.h" +#include "stdio.h" +#include "types.h" +#include "pow.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "division.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +void smvcorrela(float *in, int lx, int cx, float* r) +{ + float temp1[1* cx]; + float xbar[1* cx]; + float temp2[lx*1]; + float temp3[lx*cx]; + float temp4[lx*cx]; + float temp4_trans[cx*lx]; + float temp5[1* cx]; + float temp6[lx*cx]; + float std[1*cx]; + float std_trans[cx*1]; + float temp7[cx*cx]; + float temp8[cx*cx]; + + sonesa ( temp2 , lx , 1 ); //temp2= ones(lx,1) + + if(lx==1) + { + szerosa ( r , cx ,cx ); //out= zeros(lx,cx) + + } + + else + { + + srowsuma(in, lx, cx, temp1); //temp1= sum(x, "r") + + for(int i=0; i< 1*cx; i++) + xbar[i]= srdivs(temp1[i], lx); // xbar= sum(x, "r")/ lx +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("xbar[%d]= %lf\t", i, xbar[i]);*/ +/* printf("\n");*/ + + smulma(temp2, lx,1, xbar, 1, cx, temp3 ); //temp3= ones(lx,1)*xbar + sdiffa(in, lx*cx, temp3, lx*cx, temp4); //temp4= r= x-ones(lx,1)*xbar + for(int i=0; i< lx*cx; i++) + temp6[i]= spows(temp4[i], 2); //temp6= r.^2 + srowsuma(temp6, lx, cx, temp5); //temp5= sum(r.^2, "r") + for(int i=0; i< 1*cx; i++) + std[i]= spows(temp5[i], 0.5); //std=(sum(r .^2,"r")) .^ (0.5) +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("std[%d]= %lf\t", i, std[i]);*/ +/* printf("\n"); */ + stransposea ( temp4 , lx , cx, temp4_trans); //temp4_trans= r' + stransposea ( std , 1 , cx, std_trans); //std_trans= std' + smulma(temp4_trans, cx,lx, temp4, lx, cx, temp7 ); //temp7= r'*r + smulma(std_trans, cx, 1, std, 1,cx, temp8); //temp8= std'*std + + srdiva (temp7, temp8, cx*cx, r); // r=(r'*r) ./ (std'*std) + + + } + + + +} diff --git a/src/c/statisticsFunctions/nanmedian/dnanmediana.c b/src/c/statisticsFunctions/nanmedian/dnanmediana.c new file mode 100644 index 00000000..0fb7de12 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/dnanmediana.c @@ -0,0 +1,51 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmedian.h" +#include "median.h" +#include "types.h" +double dnanmediana(double* in, int size) +{ + +double temp[size]; +double out; +int j=0; + +double a= 0.0/0.0; + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= dmediana(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/src/c/statisticsFunctions/nanmedian/dnanmediancola.c b/src/c/statisticsFunctions/nanmedian/dnanmediancola.c new file mode 100644 index 00000000..37b3f128 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/dnanmediancola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmedian.h" +#include "types.h" +#include "uint16.h" + +void dnanmediancola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dnanmediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/dnanmedianrowa.c b/src/c/statisticsFunctions/nanmedian/dnanmedianrowa.c new file mode 100644 index 00000000..d24ba828 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/dnanmedianrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmedian.h" +#include "types.h" +#include "uint16.h" + +void dnanmedianrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnanmediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/snanmediana.c b/src/c/statisticsFunctions/nanmedian/snanmediana.c new file mode 100644 index 00000000..cddb990e --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/snanmediana.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmedian.h" +#include "median.h" +#include "types.h" +float snanmediana(float* in, int size) +{ + +float temp[size]; +float out; +int j=0; + +float a= 0.0/0.0; + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= smediana(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/src/c/statisticsFunctions/nanmedian/snanmediancola.c b/src/c/statisticsFunctions/nanmedian/snanmediancola.c new file mode 100644 index 00000000..a8077f19 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/snanmediancola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmedian.h" +#include "mean.h" +#include "types.h" +#include "uint16.h" + +void snanmediancola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= snanmediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/snanmedianrowa.c b/src/c/statisticsFunctions/nanmedian/snanmedianrowa.c new file mode 100644 index 00000000..47425e0f --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/snanmedianrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmedian.h" +#include "mean.h" +#include "types.h" +#include "uint16.h" + +void snanmedianrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= snanmediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/znanmediana.c b/src/c/statisticsFunctions/nanmedian/znanmediana.c new file mode 100644 index 00000000..bfc1fe46 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/znanmediana.c @@ -0,0 +1,51 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmedian.h" +#include "median.h" +#include "types.h" +#include "doubleComplex.h" + +doubleComplex znanmediana(doubleComplex* in, int size) +{ + +doubleComplex temp[size]; +doubleComplex out; +int j=0; + +float a= 0.0/0.0; + + for(int i=0; i< size; i++) + { + if( !(zreals(in[i])) && !(zimags(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= zmediana(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/src/c/statisticsFunctions/nanmedian/znanmediancola.c b/src/c/statisticsFunctions/nanmedian/znanmediancola.c new file mode 100644 index 00000000..0aaeba02 --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/znanmediancola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmedian.h" +#include "mean.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znanmediancola(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= znanmediana( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/nanmedian/znanmedianrowa.c b/src/c/statisticsFunctions/nanmedian/znanmedianrowa.c new file mode 100644 index 00000000..d0e470fa --- /dev/null +++ b/src/c/statisticsFunctions/nanmedian/znanmedianrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmedian.h" +#include "mean.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znanmedianrowa(doubleComplex* in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= znanmediana( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/nanstdev/dnanstdeva.c b/src/c/statisticsFunctions/nanstdev/dnanstdeva.c new file mode 100644 index 00000000..05b54339 --- /dev/null +++ b/src/c/statisticsFunctions/nanstdev/dnanstdeva.c @@ -0,0 +1,51 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanstdev.h" +#include "stdev.h" +#include "types.h" +double dnanstdeva(double* in, int size) +{ + +double temp[size]; +double out; +int j=0; + +double a= 0.0/0.0; + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= dstdeva(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/src/c/statisticsFunctions/nanstdev/dnanstdevcola.c b/src/c/statisticsFunctions/nanstdev/dnanstdevcola.c new file mode 100644 index 00000000..a6704b09 --- /dev/null +++ b/src/c/statisticsFunctions/nanstdev/dnanstdevcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void dnanstdevcola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dnanstdeva( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c b/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c new file mode 100644 index 00000000..52a1722e --- /dev/null +++ b/src/c/statisticsFunctions/nanstdev/dnanstdevrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void dnanstdevrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnanstdeva( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/nanstdev/snanstdeva.c b/src/c/statisticsFunctions/nanstdev/snanstdeva.c new file mode 100644 index 00000000..3e6ab154 --- /dev/null +++ b/src/c/statisticsFunctions/nanstdev/snanstdeva.c @@ -0,0 +1,51 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanstdev.h" +#include "stdev.h" +#include "types.h" +float snanstdeva(float* in, int size) +{ + +float temp[size]; +float out; +int j=0; + +double a= 0.0/0.0; + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + temp[j]= in[i]; + j=j+1; + + + } + + + } + + +out= sstdeva(temp, j); + +if(j=0) +return a; +else +return out; + +} diff --git a/src/c/statisticsFunctions/nanstdev/snanstdevcola.c b/src/c/statisticsFunctions/nanstdev/snanstdevcola.c new file mode 100644 index 00000000..987cb3fd --- /dev/null +++ b/src/c/statisticsFunctions/nanstdev/snanstdevcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void snanstdevcola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= snanstdeva( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/nanstdev/snanstdevrowa.c b/src/c/statisticsFunctions/nanstdev/snanstdevrowa.c new file mode 100644 index 00000000..9c08682e --- /dev/null +++ b/src/c/statisticsFunctions/nanstdev/snanstdevrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanstdev.h" +#include "types.h" +#include "uint16.h" + +void snanstdevrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= snanstdeva( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/stdev/dstdeva.c b/src/c/statisticsFunctions/stdev/dstdeva.c new file mode 100644 index 00000000..73a4bec4 --- /dev/null +++ b/src/c/statisticsFunctions/stdev/dstdeva.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "stdev.h" +#include <math.h> +#include "mean.h" +#include "pow.h" +#include "variance.h" +#include "types.h" +#include "uint16.h" + +double dstdeva(double *in, int size) +{ + double variance = dvariancea(in, size); + + return dpows(variance, 0.5); + + +} diff --git a/src/c/statisticsFunctions/stdev/dstdevcola.c b/src/c/statisticsFunctions/stdev/dstdevcola.c new file mode 100644 index 00000000..cdce81a3 --- /dev/null +++ b/src/c/statisticsFunctions/stdev/dstdevcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "stdev.h" +#include "types.h" +#include "uint16.h" + +void dstdevcola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dstdeva( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/stdev/dstdevrowa.c b/src/c/statisticsFunctions/stdev/dstdevrowa.c new file mode 100644 index 00000000..a4cf40ca --- /dev/null +++ b/src/c/statisticsFunctions/stdev/dstdevrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "stdev.h" +#include "types.h" +#include "uint16.h" + +void dstdevrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dstdeva( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/stdev/sstdeva.c b/src/c/statisticsFunctions/stdev/sstdeva.c new file mode 100644 index 00000000..db76d95d --- /dev/null +++ b/src/c/statisticsFunctions/stdev/sstdeva.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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "stdev.h" +#include <math.h> +#include "mean.h" +#include "pow.h" +#include "variance.h" +#include "types.h" +#include "uint16.h" + +float sstdeva(float *in, int size) +{ + float variance = svariancea(in, size); + + return spows(variance, 0.5); + + +} diff --git a/src/c/statisticsFunctions/stdev/sstdevcola.c b/src/c/statisticsFunctions/stdev/sstdevcola.c new file mode 100644 index 00000000..c72b4a5a --- /dev/null +++ b/src/c/statisticsFunctions/stdev/sstdevcola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "stdev.h" +#include "types.h" +#include "uint16.h" + +void sstdevcola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= sstdeva( inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/stdev/sstdevrowa.c b/src/c/statisticsFunctions/stdev/sstdevrowa.c new file mode 100644 index 00000000..415d409f --- /dev/null +++ b/src/c/statisticsFunctions/stdev/sstdevrowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "stdev.h" +#include "types.h" +#include "uint16.h" + +void sstdevrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= sstdeva( inter, row); + + } + + +} diff --git a/src/c/statisticsFunctions/strange/dstrangea.c b/src/c/statisticsFunctions/strange/dstrangea.c new file mode 100644 index 00000000..9dc94fe0 --- /dev/null +++ b/src/c/statisticsFunctions/strange/dstrangea.c @@ -0,0 +1,60 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" +#include "subtraction.h" + +double dstrangea(double *in, int size) +{ + double a; double in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + + +return ddiffs(in_copy[size-1],in_copy[0]); + +} diff --git a/src/c/statisticsFunctions/strange/dstrangecola.c b/src/c/statisticsFunctions/strange/dstrangecola.c new file mode 100644 index 00000000..d6a11e3d --- /dev/null +++ b/src/c/statisticsFunctions/strange/dstrangecola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void dstrangecola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + + out[i]= dstrangea(inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/strange/dstrangerowa.c b/src/c/statisticsFunctions/strange/dstrangerowa.c new file mode 100644 index 00000000..f63df35c --- /dev/null +++ b/src/c/statisticsFunctions/strange/dstrangerowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" + +void dstrangerowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + + out[i]= dstrangea(inter, row); + } + + +} diff --git a/src/c/statisticsFunctions/strange/sstrangea.c b/src/c/statisticsFunctions/strange/sstrangea.c new file mode 100644 index 00000000..f79b00af --- /dev/null +++ b/src/c/statisticsFunctions/strange/sstrangea.c @@ -0,0 +1,60 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" +#include "subtraction.h" + +float sstrangea(float *in, int size) +{ + float a; float in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + + +return sdiffs(in_copy[size-1],in_copy[0]); + +} diff --git a/src/c/statisticsFunctions/strange/sstrangecola.c b/src/c/statisticsFunctions/strange/sstrangecola.c new file mode 100644 index 00000000..4c8e90a4 --- /dev/null +++ b/src/c/statisticsFunctions/strange/sstrangecola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void sstrangecola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + + out[i]= sstrangea(inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/strange/sstrangerowa.c b/src/c/statisticsFunctions/strange/sstrangerowa.c new file mode 100644 index 00000000..50c1165c --- /dev/null +++ b/src/c/statisticsFunctions/strange/sstrangerowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" + +void sstrangerowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + + out[i]= sstrangea(inter, row); + } + + +} diff --git a/src/c/statisticsFunctions/strange/u16strangea.c b/src/c/statisticsFunctions/strange/u16strangea.c new file mode 100644 index 00000000..66b31fb1 --- /dev/null +++ b/src/c/statisticsFunctions/strange/u16strangea.c @@ -0,0 +1,60 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" +#include "subtraction.h" + +uint16 u16strangea(uint16 *in, int size) +{ + uint16 a; uint16 in_copy[size]; + + for(int i=0; i< size; i++) + + { + in_copy[i]= in[i]; + + } + + + + for (int i = 0; i < size; ++i) + + { + + for (int j = i + 1; j < size; ++j) + + { + + if (in_copy[i] > in_copy[j]) + + { + + a = in_copy[i]; + + in_copy[i] = in_copy[j]; + + in_copy[j] = a; + + } + + } + + } + + + +return u16diffs(in_copy[size-1],in_copy[0]); + +} diff --git a/src/c/statisticsFunctions/strange/u16strangecola.c b/src/c/statisticsFunctions/strange/u16strangecola.c new file mode 100644 index 00000000..69783607 --- /dev/null +++ b/src/c/statisticsFunctions/strange/u16strangecola.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" +#include "stdio.h" + +void u16strangecola(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + + out[i]= u16strangea(inter, col); + + } + + +} diff --git a/src/c/statisticsFunctions/strange/u16strangerowa.c b/src/c/statisticsFunctions/strange/u16strangerowa.c new file mode 100644 index 00000000..b7f878d0 --- /dev/null +++ b/src/c/statisticsFunctions/strange/u16strangerowa.c @@ -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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "strange.h" +#include "types.h" +#include "uint16.h" + +void u16strangerowa(uint16 *in, int row, int col, uint16* out) +{ + uint16 inter[row]; + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + + out[i]= u16strangea(inter, row); + } + + +} diff --git a/src/c/statisticsFunctions/sum/i16columnsuma.c b/src/c/statisticsFunctions/sum/i16columnsuma.c new file mode 100644 index 00000000..a34cea13 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i16columnsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i16columnsuma(int16 *in, int lines, int columns, int16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (int16)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (int16)i16adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/i16rowsuma.c b/src/c/statisticsFunctions/sum/i16rowsuma.c new file mode 100644 index 00000000..03d8ff29 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i16rowsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i16rowsuma(int16 *in, int lines, int columns, int16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (int16)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (int16)i16adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/i16suma.c b/src/c/statisticsFunctions/sum/i16suma.c new file mode 100644 index 00000000..f5d08093 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i16suma.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +int16 i16suma(int16 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int i = 0; + int16 accumulate = 0; + + for (i = 0; i < size; ++i) + { + accumulate = i16adds(accumulate, in[i]); + } + return accumulate; +} diff --git a/src/c/statisticsFunctions/sum/i8columnsuma.c b/src/c/statisticsFunctions/sum/i8columnsuma.c new file mode 100644 index 00000000..bb79897c --- /dev/null +++ b/src/c/statisticsFunctions/sum/i8columnsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i8columnsuma(int8 *in, int lines, int columns, int8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (int8)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (int8)i8adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/i8rowsuma.c b/src/c/statisticsFunctions/sum/i8rowsuma.c new file mode 100644 index 00000000..2008f32d --- /dev/null +++ b/src/c/statisticsFunctions/sum/i8rowsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void i8rowsuma(int8 *in, int lines, int columns, int8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (int8)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (int8)i8adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/i8suma.c b/src/c/statisticsFunctions/sum/i8suma.c new file mode 100644 index 00000000..468a98b9 --- /dev/null +++ b/src/c/statisticsFunctions/sum/i8suma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +int8 i8suma(int8 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int8 accumulate = 0; + + int i = 0; + + for (i = 0; i < size; ++i) + { + accumulate = i8adds(accumulate, in[i]); + } + return accumulate; +} diff --git a/src/c/statisticsFunctions/sum/u16columnsuma.c b/src/c/statisticsFunctions/sum/u16columnsuma.c new file mode 100644 index 00000000..82b07757 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u16columnsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#include "sum.h" + +void u16columnsuma(uint16 *in, int lines, int columns, uint16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (uint16)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (uint16)u16adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/u16rowsuma.c b/src/c/statisticsFunctions/sum/u16rowsuma.c new file mode 100644 index 00000000..535e302f --- /dev/null +++ b/src/c/statisticsFunctions/sum/u16rowsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sum.h" + +void u16rowsuma(uint16 *in, int lines, int columns, uint16 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (uint16)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (uint16)u16adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/u16suma.c b/src/c/statisticsFunctions/sum/u16suma.c new file mode 100644 index 00000000..5e5620c1 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u16suma.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "sum.h" + +uint16 u16suma(uint16 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int i = 0; + uint16 accumulate = 0; + + for (i = 0; i < size; ++i) + { + accumulate = u16adds(accumulate, in[i]); + } + return accumulate; +} diff --git a/src/c/statisticsFunctions/sum/u8columnsuma.c b/src/c/statisticsFunctions/sum/u8columnsuma.c new file mode 100644 index 00000000..f3e30411 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u8columnsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void u8columnsuma(uint8 *in, int lines, int columns, uint8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < lines; ++i) + { + out[i] = (uint8)in[i]; + } + /* + ** Then accumulate in each row. + */ + for (i = lines ; i < lines * columns ; ++i) + { + out[i % lines] = (uint8)u8adds(out[i % lines] , in[i]); + } +} diff --git a/src/c/statisticsFunctions/sum/u8rowsuma.c b/src/c/statisticsFunctions/sum/u8rowsuma.c new file mode 100644 index 00000000..53a49442 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u8rowsuma.c @@ -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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +void u8rowsuma(uint8 *in, int lines, int columns, uint8 * out) { + int i = 0; + + /* + ** First assign first row, just in case + ** out contains non-zero's elements. + */ + for (i = 0 ; i < columns; ++i) + { + out[i] = (uint8)in[i * lines]; + } + /* + ** Then accumulate in each column. + */ + for (i = 1 ; i <= (lines - 1) * columns ; ++i) + { + out[(i - 1) % columns] = (uint8)u8adds( out[(i - 1) % columns] , + in[((i - 1) % columns) * lines + 1 + (i - 1) / columns]); + } +} diff --git a/src/c/statisticsFunctions/sum/u8suma.c b/src/c/statisticsFunctions/sum/u8suma.c new file mode 100644 index 00000000..e5febef1 --- /dev/null +++ b/src/c/statisticsFunctions/sum/u8suma.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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "sum.h" + +uint8 u8suma(uint8 *in, int size) { + //floatComplex accumulate = FloatComplex(0.0f, 0.0f); + int i = 0; + uint8 accumulate = 0; + + for (i = 0; i < size; ++i) + { + accumulate = u8adds(accumulate, in[i]); + } + return accumulate; +} diff --git a/src/c/statisticsFunctions/wcenter/dwcentera.c b/src/c/statisticsFunctions/wcenter/dwcentera.c new file mode 100644 index 00000000..5c05cc86 --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/dwcentera.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "multiplication.h" +#include "wcenter.h" + +void dwcentera (double* inp, int row, int col, double* out) +{ + double sum = 0, xbar = 0, sigma = 0; + for(int i = 0; i < row*col; i++) // Findinag the maen of all the elements of the matrix + sum += inp[i]; + xbar = sum/(row*col); + + double one[row*col]; // Creating a matrix of ones + donesa(one,row,col); + + double prod[row*col]; + for(int i = 0; i < row*col; i++) // Applying the formula (x(i,j)-xbar)/sigma + prod[i] = one[i]*xbar; + + for(int i = 0; i < row*col; i++) + out[i] = inp[i] - prod[i]; + + sum = 0; + for(int i = 0; i < row*col; i++) + sum = sum + out[i]*out[i]; + + sigma = sqrt(sum/(row*col-1)); + + for(int i = 0; i < row*col; i++) + out[i] = out[i]/sigma; +} diff --git a/src/c/statisticsFunctions/wcenter/dwcentercola.c b/src/c/statisticsFunctions/wcenter/dwcentercola.c new file mode 100644 index 00000000..ab82acfe --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/dwcentercola.c @@ -0,0 +1,64 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "wcenter.h" + +void dwcentercola (double* inp, int row, int col, double* out) +{ + + double sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = 0; + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] += inp[i + j*row]; + } + } + + //for(int i = 0; i < row; i++) + //printf("%lf \n",sum[i]); + + for(int i = 0; i < row; i++) + xbar[i] = sum[i]/col; + + double one[col]; // Creating a matrix of ones + donesa(one,1,col); + + + double prod[row*col]; + dmulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; + + for(int i = 0; i < row; i++) + sum[i] = 0; + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] += out[i + j*row] * out[i + j*row]; + } + } + + double sigma[row]; + for(int i = 0; i < row; i++) + sigma[i] = sqrt(sum[i]/(col-1)); + + for(int i = 0; i < row*col; i++) + prod[i] = 0; + + dmulma(sigma, row, 1, one, 1, col, prod); + + for(int i = 0; i < row*col; i++) + out[i] = out[i] / prod[i]; + +} diff --git a/src/c/statisticsFunctions/wcenter/dwcenterrowa.c b/src/c/statisticsFunctions/wcenter/dwcenterrowa.c new file mode 100644 index 00000000..72e37931 --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/dwcenterrowa.c @@ -0,0 +1,68 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "wcenter.h" + +void dwcenterrowa (double* inp, int row, int col, double* out) +{ + + double sum[col], xbar[col]; + for(int i = 0; i < col; i++) + sum[i] = 0; + + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] += inp[j + i*row]; + } + } + + + + for(int i = 0; i < col; i++) + xbar[i] = sum[i]/row; + + double one[row]; // Creating a matrix of ones + donesa(one,row,1); + + double prod[row*col]; + dmulma(one, row, 1, xbar, 1, col, prod); + + + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; + + + for(int i = 0; i < col; i++) + sum[i] = 0; + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] += out[j + i*row] * out[j + i*row]; + } + } + + + + double sigma[col]; + for(int i = 0; i < col; i++) + sigma[i] = sqrt(sum[i]/(row-1)); + + + for(int i = 0; i < row*col; i++) + prod[i] = 0; + + dmulma(one, row, 1, sigma, 1, col, prod); + + for(int i = 0; i < row*col; i++) + out[i] = out[i] / prod[i]; + +} diff --git a/src/c/statisticsFunctions/wcenter/swcentera.c b/src/c/statisticsFunctions/wcenter/swcentera.c new file mode 100644 index 00000000..91206fcf --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/swcentera.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "multiplication.h" +#include "wcenter.h" + +void swcentera (float* inp, int row, int col, float* out) +{ + float sum = 0, xbar = 0, sigma = 0; + for(int i = 0; i < row*col; i++) // Findinag the maen of all the elements of the matrix + sum += inp[i]; + xbar = sum/(row*col); + + float one[row*col]; // Creating a matrix of ones + sonesa(one,row,col); + + float prod[row*col]; + for(int i = 0; i < row*col; i++) // Applying the formula (x(i,j)-xbar)/sigma + prod[i] = one[i]*xbar; + + for(int i = 0; i < row*col; i++) + out[i] = inp[i] - prod[i]; + + sum = 0; + for(int i = 0; i < row*col; i++) + sum = sum + out[i]*out[i]; + + sigma = sqrt(sum/(row*col-1)); + + for(int i = 0; i < row*col; i++) + out[i] = out[i]/sigma; +} diff --git a/src/c/statisticsFunctions/wcenter/swcentercola.c b/src/c/statisticsFunctions/wcenter/swcentercola.c new file mode 100644 index 00000000..6fafe9f9 --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/swcentercola.c @@ -0,0 +1,61 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "wcenter.h" + +void swcentercola (float* inp, int row, int col, float* out) +{ + + float sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = 0; + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] += inp[i + j*row]; + } + } + + for(int i = 0; i < row; i++) + xbar[i] = sum[i]/col; + + float one[col]; // Creating a matrix of ones + sonesa(one,1,col); + + + float prod[row*col]; + smulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; + + for(int i = 0; i < row; i++) + sum[i] = 0; + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] += out[i + j*row] * out[i + j*row]; + } + } + + float sigma[row]; + for(int i = 0; i < row; i++) + sigma[i] = sqrt(sum[i]/(col-1)); + + for(int i = 0; i < row*col; i++) + prod[i] = 0; + + smulma(sigma, row, 1, one, 1, col, prod); + + for(int i = 0; i < row*col; i++) + out[i] = out[i] / prod[i]; + +} diff --git a/src/c/statisticsFunctions/wcenter/swcenterrowa.c b/src/c/statisticsFunctions/wcenter/swcenterrowa.c new file mode 100644 index 00000000..ce1df2e9 --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/swcenterrowa.c @@ -0,0 +1,68 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "subtraction.h" +#include "matrixMultiplication.h" +#include "wcenter.h" + +void swcenterrowa (float* inp, int row, int col, float* out) +{ + + float sum[col], xbar[col]; + for(int i = 0; i < col; i++) + sum[i] = 0; + + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] += inp[j + i*row]; + } + } + + + + for(int i = 0; i < col; i++) + xbar[i] = sum[i]/row; + + float one[row]; // Creating a matrix of ones + sonesa(one,row,1); + + float prod[row*col]; + smulma(one, row, 1, xbar, 1, col, prod); + + + + for(int i = 0; i< row*col; i++) + out[i] = inp[i] - prod[i]; + + + for(int i = 0; i < col; i++) + sum[i] = 0; + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] += out[j + i*row] * out[j + i*row]; + } + } + + + + float sigma[col]; + for(int i = 0; i < col; i++) + sigma[i] = sqrt(sum[i]/(row-1)); + + + for(int i = 0; i < row*col; i++) + prod[i] = 0; + + smulma(one, row, 1, sigma, 1, col, prod); + + for(int i = 0; i < row*col; i++) + out[i] = out[i] / prod[i]; + +} diff --git a/src/c/statisticsFunctions/wcenter/zwcentera.c b/src/c/statisticsFunctions/wcenter/zwcentera.c new file mode 100644 index 00000000..8571dd62 --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/zwcentera.c @@ -0,0 +1,38 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "wcenter.h" +#include "doubleComplex.h" +#include "sqrt.h" + +void zwcentera (doubleComplex* inp, int row, int col, doubleComplex* out) +{ + doubleComplex sum = 0, xbar = 0, sigma = 0; + for(int i = 0; i < row*col; i++) // Findinag the maen of all the elements of the matrix + sum = zadds(sum,inp[i]); + xbar = zrdivs(sum,(row*col)); + + doubleComplex one[row*col]; // Creating a matrix of ones + zonesa(one,row,col); + + doubleComplex prod[row*col]; + for(int i = 0; i < row*col; i++) // Applying the formula (x(i,j)-xbar)/sigma + prod[i] = zmuls(one[i],xbar); + + for(int i = 0; i < row*col; i++) + out[i] = zdiffs(inp[i], prod[i]); + + sum = DoubleComplex(0,0); + for(int i = 0; i < row*col; i++) + sum = zadds(sum, zmuls(out[i],out[i])); + + sigma = zsqrts(zrdivs(sum,(row*col-1))); + + for(int i = 0; i < row*col; i++) + out[i] = zrdivs(out[i],sigma); +} diff --git a/src/c/statisticsFunctions/wcenter/zwcentercola.c b/src/c/statisticsFunctions/wcenter/zwcentercola.c new file mode 100644 index 00000000..5e4e2bdd --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/zwcentercola.c @@ -0,0 +1,66 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "wcenter.h" +#include "doubleComplex.h" +#include "sqrt.h" + +void zwcentercola (doubleComplex* inp, int row, int col, doubleComplex* out) +{ + + doubleComplex sum[row], xbar[row]; + for(int i = 0; i < row; i++) + sum[i] = DoubleComplex(0,0); + + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] = zadds(sum[i], inp[i + j*row]); + } + } + + + for(int i = 0; i < row; i++) + xbar[i] = zrdivs(sum[i], col); + + doubleComplex one[col]; // Creating a matrix of ones + zonesa(one,1,col); + + + doubleComplex prod[row*col]; + zmulma(xbar, row, 1, one, 1, col, prod); + + for(int i = 0; i< row*col; i++) + out[i] = zdiffs(inp[i], prod[i]); + + for(int i = 0; i < row; i++) + sum[i] = DoubleComplex(0,0); + + for(int i = 0; i < row; i++) + { + for(int j = 0; j < col; j++) + { + sum[i] = zadds(sum[i], zmuls(out[i + j*row], out[i + j*row])); + } + } + + doubleComplex sigma[row]; + for(int i = 0; i < row; i++) + sigma[i] = zsqrts(zrdivs(sum[i],(col-1))); + + for(int i = 0; i < row*col; i++) + prod[i] = DoubleComplex(0,0); + + zmulma(sigma, row, 1, one, 1, col, prod); + + for(int i = 0; i < row*col; i++) + out[i] = zrdivs(out[i], prod[i]); + +} diff --git a/src/c/statisticsFunctions/wcenter/zwcenterrowa.c b/src/c/statisticsFunctions/wcenter/zwcenterrowa.c new file mode 100644 index 00000000..f68835d8 --- /dev/null +++ b/src/c/statisticsFunctions/wcenter/zwcenterrowa.c @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <ones.h> +#include "addition.h" +#include "subtraction.h" +#include "multiplication.h" +#include "division.h" +#include "wcenter.h" +#include "doubleComplex.h" +#include "sqrt.h" + +void zwcenterrowa (doubleComplex* inp, int row, int col, doubleComplex* out) +{ + + doubleComplex sum[col], xbar[col]; + for(int i = 0; i < col; i++) + sum[i] = DoubleComplex(0,0); + + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] = zadds(sum[i], inp[j + i*row]); + } + } + + + + for(int i = 0; i < col; i++) + xbar[i] = zrdivs(sum[i], row); + + doubleComplex one[row]; // Creating a matrix of ones + zonesa(one,row,1); + + doubleComplex prod[row*col]; + zmulma(one, row, 1, xbar, 1, col, prod); + + + + for(int i = 0; i< row*col; i++) + out[i] = zdiffs(inp[i], prod[i]); + + + for(int i = 0; i < col; i++) + sum[i] = DoubleComplex(0,0); + + for(int i = 0; i < col; i++) + { + for(int j = 0; j < row; j++) + { + sum[i] = zadds(sum[i], zmuls(out[j + i*row], out[j + i*row])); + } + } + + + + doubleComplex sigma[col]; + for(int i = 0; i < col; i++) + sigma[i] = zsqrts(zrdivs(sum[i],(row-1))); + + + for(int i = 0; i < row*col; i++) + prod[i] = DoubleComplex(0,0); + + zmulma(one, row, 1, sigma, 1, col, prod); + + for(int i = 0; i < row*col; i++) + out[i] = zrdivs(out[i], prod[i]); + +} diff --git a/src/c/string/ascii/dasciia.c b/src/c/string/ascii/dasciia.c new file mode 100644 index 00000000..d2452880 --- /dev/null +++ b/src/c/string/ascii/dasciia.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 + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include "ascii.h" +void dasciia(double* inp,int size,char* oup) +{ + int i; + for(i=0;i<size;i++) + { + oup[i]=(char)inp[i]; + } +} diff --git a/src/c/string/ascii/gasciia.c b/src/c/string/ascii/gasciia.c new file mode 100644 index 00000000..5fe95e07 --- /dev/null +++ b/src/c/string/ascii/gasciia.c @@ -0,0 +1,26 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include<stdio.h> +/* This is the "asciiconv" function which converts the given string + into its ascii equivalent. +*/ +#include "ascii.h" +void gasciia(char *str,int size,uint8* oup) +{ + int i; + for(i=0;i<size;i++) + { + *(oup+i)=str[i]; + } + +} + diff --git a/src/c/string/convstr/gconvstrs.c b/src/c/string/convstr/gconvstrs.c new file mode 100644 index 00000000..7c6e7f14 --- /dev/null +++ b/src/c/string/convstr/gconvstrs.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ + +#include <string.h> +#include <ctype.h> +#include "convstr.h" + + +void gconvstrs(char* in, int size,char* flag,int size2,char* out) +{ + int i=0;//temp=0; + for(i=0;i<size;i++) + { + //temp= in[i]; + if(flag[0]=='l' || flag[0]=='L') + { //temp=temp + 32; + out[i]=tolower(in[i]); + } + else if(flag[0]=='u' || flag[0]=='U') + { + //temp=temp - 32; + out[i]=toupper(in[i]); + } + } +} diff --git a/src/c/string/disp/ddispa.c b/src/c/string/disp/ddispa.c index 5e6bb84e..29aaceeb 100644 --- a/src/c/string/disp/ddispa.c +++ b/src/c/string/disp/ddispa.c @@ -16,7 +16,7 @@ double ddispa (double* in, int rows, int columns){ int i = 0,j = 0; for (i = 0; i < rows; ++i) { - for (j=0;j<columns;j++) printf (" %1.20f ", in[i+j*rows]); + for (j=0;j<columns;j++) printf (" %e ", in[i+j*rows]); printf("\n"); } return 0; diff --git a/src/c/string/disp/i16dispa.c b/src/c/string/disp/i16dispa.c new file mode 100644 index 00000000..424d066d --- /dev/null +++ b/src/c/string/disp/i16dispa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double i16dispa (int16* in, int rows, int columns){ + int i = 0,j = 0; + + for (i = 0; i < rows; ++i) { + for (j=0;j<columns;j++) printf (" %d ", in[i+j*rows]); + printf("\n"); + } + return 0; +} diff --git a/src/c/string/disp/i16disps.c b/src/c/string/disp/i16disps.c new file mode 100644 index 00000000..70edda77 --- /dev/null +++ b/src/c/string/disp/i16disps.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double i16disps (int16 in) { + printf(" %d \n",in); + return 0; +} diff --git a/src/c/string/disp/i8dispa.c b/src/c/string/disp/i8dispa.c new file mode 100644 index 00000000..9acd9674 --- /dev/null +++ b/src/c/string/disp/i8dispa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double i8dispa (int8* in, int rows, int columns){ + int i = 0,j = 0; + + for (i = 0; i < rows; ++i) { + for (j=0;j<columns;j++) printf (" %d ", in[i+j*rows]); + printf("\n"); + } + return 0; +} diff --git a/src/c/string/disp/i8disps.c b/src/c/string/disp/i8disps.c new file mode 100644 index 00000000..07cc6c4f --- /dev/null +++ b/src/c/string/disp/i8disps.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double i8disps (int8 in) { + printf(" %d \n",in); + return 0; +} diff --git a/src/c/string/disp/u16dispa.c b/src/c/string/disp/u16dispa.c new file mode 100644 index 00000000..ad3685e2 --- /dev/null +++ b/src/c/string/disp/u16dispa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double u16dispa (uint16* in, int rows, int columns){ + int i = 0,j = 0; + + for (i = 0; i < rows; ++i) { + for (j=0;j<columns;j++) printf (" %u ", in[i+j*rows]); + printf("\n"); + } + return 0; +} diff --git a/src/c/string/disp/u16disps.c b/src/c/string/disp/u16disps.c new file mode 100644 index 00000000..383dcfc0 --- /dev/null +++ b/src/c/string/disp/u16disps.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double u16disps (uint16 in) { + printf(" %u \n",in); + return 0; +} diff --git a/src/c/string/disp/u8dispa.c b/src/c/string/disp/u8dispa.c new file mode 100644 index 00000000..f242b5c5 --- /dev/null +++ b/src/c/string/disp/u8dispa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double u8dispa (uint8* in, int rows, int columns){ + int i = 0,j = 0; + + for (i = 0; i < rows; ++i) { + for (j=0;j<columns;j++) printf (" %d ", in[i+j*rows]); + printf("\n"); + } + return 0; +} diff --git a/src/c/string/disp/u8disps.c b/src/c/string/disp/u8disps.c new file mode 100644 index 00000000..2d3e78fa --- /dev/null +++ b/src/c/string/disp/u8disps.c @@ -0,0 +1,19 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "disp.h" + +double u8disps (uint8 in) { + printf(" %d \n",in); + return 0; +} diff --git a/src/c/string/disp/zdispa.c b/src/c/string/disp/zdispa.c index 5d085d32..94b24e98 100644 --- a/src/c/string/disp/zdispa.c +++ b/src/c/string/disp/zdispa.c @@ -16,7 +16,7 @@ double zdispa (doubleComplex* in, int rows, int columns){ int i = 0,j = 0; for (i = 0; i < rows; ++i) { - for (j=0;j<columns;j++) printf(" %1.20f + %1.20fi " ,zreals(in[i+j*rows]) ,zimags(in[i+j*rows])); + for (j=0;j<columns;j++) printf(" %e + %ei " ,zreals(in[i+j*rows]) ,zimags(in[i+j*rows])); printf("\n"); } return 0; diff --git a/src/c/string/disp/zdisps.c b/src/c/string/disp/zdisps.c index c4ec137f..4a040cd7 100644 --- a/src/c/string/disp/zdisps.c +++ b/src/c/string/disp/zdisps.c @@ -14,6 +14,6 @@ double zdisps (doubleComplex in) { - printf(" %1.20f + %1.20fi \n" ,zreals(in) ,zimags(in)); + printf(" %e + %ei \n" ,zreals(in) ,zimags(in)); return 0; } diff --git a/src/c/string/includes/ascii.h b/src/c/string/includes/ascii.h new file mode 100644 index 00000000..39aeb835 --- /dev/null +++ b/src/c/string/includes/ascii.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __ASCII_H__ +#define __ASCII_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gasciia(char* str,int size,uint8* oup); +void dasciia(double* inp,int size,char* oup); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*___ASCII_H__*/ diff --git a/src/c/string/includes/convstr.h b/src/c/string/includes/convstr.h new file mode 100644 index 00000000..0737c546 --- /dev/null +++ b/src/c/string/includes/convstr.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 __CONVSTR_H__ +#define __CONVSTR_H__ + + + #ifdef __cplusplus + extern "C" { + #endif + +void gconvstrs(char* in, int size,char* flag,int size2,char* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__CONVSTR_H__*/ diff --git a/src/c/string/includes/disp.h b/src/c/string/includes/disp.h index 96ccb248..7b463906 100644 --- a/src/c/string/includes/disp.h +++ b/src/c/string/includes/disp.h @@ -19,6 +19,7 @@ #include "dynlib_string.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -44,6 +45,27 @@ EXTERN_STRING double cdisps (floatComplex in); EXTERN_STRING double zdisps (doubleComplex in); /* +** \brief display of a uint8 scalar +*/ +EXTERN_STRING double u8disps (uint8 in); + +/* +** \brief display of a int8 scalar +*/ +EXTERN_STRING double i8disps (int8 in); + +/* +** \brief display of a uint16 scalar +*/ +EXTERN_STRING double u16disps (uint16 in); + +/* +** \brief display of a int16 scalar +*/ +EXTERN_STRING double i16disps (int16 in); + + +/* ** \brief display of a float scalar array ** \param in the float scalar array to display ** \param size the size of the array @@ -71,11 +93,39 @@ EXTERN_STRING double cdispa (floatComplex* in, int rows, int columns); */ EXTERN_STRING double zdispa (doubleComplex* in, int rows, int columns); - +/* +** \brief display of a uint8 scalar array +** \param in the uint8 scalar array to display +** \param size the size of the array +*/ +EXTERN_STRING double u8dispa (uint8* in, int rows, int columns); + +/* +** \brief display of a int8 scalar array +** \param in the int8 scalar array to display +** \param size the size of the array +*/ +EXTERN_STRING double i8dispa (int8* in, int rows, int columns); + +/* +** \brief display of a uint16 scalar array +** \param in the uint16 scalar array to display +** \param size the size of the array +*/ +EXTERN_STRING double u16dispa (uint16* in, int rows, int columns); + +/* +** \brief display of a int16 scalar array +** \param in the int16 scalar array to display +** \param size the size of the array +*/ +EXTERN_STRING double i16dispa (int16* in, int rows, int columns); + EXTERN_STRING double ddisph (double *in, int rows, int cols, int levels); EXTERN_STRING double g2dispd0(char *array,int* tmparraysize); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/string/includes/str.h b/src/c/string/includes/str.h index 434c68e0..79307b5f 100644 --- a/src/c/string/includes/str.h +++ b/src/c/string/includes/str.h @@ -19,6 +19,7 @@ #include "dynlib_string.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -54,6 +55,35 @@ EXTERN_STRING void zstrings (doubleComplex in, char* out); /* +** \brief convert of a uint8 scalar into a char array +** \param in the uint8 scalar to convert +** \param out the output char array +*/ +EXTERN_STRING void u8strings (uint8 in, char* out); + +/* +** \brief convert of a int8 scalar into a char array +** \param in the int8 scalar to convert +** \param out the output char array +*/ +EXTERN_STRING void i8strings (int8 in, char* out); + +/* +** \brief convert of a uint16 scalar into a char array +** \param in the uint16 scalar to convert +** \param out the output char array +*/ +EXTERN_STRING void u16strings (uint16 in, char* out); + +/* +** \brief convert of a int16 scalar into a char array +** \param in the int16 scalar to convert +** \param out the output char array +*/ +EXTERN_STRING void i16strings (int16 in, char* out); + + +/* ** \brief convert of a float scalar array into an array of char arrays ** \param in the float scalar array to convert ** \param out the output array of char arrays @@ -81,6 +111,34 @@ EXTERN_STRING void cstringa (floatComplex* in, int size, char** out ); */ EXTERN_STRING void zstringa (doubleComplex* in, int size, char** out); +/* +** \brief convert of a uint8 scalar array into an array of char arrays +** \param in the uint8 scalar array to convert +** \param out the output array of char arrays +*/ +EXTERN_STRING void u8stringa (uint8* in, int size, char** out); + +/* +** \brief convert of a int8 scalar array into an array of char arrays +** \param in the int8 scalar array to convert +** \param out the output array of char arrays +*/ +EXTERN_STRING void i8stringa (int8* in, int size, char** out); + +/* +** \brief convert of a uint16 scalar array into an array of char arrays +** \param in the uint16 scalar array to convert +** \param out the output array of char arrays +*/ +EXTERN_STRING void u16stringa (uint16* in, int size, char** out); + +/* +** \brief convert of a int16 scalar array into an array of char arrays +** \param in the int16 scalar array to convert +** \param out the output array of char arrays +*/ +EXTERN_STRING void i16stringa (int16* in, int size, char** out); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/string/includes/strchr.h b/src/c/string/includes/strchr.h new file mode 100644 index 00000000..7e306413 --- /dev/null +++ b/src/c/string/includes/strchr.h @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __STRCHR_H__ +#define __STRCHR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void gstrchra(char* str,int size, char* key,int size2, char* out); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*__STRCHR_H__*/ diff --git a/src/c/string/includes/strcspn.h b/src/c/string/includes/strcspn.h new file mode 100644 index 00000000..aa91fb47 --- /dev/null +++ b/src/c/string/includes/strcspn.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __STRCSPN_H__ +#define __STRCSPN_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 gstrcspna(char* str1,int size1,char* str2,int size2); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /* __STRCSPN_H */ diff --git a/src/c/string/includes/strncpy.h b/src/c/string/includes/strncpy.h new file mode 100644 index 00000000..f2aa705b --- /dev/null +++ b/src/c/string/includes/strncpy.h @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __STRNCPY_H__ +#define __STRNCPY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void gstrncpya(char* str,int size,double key,char* oup); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*__STRNCPY_H__*/ diff --git a/src/c/string/includes/strrchr.h b/src/c/string/includes/strrchr.h new file mode 100644 index 00000000..d06460be --- /dev/null +++ b/src/c/string/includes/strrchr.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 __STRRCHR_H__ +#define __STRRCHR_H__ + + + #ifdef __cplusplus + extern "C" { + #endif + +void gstrrchr(char* str,int size,char* key,int size2,char* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__STRRCHR_H__*/ diff --git a/src/c/string/includes/strrev.h b/src/c/string/includes/strrev.h new file mode 100644 index 00000000..c7e79570 --- /dev/null +++ b/src/c/string/includes/strrev.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 __STRREV_H__ +#define __STRREV_H__ + + + #ifdef __cplusplus + extern "C" { + #endif + +void gstrreva(char* str,int size,char* out); +//void gstrrevs(char* in, int size,char* search, int size2, char* rep, int size3, ,char* out); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__STRREV_H__*/ diff --git a/src/c/string/includes/strspn.h b/src/c/string/includes/strspn.h new file mode 100644 index 00000000..427caa4c --- /dev/null +++ b/src/c/string/includes/strspn.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __STRSPN_H__ +#define __STRSPN_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 gstrspna(char* str1,int size1,char* str2,int size2); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /* __STRSPN_H */ diff --git a/src/c/string/includes/strsubst.h b/src/c/string/includes/strsubst.h new file mode 100644 index 00000000..e9eba429 --- /dev/null +++ b/src/c/string/includes/strsubst.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 __STRSUBST_H__ +#define __STRSUBST_H__ + + + #ifdef __cplusplus + extern "C" { + #endif + +void gstrsubsta(char* str, int size, char* search, int size2, char* rep, int size3, char* flagmain,int size4, char* out); +//void gstrsubsta(char* str, int size, char* search, int size2, char* rep, int size3, char* out,int size5); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__STRSUBST_H__*/ diff --git a/src/c/string/interfaces/int_ascii.h b/src/c/string/interfaces/int_ascii.h new file mode 100644 index 00000000..87b1b125 --- /dev/null +++ b/src/c/string/interfaces/int_ascii.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_ASCII_H__ +#define __INT_ASCII_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2asciiu82(str,size,oup) gasciia(str,size[1],oup) +#define d2asciig2(inp,size,oup) dasciia(inp,size[1],oup) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_ASCII_H__*/ diff --git a/src/c/string/interfaces/int_convstr.h b/src/c/string/interfaces/int_convstr.h new file mode 100644 index 00000000..2eade501 --- /dev/null +++ b/src/c/string/interfaces/int_convstr.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_CONVSTR_H__ +#define __INT_CONVSTR_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define g2g2convstrg2(in,size,flag,size2,out) gconvstrs(in,size[0]*size[1],flag,size2[1],out) +/*#define g2g2convstrg0(in,size,type,typesize,out) (type=='u': \ + gconvstrs(in,size[0]*size[1],0,out)?gconvstrs(in,size[0]*size[1],1,out)) +*/ + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_CONVSTR_H__*/ diff --git a/src/c/string/interfaces/int_disp.h b/src/c/string/interfaces/int_disp.h index 57f7bd45..26103326 100644 --- a/src/c/string/interfaces/int_disp.h +++ b/src/c/string/interfaces/int_disp.h @@ -17,25 +17,43 @@ #include <stdio.h> -#define s0dispd0(in) sdisps(in) +#define s0disp(in) sdisps(in) -#define d0dispd0(in) ddisps(in) +#define d0disp(in) ddisps(in) -#define c0dispd0(in) cdisps(in) +#define c0disp(in) cdisps(in) -#define z0dispd0(in) zdisps(in) +#define z0disp(in) zdisps(in) -#define s2dispd0(in,size) sdispa(in,size[0],size[1]) +#define u80disp(in) u8disps(in) -#define d2dispd0(in,size) ddispa(in,size[0],size[1]) +#define i80disp(in) i8disps(in) -#define c2dispd0(in,size) cdispa(in,size[0],size[1]) +#define u160disp(in) u16disps(in) -#define z2dispd0(in,size) zdispa(in,size[0],size[1]) +#define i160disp(in) i16disps(in) -#define d3dispd0(in,size) ddisph(in,size[0],size[1],size[2]) +#define s2disp(in,size) sdispa(in,size[0],size[1]) -#define g2dispd0(in, size) printf("%s\n",in) +#define d2disp(in,size) ddispa(in,size[0],size[1]) + +#define c2disp(in,size) cdispa(in,size[0],size[1]) + +#define z2disp(in,size) zdispa(in,size[0],size[1]) + +#define u82disp(in,size) u8dispa(in,size[0],size[1]) + +#define i82disp(in,size) i8dispa(in,size[0],size[1]) + +#define u162disp(in,size) u16dispa(in,size[0],size[1]) + +#define i162disp(in,size) i16dispa(in,size[0],size[1]) + +#define d3disp(in,size) ddisph(in,size[0],size[1],size[2]) + +#define g2disp(in, size) printf("%s\n", in) + +#define g0disp(in) printf("%c\n", in) #endif /* __INT_DISP_H__ */ diff --git a/src/c/string/interfaces/int_strchr.h b/src/c/string/interfaces/int_strchr.h new file mode 100644 index 00000000..8747545b --- /dev/null +++ b/src/c/string/interfaces/int_strchr.h @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_STRCHR_H__ +#define __INT_STRCHR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strchrg2(str,size,key,size2,out) gstrchra(str,size[1],key,size2[1],out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_STRCHR_H__*/ diff --git a/src/c/string/interfaces/int_strcspn.h b/src/c/string/interfaces/int_strcspn.h new file mode 100644 index 00000000..74c6379f --- /dev/null +++ b/src/c/string/interfaces/int_strcspn.h @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_STRCSPN_H__ +#define __INT_STRCSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strcspnu80(str1,size1,str2,size2) gstrcspna(str1,size1[1],str2,size2[1]) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_STRCSPN_H__*/ diff --git a/src/c/string/interfaces/int_string.h b/src/c/string/interfaces/int_string.h new file mode 100644 index 00000000..7cea7799 --- /dev/null +++ b/src/c/string/interfaces/int_string.h @@ -0,0 +1,52 @@ +/* + * 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 + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_STRING_H__ +#define __INT_STRING_H__ + +#include <stdio.h> + +#define s0stringg0(in,out) sstrings(in,out) + +#define d0stringg0(in,out) dstrings(in,out) + +#define c0stringg0(in,out) cstrings(in,out) + +#define z0stringg0(in,out) zstrings(in,out) + +#define u80stringg0(in,out) u8strings(in,out) + +#define i80stringg0(in,out) i8strings(in,out) + +#define u160stringg0(in,out) u16strings(in,out) + +#define i160stringg0(in,out) i16strings(in,out) + +#define s2stringg2(in,size,out) sstringa(in,size[0]*size[1],out) + +#define d2stringg2(in,size,out) dstringa(in,size[0]*size[1],out) + +#define c2stringg2(in,size,out) cstringa(in,size[0]*size[1],out) + +#define z2stringg2(in,size,out) zstringa(in,size[0]*size[1],out) + +#define u82stringg2(in,size,out) u8stringa(in,size[0]*size[1],out) + +#define i82stringg2(in,size,out) i8stringa(in,size[0]*size[1],out) + +#define u162stringg2(in,size,out) u16stringa(in,size[0]*size[1],out) + +#define i162stringg2(in,size,out) i16stringa(in,size[0]*size[1],out) + +#endif /* __INT_STRING_H__ */ diff --git a/src/c/string/interfaces/int_strncpy.h b/src/c/string/interfaces/int_strncpy.h new file mode 100644 index 00000000..e7ffdb42 --- /dev/null +++ b/src/c/string/interfaces/int_strncpy.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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_STRNCPY_H__ +#define __INT_STRNCPY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2d0strncpyg2(str,size,key,oup) gstrncpya(str,size[1],key,oup) + +#ifdef __cplusplus +} /* extern "C"*/ +#endif + +#endif /*__INT_STRNCPY_H__*/ + diff --git a/src/c/string/interfaces/int_strrchr.h b/src/c/string/interfaces/int_strrchr.h new file mode 100644 index 00000000..7ec94ebe --- /dev/null +++ b/src/c/string/interfaces/int_strrchr.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_STRRCHR_H__ +#define __INT_STRRCHR_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define g2g2strrchrg2(str,size,key,size2,out) gstrrchra(str,size[1],key,size2[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_STRRCHR_H__*/ diff --git a/src/c/string/interfaces/int_strrev.h b/src/c/string/interfaces/int_strrev.h new file mode 100644 index 00000000..8429f6a1 --- /dev/null +++ b/src/c/string/interfaces/int_strrev.h @@ -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: Shamik Guha + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_STRREV_H__ +#define __INT_STRREV_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define g2strrevg2(str,size,out) gstrreva(str,size[1],out) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_STRREV_H__*/ diff --git a/src/c/string/interfaces/int_strspn.h b/src/c/string/interfaces/int_strspn.h new file mode 100644 index 00000000..e4b06f72 --- /dev/null +++ b/src/c/string/interfaces/int_strspn.h @@ -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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_STRSPN_H__ +#define __INT_STRSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strspnu80(str1,size1,str2,size2) gstrspna(str1,size1[1],str2,size2[1]) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_STRSPN_H__*/ diff --git a/src/c/string/interfaces/int_strsubst.h b/src/c/string/interfaces/int_strsubst.h new file mode 100644 index 00000000..c8dd67a1 --- /dev/null +++ b/src/c/string/interfaces/int_strsubst.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_STRSUBST_H__ +#define __INT_STRSUBST_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +#define g2g2g2g2strsubstg2(str,size,search,size2,rep,size3,flagmain,size4,out) gstrsubsta(str,size[1],search,size2[1],rep,size3[1],flagmain,size4[1],out) +#define g2g2g2strsubstg2(in,size,search,size2,rep,size3,out) gstrsubsta(in,size[1],search,size2[1],rep,size3[1],'s',size3[1],out) + + + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__INT_STRSUBST_H__*/ diff --git a/src/c/string/strchr/gstrchra.c b/src/c/string/strchr/gstrchra.c new file mode 100644 index 00000000..f2f54359 --- /dev/null +++ b/src/c/string/strchr/gstrchra.c @@ -0,0 +1,33 @@ +/* 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: Ankit Raj + Email: toolbox@scilab.in +*/ +#include <stdio.h> +#include <string.h> +#include "strchr.h" + +void gstrchra(char* str,int size,char* key,int size2,char* out) +{ + int ind,i=0,j,k; + for(j=0;j<size;j++) + { + if(str[j]==key[0]) + { + ind=j; + break; + } + } + for(k=ind;k<size;k++) + { + out[i]=str[k]; + i++; + } +} + diff --git a/src/c/string/strcspn/gstrcspna.c b/src/c/string/strcspn/gstrcspna.c new file mode 100644 index 00000000..91de8af7 --- /dev/null +++ b/src/c/string/strcspn/gstrcspna.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Ankit Raj + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include<string.h> +#include "strcspn.h" +uint8 gstrcspna(char *str1,int size1,char *str2,int size2) +{ + + uint8 ind=size1+1; + int l,m; + for(m=0;m<size2;m++) + { + int tp; + for(l=0;l<size1;l++) + { + if(str2[m]==str1[l]) + { + tp=l; + if(ind>tp) + { + ind=tp; + } + } + } + } + if(ind==size1+1) + { + ind=size1; + } + return ind; +} + diff --git a/src/c/string/string/i16stringa.c b/src/c/string/string/i16stringa.c new file mode 100644 index 00000000..f33f2cb5 --- /dev/null +++ b/src/c/string/string/i16stringa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "str.h" +#include "types.h" + +void i16stringa (int16* in, int size, char** out){ + + int i = 0; + for (i = 0; i < size; ++i) + { + i16strings (in[i], out[i]); + } +} diff --git a/src/c/string/string/i16strings.c b/src/c/string/string/i16strings.c new file mode 100644 index 00000000..8644733c --- /dev/null +++ b/src/c/string/string/i16strings.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include "str.h" +#include "types.h" + +void i16strings (int16 in, char* out) { + + sprintf (out, "%d" ,in ); +} diff --git a/src/c/string/string/i8stringa.c b/src/c/string/string/i8stringa.c new file mode 100644 index 00000000..37f4d8e8 --- /dev/null +++ b/src/c/string/string/i8stringa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "str.h" +#include "types.h" + +void i8stringa (int8* in, int size, char** out){ + + int i = 0; + for (i = 0; i < size; ++i) + { + i8strings (in[i], out[i]); + } +} diff --git a/src/c/string/string/i8strings.c b/src/c/string/string/i8strings.c new file mode 100644 index 00000000..3f3c9e8f --- /dev/null +++ b/src/c/string/string/i8strings.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include "str.h" +#include "types.h" + +void i8strings (int8 in, char* out) { + + sprintf (out, "%d" ,in ); +} diff --git a/src/c/string/string/u16stringa.c b/src/c/string/string/u16stringa.c new file mode 100644 index 00000000..ef6a0a97 --- /dev/null +++ b/src/c/string/string/u16stringa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "str.h" +#include "types.h" + +void u16stringa (uint16* in, int size, char** out){ + + int i = 0; + for (i = 0; i < size; ++i) + { + u16strings (in[i], out[i]); + } +} diff --git a/src/c/string/string/u16strings.c b/src/c/string/string/u16strings.c new file mode 100644 index 00000000..f09ed971 --- /dev/null +++ b/src/c/string/string/u16strings.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include "str.h" +#include "types.h" + +void u16strings (uint16 in, char* out) { + + sprintf (out, "%d" ,in ); +} diff --git a/src/c/string/string/u8stringa.c b/src/c/string/string/u8stringa.c new file mode 100644 index 00000000..d605537c --- /dev/null +++ b/src/c/string/string/u8stringa.c @@ -0,0 +1,24 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "str.h" +#include "types.h" + +void u8stringa (uint8* in, int size, char** out){ + + int i = 0; + for (i = 0; i < size; ++i) + { + u8strings (in[i], out[i]); + } +} diff --git a/src/c/string/string/u8strings.c b/src/c/string/string/u8strings.c new file mode 100644 index 00000000..07d07f36 --- /dev/null +++ b/src/c/string/string/u8strings.c @@ -0,0 +1,21 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include <stdio.h> +#include "str.h" +#include "types.h" + +void u8strings (uint8 in, char* out) { + + sprintf (out, "%d" ,in ); +} diff --git a/src/c/string/strncpy/gstrncpya.c b/src/c/string/strncpy/gstrncpya.c new file mode 100644 index 00000000..92801985 --- /dev/null +++ b/src/c/string/strncpy/gstrncpya.c @@ -0,0 +1,25 @@ +/* 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: Ankit Raj + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include "strncpy.h" +void gstrncpya(char *str,int size,double key,char *oup) +{ + int j; + char c; + for(j=0;j<key;j++) + { + c=str[j]; + oup[j]=c; + } +} + + diff --git a/src/c/string/strrchr/gstrrchra.c b/src/c/string/strrchr/gstrrchra.c new file mode 100644 index 00000000..6a55fbd3 --- /dev/null +++ b/src/c/string/strrchr/gstrrchra.c @@ -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 + Organization: FOSSEE, IIT Bombay + Author: Shamik Guha + Email: toolbox@scilab.in +*/ +#include <stdio.h> +#include <string.h> +#include "strrchr.h" + +void gstrrchra(char* str,int size,char* key,int size2,char* out) +{ + int i,j, k=0, pos2; + + for (i = 0;i<size;i++) + { + if (key[0] == str[i]) + { + pos2 = i; + } + } + for(j=pos2;j<i;j++) + { + out[k]=str[j]; + k++; + } +} diff --git a/src/c/string/strrev/gstrreva.c b/src/c/string/strrev/gstrreva.c new file mode 100644 index 00000000..71a95725 --- /dev/null +++ b/src/c/string/strrev/gstrreva.c @@ -0,0 +1,26 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ +#include <stdio.h> +#include "strrev.h" + +void gstrreva(char* str,int size,char* out) +{ + int i=-1,j=0; + + while(str[++i]!='\0'); + + while(i>=0) + out[j++] = str[--i]; + + out[j]='\0'; + +} diff --git a/src/c/string/strspn/gstrspna.c b/src/c/string/strspn/gstrspna.c new file mode 100644 index 00000000..af1acbb8 --- /dev/null +++ b/src/c/string/strspn/gstrspna.c @@ -0,0 +1,44 @@ +/* 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: Ankit Raj + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include "strspn.h" + +int maxg(int a,int b){ + if(a>b) return a; + return b; +} +uint8 gstrspna(char *str1,int size1,char *str2,int size2) +{ + int i,j,ct=0,k=0,m=0; + for(i=0;i<size2;i++) + { + if(str1[0]==str2[i]) + { + k=i; + ct=0; + j=0; + while(str1[j]==str2[k]) + { + ct++; + j++; + k++; + if(j >= size1) break; + } + if(j==size1) + { + ct=ct-1; + } + m = maxg(m,ct); + } + } +return m; +} diff --git a/src/c/string/strsubst/gstrsubsta.c b/src/c/string/strsubst/gstrsubsta.c new file mode 100644 index 00000000..6aee50ce --- /dev/null +++ b/src/c/string/strsubst/gstrsubsta.c @@ -0,0 +1,69 @@ +/* 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: Shamik Guha + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <string.h> +#include "strsubst.h" + +void gstrsubsta(char* str,int size, char* search, int size2, char* rep, int size3, char* flagmain, int size4, char* out) +{ + int i = 0, j = 0, flag = 0, start = 0; + + //if(flagmain[0]!='r') + //{ + while (str[i] != '\0') + { + if (str[i] == search[j]) + { + if (!flag) + start = i; + j++; + if (search[j] == '\0') + break; + flag = 1; + } + else + { + flag = start = j = 0; + } + i++; + } + + if (search[j] == '\0' && flag) + { + for (i = 0; i < start; i++) + out[i] = str[i]; + /* rep string with another string */ + for (j = 0; j < strlen(rep); j++) + { + out[i] = rep[j]; + i++; + } + + /* copy remaining portion of the input string "str" */ + for (j = start + strlen(search); j < strlen(str); j++) + { + out[i] = str[j]; + i++; + } + + /* print the out string */ + out[i] = '\0'; + //printf("Output: %s\n", out); + } + else + { + printf("%s is not a searching of %s\n", search, str); + } + // } + +} diff --git a/src/c/type/doubleComplex.h b/src/c/type/doubleComplex.h index 4be0d7d3..15bc2684 100644 --- a/src/c/type/doubleComplex.h +++ b/src/c/type/doubleComplex.h @@ -45,6 +45,21 @@ typedef struct double_complex doubleComplex; /* ** } */ +#elif defined(ARDUINO) +/* +** Hand made Double Complex definition +** { +*/ +struct double_complex +{ + double real; + double imag; +}; + +typedef struct double_complex doubleComplex; +/* +** } +*/ #else /* ** Standard C99 Complex @@ -57,7 +72,6 @@ typedef double complex doubleComplex; ** } */ #endif - #ifdef __cplusplus extern "C" { #endif diff --git a/src/c/type/floatComplex.h b/src/c/type/floatComplex.h index fe35ca48..09227b7d 100644 --- a/src/c/type/floatComplex.h +++ b/src/c/type/floatComplex.h @@ -45,6 +45,21 @@ typedef struct float_complex floatComplex; /* ** } */ +#elif defined(ARDUINO) +/* +** Hand made Float Complex definition +** { +*/ +struct float_complex +{ + float real; + float imag; +}; + +typedef struct float_complex floatComplex; +/* +** } +*/ #else /* ** C99 Standard diff --git a/src/c/type/int_imag.h b/src/c/type/int_imag.h index 9647f6ad..6e6b7367 100644 --- a/src/c/type/int_imag.h +++ b/src/c/type/int_imag.h @@ -23,6 +23,14 @@ #define z0imagd0(in) zimags(in) +#define u80imagu80(in) 0 + +#define i80imagi80(in) 0 + +#define u160imagu160(in) 0 + +#define i160imagi160(in) 0 + #define s2imags2(in,size,out) szerosa(out,size[0],size[1]) #define d2imagd2(in,size,out) dzerosa(out,size[0],size[1]) @@ -31,4 +39,12 @@ #define z2imagd2(in,size,out) zimaga(in, size[0]*size[1], out) +#define u82imagu82(in,size,out) u8zerosa(out,size[0],size[1]) + +#define i82imagi82(in,size,out) i8zerosa(out,size[0],size[1]) + +#define u162imagu162(in,size,out) u16zerosa(out,size[0],size[1]) + +#define i162imagi162(in,size,out) i16zerosa(out,size[0],size[1]) + #endif /* !__INT_IMAG_H__ */ diff --git a/src/c/type/int_real.h b/src/c/type/int_real.h index 4949b883..ce097ec5 100644 --- a/src/c/type/int_real.h +++ b/src/c/type/int_real.h @@ -23,6 +23,14 @@ #define z0reald0(in) zreals(in) +#define u80realu80(in) in + +#define i80reali80(in) in + +#define u160realu160(in) in + +#define i160reali160(in) in + #define s2reals2(in,size,out) {int i;\ for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ } @@ -35,4 +43,19 @@ #define z2reald2(in,size,out) zreala(in, size[0]*size[1],out) +#define u82realu82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } + +#define i82reali82(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } +#define u162realu162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } + +#define i162reali162(in,size,out) {int i;\ + for (i=0;i<size[0]*size[1];i++) out[i]=in[i];\ + } + #endif /* !__INT_REAL_H__ */ diff --git a/src/c/type/types.h b/src/c/type/types.h new file mode 100644 index 00000000..ee5c8992 --- /dev/null +++ b/src/c/type/types.h @@ -0,0 +1,17 @@ +#ifndef _TYPES_H_ +#define _TYPES_H_ + +/*****************************************************************************/ +/* TYPE DEFINITIONS */ +/*****************************************************************************/ +/*typedef unsigned char boolean;*/ + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned int uint32; + +typedef signed char int8; +typedef signed short int16; +typedef signed int int32; + +#endif /*_TYPES_H*/ |