diff options
author | Ankitr19 | 2017-07-04 15:33:41 +0530 |
---|---|---|
committer | Ankitr19 | 2017-07-04 15:33:41 +0530 |
commit | 5b9f48de8fe9af5d4b4a3bea0eb3baacd2bc7950 (patch) | |
tree | 7f2f4c1784898f975c05095b505f047d77361d87 /src | |
parent | afae3013c86d26dc1b233228431be208705acff0 (diff) | |
parent | a3dfa2a4069740517ca6e83f99dd4e0dbb71c377 (diff) | |
download | Scilab2C_fossee_old-5b9f48de8fe9af5d4b4a3bea0eb3baacd2bc7950.tar.gz Scilab2C_fossee_old-5b9f48de8fe9af5d4b4a3bea0eb3baacd2bc7950.tar.bz2 Scilab2C_fossee_old-5b9f48de8fe9af5d4b4a3bea0eb3baacd2bc7950.zip |
New functions added and rpi issues resolved
Diffstat (limited to 'src')
309 files changed, 10553 insertions, 344 deletions
diff --git a/src/c/CACSD/includes/lqr.h b/src/c/CACSD/includes/lqr.h index 062d6e4..5b20ee8 100644 --- a/src/c/CACSD/includes/lqr.h +++ b/src/c/CACSD/includes/lqr.h @@ -17,7 +17,7 @@ extern "C" { #endif -void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K); +void dlqra(double* sys, int sys_rows, int sys_cols, double* Q, double* R, double* S, double* X, double* K); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/CACSD/interfaces/int_lqr.h b/src/c/CACSD/interfaces/int_lqr.h index e6f534f..8deba90 100644 --- a/src/c/CACSD/interfaces/int_lqr.h +++ b/src/c/CACSD/interfaces/int_lqr.h @@ -16,7 +16,14 @@ extern "C" { #endif -#define ss2lqrd2d2(in1,size1,out1,out2) dlqra(in1,size1[0],size1[1],out1,out2); +#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" */ diff --git a/src/c/CACSD/lqe/dlqea.c b/src/c/CACSD/lqe/dlqea.c index 63f8d62..e0be5b3 100644 --- a/src/c/CACSD/lqe/dlqea.c +++ b/src/c/CACSD/lqe/dlqea.c @@ -54,7 +54,7 @@ void dlqea(double* sys, int sys_rows, int sys_cols, double* X, double* K) /*Calculate LQR gain*/ K_lqr = (double*) malloc(no_of_ip*no_of_st*sizeof(double)); - dlqra(sys_lqr,sys_lqr_rows,sys_lqr_cols,X,K_lqr); + 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/dlqra.c b/src/c/CACSD/lqr/dlqra.c index 02ac150..1440c3a 100644 --- a/src/c/CACSD/lqr/dlqra.c +++ b/src/c/CACSD/lqr/dlqra.c @@ -22,7 +22,8 @@ #include "schur.h" #include "matrixDivision.h" -void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K) +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; @@ -32,7 +33,7 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K) double *A, *B, *C, *D; double *B_t, *C_t, *D_t; - double *Q, *R, *S; + //double *Q, *R, *S; double *Ri, *LA, *LE; double *BRi, *StRi, *S_t; double *buf1, *buf2, *buf3, *buf4, *buf5, *buf6; @@ -90,20 +91,29 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K) dom = (int)sys[(sys_rows*(sys_cols-2)) + no_of_states]; - Q = (double*) malloc (no_of_states*no_of_states*sizeof(double)); - R = (double*) malloc (no_of_inputs*no_of_inputs*sizeof(double)); - S = (double*) malloc (no_of_inputs*no_of_states*sizeof(double)); - 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); - dmulma(C_t,no_of_states,no_of_outputs,C,no_of_outputs,no_of_states,Q); - dmulma(D_t,no_of_inputs,no_of_outputs,D,no_of_outputs,no_of_inputs,R); - dmulma(D_t,no_of_inputs,no_of_outputs,C,no_of_outputs,no_of_states,S); + 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); + } - /*Free up unwanted variables*/ + 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); @@ -177,8 +187,8 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K) /*Freeup umwanted variables*/ free(A); - free(Q); - free(R); + //free(Q); + //free(R); free(BRi); free(S_t); free(StRi); @@ -278,7 +288,7 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K) } - free(Q); + //free(Q); free(BRi); free(S_t); free(StRi); @@ -316,7 +326,7 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K) /*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_t,no_of_states,no_of_inputs,buf6); + 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*/ @@ -333,14 +343,14 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K) free(A); free(B); - free(R); + //free(R); free(buf5); free(buf6); } free(B_t); - free(S); + //free(S); free(wsmall); free(X12); free(phi12); 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 0000000..a32ed77 --- /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/u8gcds.c b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c new file mode 100644 index 0000000..75f831f --- /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/includes/int32.h b/src/c/elementaryFunctions/includes/int32.h new file mode 100644 index 0000000..26b7bcb --- /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/isreal.h b/src/c/elementaryFunctions/includes/isreal.h new file mode 100644 index 0000000..0183ebc --- /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/linspace.h b/src/c/elementaryFunctions/includes/linspace.h index 92fe10e..62d4501 100644 --- a/src/c/elementaryFunctions/includes/linspace.h +++ b/src/c/elementaryFunctions/includes/linspace.h @@ -21,8 +21,11 @@ extern "C" { 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); diff --git a/src/c/string/ascii/int_ascii.h b/src/c/elementaryFunctions/includes/nextpow2.h index 36d83f8..c86bea0 100644 --- a/src/c/string/ascii/int_ascii.h +++ b/src/c/elementaryFunctions/includes/nextpow2.h @@ -5,21 +5,24 @@ you should 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 + Author: Ukasha Noor Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in - */ -#ifndef __INT_ASCII_H__ -#define __INT_ASCII_H__ +*/ -#ifdef __cplusplus + +#ifndef __NEXTPOW2_H__ +#define __NEXTPOW2_H__ + +#ifdef __cplusplus extern "C" { #endif -#define g2asciiu82(str,size,oup) gasciia(str,size,oup) +void dnextpow2a(double *in,int size,double *out); -#ifdef __cplusplus +#ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__INT_ASCII_H__*/ +#endif + diff --git a/src/c/elementaryFunctions/includes/sec.h b/src/c/elementaryFunctions/includes/sec.h index 9606158..a04c5f7 100644 --- a/src/c/elementaryFunctions/includes/sec.h +++ b/src/c/elementaryFunctions/includes/sec.h @@ -14,7 +14,7 @@ #include "dynlib_elementaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" -#include <complex.h> +//#include <complex.h> #include "types.h" #ifdef __cplusplus diff --git a/src/c/elementaryFunctions/includes/uint32.h b/src/c/elementaryFunctions/includes/uint32.h new file mode 100644 index 0000000..b90247b --- /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/int32/dint32a.c b/src/c/elementaryFunctions/int32/dint32a.c new file mode 100644 index 0000000..f8b4b66 --- /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 0000000..19366ef --- /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 0000000..e970deb --- /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 0000000..ad07993 --- /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 0000000..d046ba1 --- /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 0000000..c126662 --- /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 0000000..14dbefe --- /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 0000000..8a4f8e7 --- /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 0000000..eaf90fd --- /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 0000000..be3909a --- /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 0000000..a135d12 --- /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 0000000..ee5a16a --- /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 0000000..1361fea --- /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 0000000..c3b0690 --- /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/interfaces/int_int32.h b/src/c/elementaryFunctions/interfaces/int_int32.h new file mode 100644 index 0000000..5da9bd2 --- /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_isreal.h b/src/c/elementaryFunctions/interfaces/int_isreal.h new file mode 100644 index 0000000..cebbf6d --- /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_linspace.h b/src/c/elementaryFunctions/interfaces/int_linspace.h index f8af947..15ea269 100644 --- a/src/c/elementaryFunctions/interfaces/int_linspace.h +++ b/src/c/elementaryFunctions/interfaces/int_linspace.h @@ -15,6 +15,10 @@ #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/string/strncpy/int_strncpy.h b/src/c/elementaryFunctions/interfaces/int_nextpow2.h index fcf245e..6ae4747 100644 --- a/src/c/string/strncpy/int_strncpy.h +++ b/src/c/elementaryFunctions/interfaces/int_nextpow2.h @@ -5,22 +5,22 @@ you should 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 + Author: Ukasha Noor Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in - */ -#ifndef __INT_STRNCPY_H__ -#define __INT_STRNCPY_H__ +*/ -#ifdef __cplusplus -extern "C" { -#endif +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ -#define g2strncpyg2(str,key,oup) gstrncpya(str,key,oup) -#ifdef __cplusplus -} /* extern "C"*/ -#endif +#ifndef __INT_NEXTPOW2_H__ +#define __INT_NEXTPOW2_H__ + -#endif /*__INT_STRNCPY_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_uint32.h b/src/c/elementaryFunctions/interfaces/int_uint32.h new file mode 100644 index 0000000..7c9353b --- /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/isreal/disreals.c b/src/c/elementaryFunctions/isreal/disreals.c new file mode 100644 index 0000000..8c7c820 --- /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 0000000..4b93c02 --- /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/linspace/slinspacea.c b/src/c/elementaryFunctions/linspace/slinspacea.c new file mode 100644 index 0000000..38af394 --- /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 0000000..2404f4d --- /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/nextpow2/dnextpow2a.c b/src/c/elementaryFunctions/nextpow2/dnextpow2a.c new file mode 100644 index 0000000..46f7eb8 --- /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/uint32/duint32a.c b/src/c/elementaryFunctions/uint32/duint32a.c new file mode 100644 index 0000000..7cd0ea3 --- /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 0000000..f507305 --- /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 0000000..84d0fa0 --- /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 0000000..7d9ccef --- /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 0000000..415711e --- /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 0000000..63442f2 --- /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 0000000..0dca1b5 --- /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 0000000..46c0ecb --- /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 0000000..2478c02 --- /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 0000000..3578b42 --- /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 0000000..177bae2 --- /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 0000000..df258b2 --- /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 0000000..a89541b --- /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 0000000..ac48fe2 --- /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/hardware/rasberrypi/Digital/RPI_digitalReadByte.c b/src/c/hardware/rasberrypi/Digital/RPI_digitalReadByte.c new file mode 100644 index 0000000..70fb685 --- /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 0000000..0559406 --- /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 0000000..6d0e4cd --- /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 0000000..02dce55 --- /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 0000000..5d04f4b --- /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 0000000..2f4f1f7 --- /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 0000000..49c3673 --- /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 0000000..f533a1f --- /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 0000000..b30c106 --- /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 0000000..d2ebf3d --- /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 0000000..133ed65 --- /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 0000000..32a4a1f --- /dev/null +++ b/src/c/hardware/rasberrypi/Interrupt/u8RPI_waitForInterrupts.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 "RPIPeripheralInterrupt.h" + +int8 u8RPI_waitForInterrupts(uint8 pin,int16 time){ + int8 out; + out=waitForInterrupt(pin,time); + return (out); +} 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 0000000..c8ecf70 --- /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 0000000..ab22990 --- /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 0000000..ce13e08 --- /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/NotYetDone/INIT_FillSCI2LivCDirs.backup b/src/c/hardware/rasberrypi/NotYetDone/INIT_FillSCI2LivCDirs.backup new file mode 100644 index 0000000..c1db609 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/INIT_FillSCI2LivCDirs.backup @@ -0,0 +1,316 @@ + +//------------------------------------ +//---- Class RPI_DigitalSetup -------- +//------------------------------------ +ClassName = 'RPI_DigitalSetup'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_DigitalSetup'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_DigitalOut'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_HardPWMWrite'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_DigitalIn ----------- +//------------------------------------ +ClassName = 'RPI_DigitalIn'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_DigitalIn'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_delay ---------- +//------------------------------------ +ClassName = 'RPI_delay'; + +//--- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +//--- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_delay'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_delayMicro'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_SerialClose'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_SerialFlush'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_HardPWMSetRange'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_HardPWMSetClock'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_HardPWMSetMode'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_milli ---------- +//------------------------------------ +ClassName = 'RPI_milli'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 0',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''u32''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_millis'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'RPI_micros'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_SetupSerial ---------- +//------------------------------------ +ClassName = 'RPI_SetupSerial'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''u16''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_SerialSetup'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_SetupClose ---------- +//------------------------------------ +//ClassName = 'RPI_SetupClose'; + +// --- Class Annotation. --- +//PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +//ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +//PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +//PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +//PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y'); +//PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +//PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +//ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +//PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +//FunctionName = 'RPI_SerialClose'; +//PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); +//FunctionName = 'RPI_SerialFlush'; +//PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_SerialSendData ---------- +//------------------------------------ +ClassName = 'RPI_SerialSendData'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('u80u80'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80i80'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80u160'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80i160'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80s0'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80d0'+ArgSeparator+'u80',ClassFileName,'file','y'); + +PrintStringInfo('u80u82'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80i82'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80u162'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80i162'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80s2'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80d2'+ArgSeparator+'u80',ClassFileName,'file','y'); +PrintStringInfo('u80g2'+ArgSeparator+'u80',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_SerialSendData'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_SerialDataAvail ---------- +//------------------------------------ +ClassName = 'RPI_SerialDataAvail'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''i16''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_SerialDataAvail'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); +FunctionName = 'RPI_SerialGetChar'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + +//------------------------------------ +//---- Class RPI_ThreadCreate ---------- +//------------------------------------ +ClassName = 'RPI_ThreadCreate'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''u16''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_ThreadCreate'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class RPI_PinISR -------------- +//------------------------------------ +ClassName = 'RPI_PinISR'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''i16''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'RPI_PinISR'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_adress.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_adress.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_adress.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_analogRead.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_analogRead.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_analogRead.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_analogWrite.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_analogWrite.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_analogWrite.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_commande.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_commande.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_commande.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_i2cdetect.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_i2cdetect.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_i2cdetect.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_send.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_send.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/RPI_send.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/ISR/i16RPIPinISRs.c index 6e398a1..6e398a1 100644 --- a/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/ISR/i16RPIPinISRs.c diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/gpio/RPI_DigitalRead.c index 7b84350..4ab496e 100644 --- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/gpio/RPI_DigitalRead.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/gpio/RPI_DigitalWrite.c index f828f77..259bb3b 100644 --- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/gpio/RPI_DigitalWrite.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/gpio/RPI_pinMode.c index f5fefe0..8646e8f 100644 --- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/gpio/RPI_pinMode.c @@ -5,12 +5,13 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ /* Function to setup digital pins + direction = 2 -> PWM_output (BCM pin 18 only) direction = 1 -> output direction = 0 -> input */ diff --git a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetClocks.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmClock.c index d06b135..0ad575b 100644 --- a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetClocks.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmClock.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ diff --git a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetModes.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmMode.c index 0cca7a7..7679a1a 100644 --- a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetModes.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmMode.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ diff --git a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetRanges.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmRange.c index b2489f5..07936b3 100644 --- a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMSetRanges.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmRange.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ diff --git a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMWrites.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmWrite.c index ae02bf0..a16a1d8 100644 --- a/src/c/hardware/rasberrypi/pwm/u8RPIHardPWMWrites.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/pwm/RPI_pwmWrite.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ diff --git a/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/dRPISerialSendDataa.c index f990255..f990255 100644 --- a/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/dRPISerialSendDataa.c diff --git a/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/dRPISerialSendDatas.c index 39112fc..39112fc 100644 --- a/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/dRPISerialSendDatas.c diff --git a/src/c/hardware/rasberrypi/serial/gRPISerialSendDatas.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/gRPISerialSendDatas.c index f4ec8a8..f4ec8a8 100644 --- a/src/c/hardware/rasberrypi/serial/gRPISerialSendDatas.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/gRPISerialSendDatas.c diff --git a/src/c/hardware/rasberrypi/serial/i16RPISerialDataAvails.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialDataAvails.c index b56a819..b56a819 100644 --- a/src/c/hardware/rasberrypi/serial/i16RPISerialDataAvails.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialDataAvails.c diff --git a/src/c/hardware/rasberrypi/serial/i16RPISerialGetChars.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialGetChars.c index 18ca2a7..18ca2a7 100644 --- a/src/c/hardware/rasberrypi/serial/i16RPISerialGetChars.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialGetChars.c diff --git a/src/c/hardware/rasberrypi/serial/i16RPISerialSendDataa.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialSendDataa.c index 24180f4..24180f4 100644 --- a/src/c/hardware/rasberrypi/serial/i16RPISerialSendDataa.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialSendDataa.c diff --git a/src/c/hardware/rasberrypi/serial/i16RPISerialSendDatas.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialSendDatas.c index fe6fe6f..fe6fe6f 100644 --- a/src/c/hardware/rasberrypi/serial/i16RPISerialSendDatas.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i16RPISerialSendDatas.c diff --git a/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i8RPISerialSendDataa.c index c4dd199..c4dd199 100644 --- a/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i8RPISerialSendDataa.c diff --git a/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i8RPISerialSendDatas.c index e637871..e637871 100644 --- a/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/i8RPISerialSendDatas.c diff --git a/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/sRPISerialSendDataa.c index 14c0bc7..14c0bc7 100644 --- a/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/sRPISerialSendDataa.c diff --git a/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/sRPISerialSendDatas.c index ff78dd1..ff78dd1 100644 --- a/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/sRPISerialSendDatas.c diff --git a/src/c/hardware/rasberrypi/serial/u16RPISerialSendDataa.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u16RPISerialSendDataa.c index b444047..b444047 100644 --- a/src/c/hardware/rasberrypi/serial/u16RPISerialSendDataa.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u16RPISerialSendDataa.c diff --git a/src/c/hardware/rasberrypi/serial/u16RPISerialSendDatas.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u16RPISerialSendDatas.c index b4a90c2..b4a90c2 100644 --- a/src/c/hardware/rasberrypi/serial/u16RPISerialSendDatas.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u16RPISerialSendDatas.c diff --git a/src/c/hardware/rasberrypi/serial/u16RPISerialSetups.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u16RPISerialSetups.c index cde4cba..cde4cba 100644 --- a/src/c/hardware/rasberrypi/serial/u16RPISerialSetups.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u16RPISerialSetups.c diff --git a/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialCloses.c index 5162d15..5162d15 100644 --- a/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialCloses.c diff --git a/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialFlushs.c index c80a92c..c80a92c 100644 --- a/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialFlushs.c diff --git a/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialSendChars.c index e381351..e381351 100644 --- a/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialSendChars.c diff --git a/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialSendDataa.c index 9d09714..9d09714 100644 --- a/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialSendDataa.c diff --git a/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialSendDatas.c index 9edb439..9edb439 100644 --- a/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/serial/u8RPISerialSendDatas.c diff --git a/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/threading/u16RPIThreadCreates.c index c05c959..c05c959 100644 --- a/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/threading/u16RPIThreadCreates.c diff --git a/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_delay.c index 2679086..8374c2b 100644 --- a/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_delay.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ @@ -17,7 +17,7 @@ #include "types.h" #include "RPIPeripheralTiming.h" -void u16RPIDelayMillis(uint16 time) +void u16RPI_delay(uint16 time) { delay(time); diff --git a/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_delayMicro.c index 9aeeab7..df2a7a7 100644 --- a/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_delayMicro.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ @@ -15,7 +15,7 @@ #include "types.h" #include "RPIPeripheralTiming.h" -void u16RPIDelayMicros(uint16 time) +void u16RPI_delayMicro(uint16 time) { delayMicroseconds(time); } diff --git a/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_micros.c index eb086a9..8d06742 100644 --- a/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_micros.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ @@ -15,7 +15,7 @@ #include "types.h" #include "RPIPeripheralTiming.h" -uint32 u32RPIGetMicros() +uint32 u32RPI_micros() { return(micros()); -}
\ No newline at end of file +} diff --git a/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_millis.c index c118975..92b6e1b 100644 --- a/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/backup/timing/RPI_millis.c @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ @@ -15,7 +15,7 @@ #include "types.h" #include "RPIPeripheralTiming.h" -uint32 u32RPIGetMillis() +uint32 u32RPI_millis() { return(millis()); -}
\ No newline at end of file +} diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/raspi.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/raspi.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/raspi.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/NotToDo/raspi_close.c b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/raspi_close.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/NotToDo/raspi_close.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/SPI/RPI_SPIDataRW.c b/src/c/hardware/rasberrypi/NotYetDone/SPI/RPI_SPIDataRW.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/SPI/RPI_SPIDataRW.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/SPI/RPI_SPISetup.c b/src/c/hardware/rasberrypi/NotYetDone/SPI/RPI_SPISetup.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/SPI/RPI_SPISetup.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64Orientation.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64Orientation.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64Orientation.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64circle.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64circle.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64circle.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64clear.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64clear.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64clear.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64ellipse.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64ellipse.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64ellipse.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64line.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64line.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64line.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64lineTo.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64lineTo.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64lineTo.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64point.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64point.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64point.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64putchar.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64putchar.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64putchar.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64puts.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64puts.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64puts.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64rectangle.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64rectangle.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64rectangle.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64setOrigin.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64setOrigin.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64setOrigin.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64setup.c b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64setup.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/lcd128x64/RPI_lcd128x64setup.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_locks.c b/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_locks.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_locks.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_prioritys.c b/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_prioritys.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_prioritys.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file diff --git a/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_unlocks.c b/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_unlocks.c new file mode 100644 index 0000000..3e94b92 --- /dev/null +++ b/src/c/hardware/rasberrypi/NotYetDone/multiThreading/u8RPI_unlocks.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "types.h"
\ No newline at end of file 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 0000000..31543af --- /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 0000000..d20aa54 --- /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 0000000..cf25607 --- /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 0000000..4d15063 --- /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 0000000..c1dabfd --- /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 0000000..d167200 --- /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 0000000..3309317 --- /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 0000000..581e15a --- /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 0000000..4170f4c --- /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 0000000..0a5c476 --- /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 0000000..153b88e --- /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 0000000..76601f8 --- /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 0000000..4e95aac --- /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 0000000..3f0a649 --- /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 0000000..6a264b6 --- /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 0000000..5d24c2b --- /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 0000000..a7a8450 --- /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 0000000..b383f2a --- /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 0000000..1ffdda7 --- /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 0000000..7802d6b --- /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 0000000..5724ebb --- /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 0000000..433bed2 --- /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 0000000..a19aa6d --- /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 0000000..2c8aa33 --- /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 index 2f40ffb..842fd73 100644 --- a/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h @@ -19,15 +19,14 @@ extern "C" { #endif - #include "types.h" -#include "wiringPi.h" -extern int phy_pin[]; +extern int phy_pin[]; //Not needed??? -void u8RPIDigitalSetups(uint8 pin, uint8 direction); -void u8RPIDigitalOuts(uint8 pin, uint8 state); -uint8 u8RPIDigitalIns(uint8 pin); +uint8 u8RPI_digitalReads(uint8 pin); +uint8 RPI_digitalReadByte(); +void u8RPI_digitalWrites(uint8 pin, uint8 state); +void u8RPI_digitalWriteBytes(uint8 value); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralGertboard.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralGertboard.h new file mode 100644 index 0000000..3594d0a --- /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 0000000..6c8dfe1 --- /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/RPIPeripheralThreading.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralInterrupt.h index a7b2adb..d9fc30f 100644 --- a/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralInterrupt.h @@ -5,24 +5,23 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ -#ifndef __RPIPERIPHERALTHREADING_H__ -#define __RPIPERIPHERALTHREADING_H__ - -#include "types.h" -#include "wiringPi.h" +#ifndef __RPIPERIPHERALINTERRUPT_H__ +#define __RPIPERIPHERALINTERRUPT_H__ #ifdef __cplusplus extern "C" { #endif -uint16 RPIThreadCreate(void *(*threadFunction)(void*)); +#include "types.h" + +int8 u8RPI_waitForInterrupts(uint8 pin,int16 time); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__RPIPERIPHERALTHREADING_H__*/ +#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 0000000..654a31a --- /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/RPIPeripheralMcp.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralMcp.h new file mode 100644 index 0000000..5304f14 --- /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/string/strchr/int_strchr.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralMisc.h index 8747545..0ef5acc 100644 --- a/src/c/string/strchr/int_strchr.h +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralMisc.h @@ -5,21 +5,27 @@ you should 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 + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in - */ -#ifndef __INT_STRCHR_H__ -#define __INT_STRCHR_H__ +*/ -#ifdef __cplusplus +#ifndef __RPIPERIPHERALMISC_H__ +#define __RPIPERIPHERALMISC_H__ + +#ifdef __cplusplus extern "C" { #endif -#define g2g2strchrg2(str,size,key,size2,out) gstrchra(str,size[1],key,size2[1],out) +#include "types.h" +#include "sn3218.h" + +uint8 RPI_boardRev(); +void u8RPI_padDrives(uint8 group,uint8 strength); +int8 u16RPI_sn3218Setups(uint16 pinBase); -#ifdef __cplusplus +#ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__INT_STRCHR_H__*/ +#endif /*__RPIPERIPHERALMISC_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h index d463d9c..f1d3024 100644 --- a/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralPWM.h @@ -5,24 +5,24 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ #ifndef __RPIPERIPHERALPWM_H__ #define __RPIPERIPHERALPWM_H__ -#include "types.h" -#include "wiringPi.h" - #ifdef __cplusplus extern "C" { #endif -void u8RPIHardPWMWrites(uint8 pin, uint16 value); -void u8RPIHardPWMSetRanges(uint16 value); -void u8RPIHardPWMSetModes(uint8 mode); -void u8RPIHardPWMSetClocks(uint16 clk_divisor); +#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" */ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralPcf.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralPcf.h new file mode 100644 index 0000000..5545933 --- /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 0000000..d2dcd13 --- /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/RPIPeripheralPinISR.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralPinMap.h index fc5a8d0..39c2379 100644 --- a/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralPinMap.h @@ -5,22 +5,24 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ -#ifndef __RPIPERIPHERALPINISR_H__ -#define __RPIPERIPHERALPINISR_H__ - +#ifndef __RPIPERIPHERALPINMAP_H__ +#define __RPIPERIPHERALPINMAP_H__ #ifdef __cplusplus extern "C" { #endif -int16 i16RPIPinISRs(uint8 pin, uint8 edgetype, void (*ISRFunction)(void)); +#include "types.h" + +int8 u8RPI_physToGpios(uint8 pin); +int8 u8RPI_wpiToGpios(uint8 pin); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__RPIPERIPHERALPINISR_H__*/ +#endif /*__RPIPERIPHERALPINMAP_H__*/ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h index 14df95b..67284bd 100644 --- a/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h @@ -5,42 +5,28 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ #ifndef __RPIPERIPHERALSERIAL_H__ #define __RPIPERIPHERALSERIAL_H__ -#include "types.h" -#include "wiringSerial.h" - #ifdef __cplusplus extern "C" { #endif -int u8RPISerialSetups(char* port, int baudrate); -void u8RPISerialCloses(int fd); - -void u8RPISerialSendChars(int fd, uint8 data); -void u8RPISerialSendDatas(int fd, uint8 data); -void i8RPISerialSendDatas(int fd, int8 data); -void u16RPISerialSendDatas(int fd, uint16 data); -void i16RPISerialSendDatas(int fd, int16 data); -void sRPISerialSendDatas(int fd, float data); -void dRPISerialSendDatas(int fd, double data); -void u8RPISerialSendDataa(int fd, uint8* data, int size); -void i8RPISerialSendDataa(int fd, int8* data, int size); -void u16RPISerialSendDataa(int fd, uint16* data, int size); -void i16RPISerialSendDataa(int fd, int16* data, int size); -void sRPISerialSendDataa(int fd, float* data, int size); -void dRPISerialSendDataa(int fd, double* data, int size); -void gRPISerialSendDatas(int fd, uint8* data, int size); - -int16 i16RPISerialDataAvails(int fd); -int16 i16RPISerialGetChars(int fd); +#include "types.h" +#include "wiringSerial.h" -void u8RPISerialFlushs(int fd); +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" */ diff --git a/src/c/hardware/rasberrypi/includes/RPIPeripheralSetup.h b/src/c/hardware/rasberrypi/includes/RPIPeripheralSetup.h new file mode 100644 index 0000000..373f064 --- /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 0000000..4c58bb7 --- /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 0000000..9494506 --- /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 index 854073f..e75a539 100644 --- a/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h +++ b/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ @@ -22,10 +22,10 @@ extern "C" { #include "types.h" #include "wiringPi.h" -void u16RPIDelayMillis(uint16 time); -void u16RPIDelayMicros(uint16 time); -uint32 u32RPIGetMillis(); -uint32 u32RPIGetMicros(); +void u32RPI_delays(uint32 time); +void u32RPI_delayMicros(uint32 time); +uint32 RPI_millis(); +uint32 RPI_micros(); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h index 40a8e1a..7de051f 100644 --- a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h @@ -5,7 +5,7 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Siddhesh Wani, Jorawar Singh Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ @@ -20,14 +20,13 @@ extern "C" { #endif -#define RPI_DigitalSetup(in1,in2) u8RPIDigitalSetups((uint8) in1, (uint8) in2); - -#define RPI_DigitalIn(in1) u8RPIDigitalIns((uint8) in1); - -#define RPI_DigitalOut(in1,in2) u8RPIDigitalOuts((uint8) in1, (uint8) in2); +#define u80RPI_digitalReadu80(pin) u8RPI_digitalReads(pin); +#define RPI_digitalReadByteu80() RPI_digitalReadByte(); +#define u80u80RPI_digitalWrite(pin,state) u8RPI_digitalWrites(pin,state); +#define u80RPI_digitalWriteByte(value) u8RPI_digitalWriteBytes(value); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /* !__RPIPERIPHERALGPIO_H__ */ +#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 0000000..cea8bb6 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_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 __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 u160RPI_gertboardAnalogReadu160(pin) u160RPI_gertboardAnalogReads(pin); +#define u160u160RPI_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 0000000..f18fd57 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralI2C.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_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 u160RPI_I2CReadi80(fd) u16RPI_I2CReads(fd); +#define u160u160RPI_I2CReadReg8i80(fd,reg) u16RPI_I2CReadReg8s(fd,reg); +#define u160u160RPI_I2CReadReg16i80(fd,reg) u16RPI_I2CReadReg16s(fd,reg); +#define u160u160RPI_I2CWritei80(fd,data) u16RPI_I2CWrites(fd,data); +#define u160u160u160RPI_I2CWriteReg8i80(fd,reg,data) u16RPI_I2CWriteReg8s(fd,reg,data); +#define u160u160u160RPI_I2CWriteReg16i80(fd,reg,data) u16RPI_I2CWriteReg16s(fd,reg,data); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALI2C_H__ */ diff --git a/src/c/string/strcspn/int_strcspn b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralInterrupt.h index f2da3e4..cb55572 100644 --- a/src/c/string/strcspn/int_strcspn +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralInterrupt.h @@ -5,21 +5,25 @@ you should 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 + Author: Jorawar Singh, Siddhesh Wani Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in - */ -#ifndef __INT_STRCSPN_H__ -#define __INT_STRCSPN_H__ +*/ -#ifdef __cplusplus +#ifndef __INT_RPIPERIPHERALINTERRUPT_H__ +#define __INT_RPIPERIPHERALINTERRUPT_H__ + +#include "types.h" +#include "RPIPeripheralInterrupt.h" + +#ifdef __cplusplus extern "C" { #endif -#define g2g2strcspnu80(str1,size1,str2,size2) gstrcspna(str1,size1,str2,size2) +#define u80i160RPI_waitForInterrupti80(pin,time) u8RPI_waitForInterrupts(pin,time); -#ifdef __cplusplus +#ifdef __cplusplus } /* extern "C" */ #endif -#endif /* __INT_STRCSPN_H__*/ +#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 0000000..da23bee --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.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: Jorawar Singh, Siddhesh Wani + 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 u80RPI_lcdClear(fd) u8RPI_lcdClears(fd); +#define u80u80RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); +#define u80u80RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); +#define u80u80RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); +#define u80RPI_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 u80u80u80RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); +#define u80u80RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); +#define u80u80RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); +#define u80g2RPI_lcdPutss(fd,msg,size) u8RPI_lcdPutss(fd,msg,size[1]);; +#define u80g2RPI_lcdPrintfs(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_RPIPeripheralMcp.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMcp.h new file mode 100644 index 0000000..c044cf7 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralMcp.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_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 u160u80RPI_mcp23016Setupu80(pinBase,addr) u16RPI_mcp23016Setups(pinBase,addr); +#define u160u80RPI_mcp23017Setupu80(pinBase,addr) u16RPI_mcp23017Setups(pinBase,addr); +#define u160u80u80RPI_mcp23s08Setupu80(pinBase,spiport,devId) u16RPI_mcp23s08Setups(pinBase,spiport,devId); +#define u160u80u80RPI_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 0000000..b836d68 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_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: 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 u160RPI_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 index 8c8f4c6..49c58c0 100644 --- a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPWM.h @@ -1,30 +1,33 @@ - /* Copyright (C) 2016 - IIT Bombay - FOSSEE +/* Copyright (C) 2016 - IIT Bombay - FOSSEE This file must be used under the terms of the CeCILL. This source file is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + 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 RPI_HardPWMWrite(pin,value) u8RPIHardPWMWrites((uint8)pin,(uint16)value) -#define RPI_HardPWMSetRange(value) u8RPIHardPWMSetRanges((uint16)value) -#define RPI_HardPWMSetMode(mode) u8RPIHardPWMSetModes((uint8)mode) -#define RPI_HardPWMSetClock(clk_divisor) u8RPIHardPWMSetClocks((uint16)clk_divisor) +#define u80u160RPI_pwmWrite(pin,value) u8RPI_pwmWrites(pin,value); +#define u320RPI_pwmRange(value) u32RPI_pwmRanges(value); +#define g2RPI_pwmMode(mode) gRPI_pwmModea(mode); +#define u160RPI_pwmClock(divisor) u16RPI_pwmClocks(divisor); +#define u80u160RPI_pwmToneWrite(pin,value) u8RPI_pwmToneWrites(pin,value); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__INT_RPIPERIPHERALPWM_H__*/ +#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 0000000..e3d2009 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_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: 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 u160u80RPI_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 0000000..08056f9 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPiGlow.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: 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 u80u80u80RPI_piGlow1(leg,ring,intensity) u8RPI_piGlow1s(leg,ring,intensity); +#define u80u80RPI_piGlowLeg(leg,intensity) u8RPI_piGlowLegs(leg,intensity); +#define u80u80RPI_piGlowRing(ring,intensity) u8RPI_piGlowRings(ring,intensity); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INT_RPIPERIPHERALPIGLOW_H__ */ diff --git a/src/c/string/strspn/int_strspn.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinMap.h index 506b311..39c5c01 100644 --- a/src/c/string/strspn/int_strspn.h +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinMap.h @@ -5,21 +5,26 @@ you should 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 + Author: Jorawar Singh, Siddhesh Wani Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in - */ -#ifndef __INT_STRSPN_H__ -#define __INT_STRSPN_H__ +*/ -#ifdef __cplusplus +#ifndef __INT_RPIPERIPHERALPINMAP_H__ +#define __INT_RPIPERIPHERALPINMAP_H__ + +#include "types.h" +#include "RPIPeripheralPinMap.h" + +#ifdef __cplusplus extern "C" { #endif -#define g2g2strspnu80(str1,size1,str2,size2) gstrspna(str1,size1,str2,size2) +#define u80RPI_physToGpioi80(pin) u8RPI_physToGpios(pin); +#define u80RPI_wpiToGpioi80(pin) u8RPI_wpiToGpios(pin); -#ifdef __cplusplus +#ifdef __cplusplus } /* extern "C" */ #endif -#endif /* __INT_STRSPN_H__*/ +#endif /* !__INT_RPIPERIPHERALPINMAP_H__ */ diff --git a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h index 5d53b98..e0832f9 100644 --- a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h @@ -1,47 +1,36 @@ - /* Copyright (C) 2016 - IIT Bombay - FOSSEE +/* Copyright (C) 2016 - IIT Bombay - FOSSEE This file must be used under the terms of the CeCILL. This source file is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + 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 RPI_SerialSetup(port,size,baudrate) u16RPISerialSetups(port,baudrate) -#define RPI_SerialClose(fd) u8RPISerialCloses(fd) - -#define u80u80RPI_SerialSendData(fd,data) u8RPISerialSendDatas(fd,data) -#define u80i80RPI_SerialSendData(fd,data) i8RPISerialSendDatas(fd,data) -#define u80u160RPI_SerialSendData(fd,data) u16RPISerialSendDatas(fd,data) -#define u80i160RPI_SerialSendData(fd,data) i16RPISerialSendDatas(fd,data) -#define u80s0RPI_SerialSendData(fd,data) sRPISerialSendDatas(fd,data) -#define u80d0RPI_SerialSendData(fd,data) dRPISerialSendDatas(fd,data) - -#define u80u82RPI_SerialSendData(fd,data,size) u8RPISerialSendDataa(fd,data,size[0]*size[1]); -#define u80i82RPI_SerialSendData(fd,data,size) i8RPISerialSendDataa(fd,data,size[0]*size[1]); -#define u80u162RPI_SerialSendData(fd,data,size) u16RPISerialSendDataa(fd,data,size[0]*size[1]); -#define u80i162RPI_SerialSendData(fd,data,size) i16RPISerialSendDataa(fd,data,size[0]*size[1]); -#define u80s2RPI_SerialSendData(fd,data,size) sRPISerialSendDataa(fd,data,size[0]*size[1]); -#define u80d2RPI_SerialSendData(fd,data,size) dRPISerialSendDataa(fd,data,size[0]*size[1]); -#define u80g2RPI_SerialSendData(fd,data,size) gRPISerialSendDatas(fd,data,size[0]*size[1]); - -#define RPI_SerialDataAvail(fd) i16RPISerialDataAvails(fd) -#define RPI_SerialGetChar(fd) i16RPISerialGetChars(fd) -#define RPI_SerialFlush(fd) u8RPISerialFlushs(fd) +#define g2u320RPI_serialOpeni80(device,size,baud) gRPI_serialOpena(device,size[1],baud); +#define u80RPI_serialClose(fd) u8RPI_serialCloses(fd); +#define u80RPI_serialDataAvailu80(fd) u8RPI_serialDataAvails(fd); +#define u80RPI_serialFlush(fd) u8RPI_serialFlushs(fd); +#define u80RPI_serialGetcharg2(fd,out) u8RPI_serialGetchars(fd,out); +#define u80g2RPI_serialPrintf(fd,msg,size) u8RPI_serialPrintfs(fd,msg,size[1]); +#define u80u80RPI_serialPutchar(fd,character) u8RPI_serialPutchars(fd,character); +#define u80g2RPI_serialPutsg2(fd,character,size) u8RPI_serialPutss(fd,character,size[1]); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__INT_RPIPERIPHERALSERIAL_H__*/ +#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 0000000..0e1f7b4 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSetup.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: 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 + +#define g2RPI_pinNumberingi80(seq,size) gRPI_pinNumberinga(seq,size[1]); +#define u80RPI_getAltu80(pin) u8RPI_getAlts(pin); +#define u80u80RPI_pinModeAlt(pin,mode) u8RPI_pinModeAlts(pin,mode); +#define u80g2RPI_pinMode(pin,mode,size) u8RPI_pinModes(pin,mode,size[1]); +#define u80g2RPI_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 0000000..6b142bd --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_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: 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 u80u80u80u80RPI_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); + +#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 0000000..80372b2 --- /dev/null +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSoft.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: 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 u80RPI_softPwmStop(pin) u8RPI_softPwmStops(pin); +#define u80u160RPI_softPwmWrite(pin,value) u8RPI_softPwmWrites(pin,value); +#define u80RPI_softToneCreateu80(pin) u8RPI_softToneCreates(pin); +#define u80RPI_softToneStop(pin) u8RPI_softToneStops(pin); +#define u80u320RPI_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 index 1a70465..5c4e618 100644 --- a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h +++ b/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h @@ -5,12 +5,11 @@ you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Jorawar Singh, Siddhesh Wani Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ - #ifndef __INT_RPIPERIPHERALTIMING_H__ #define __INT_RPIPERIPHERALTIMING_H__ @@ -21,14 +20,13 @@ extern "C" { #endif -#define RPI_DelayMicro(in1) u16RPIDelayMicros((uint16) in1) -#define RPI_DelayMilli(in1) u16RPIDelayMillis((uint16) in1) -#define RPI_GetMicro() u32RPIGetMicros() -#define RPI_GetMillis() u32RPIGetMillis() - +#define u320RPI_delay(time) u32RPI_delays(time); +#define u320RPI_delayMicro(time) u32RPI_delayMicros(time); +#define RPI_millisu320() RPI_millis(); +#define RPI_microsu320() RPI_micros(); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /* !__RPIPERIPHERALTIMING_H__ */ +#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 0000000..b85d82f --- /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 0000000..659cdf0 --- /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 0000000..bf0c48e --- /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 0000000..8bb0271 --- /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 0000000..7425ebe --- /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 0000000..98762de --- /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 0000000..b69f311 --- /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 0000000..3188a97 --- /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 0000000..58d01fa --- /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 0000000..c50a177 --- /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 0000000..a7f492b --- /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 0000000..7097d69 --- /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/mcp/u16RPI_mcp23008Setups.c b/src/c/hardware/rasberrypi/mcp/u16RPI_mcp23008Setups.c new file mode 100644 index 0000000..c7d7326 --- /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 0000000..2e35e5c --- /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 0000000..35ed547 --- /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 0000000..e1bdab6 --- /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 0000000..5ba30d2 --- /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 0000000..f7e38df --- /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 0000000..de26a92 --- /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 0000000..792cda1 --- /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 0000000..f4ef5b5 --- /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 0000000..985696d --- /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 0000000..2037a9b --- /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 0000000..09a5713 --- /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 0000000..5f65f34 --- /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 0000000..da67a15 --- /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 0000000..85e1fb2 --- /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 0000000..1fb2296 --- /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 0000000..fe1b8cd --- /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 value){ + pwmToneWrite(pin, value); +} 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 0000000..be94e73 --- /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 0000000..d697779 --- /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 0000000..761fdc2 --- /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 0000000..2b76d14 --- /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 0000000..dfcbb1f --- /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 0000000..664fbda --- /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 0000000..be04b47 --- /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/interpolation/includes/interp1.h b/src/c/interpolation/includes/interp1.h new file mode 100644 index 0000000..738bfe6 --- /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 0000000..07d8ece --- /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 0000000..7b755e1 --- /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 0000000..b8cb085 --- /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/linearAlgebra/bdiag/dbdiaga.c b/src/c/linearAlgebra/bdiag/dbdiaga.c new file mode 100644 index 0000000..fd455ba --- /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/hess/dhessa.c b/src/c/linearAlgebra/hess/dhessa.c new file mode 100644 index 0000000..57f81b3 --- /dev/null +++ b/src/c/linearAlgebra/hess/dhessa.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 + 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" + +extern int dgehrd_(int *, int *,int *,double *,int *,double *,double *,int *,int *); +extern int dorghr_(int *, int *,int *,double *,int *,double *,double *,int *,int *); + + +void dhessa(double *in1,int size,int nout,double *out1, double *out2){ + 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++) + for(j=0;j<N;j++) + out2[i+j*N] = A[i+j*N]; + + for(j=1;j<=N-2;j++){ + 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/includes/hess.h b/src/c/linearAlgebra/includes/hess.h new file mode 100644 index 0000000..b9c53de --- /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/spec.h b/src/c/linearAlgebra/includes/spec.h new file mode 100644 index 0000000..3cd0b18 --- /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/sva.h b/src/c/linearAlgebra/includes/sva.h new file mode 100644 index 0000000..ea628a3 --- /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 0000000..260b87f --- /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 + +void dsvda(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/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h b/src/c/linearAlgebra/interfaces/int_hess.h index b2c1ed1..fb2ca72 100644 --- a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h +++ b/src/c/linearAlgebra/interfaces/int_hess.h @@ -1,25 +1,28 @@ - /* Copyright (C) 2016 - IIT Bombay - FOSSEE + /* Copyright (C) 2017 - IIT Bombay - FOSSEE This file must be used under the terms of the CeCILL. This source file is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Sandeep Gupta Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in */ -#ifndef __INT_RPIPERIPHERALPINISR_H__ -#define __INT_RPIPERIPHERALPINISR_H__ + +#ifndef __INT_HESS_H__ +#define __INT_HESS_H__ #ifdef __cplusplus extern "C" { #endif -#define RPI_PinISR(pin,edge,funname) i16RPIPinISRs((uint8)pin,(uint8)edge,funname) +#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_RPIPERIPHERALPINISR_H__*/ +#endif /*__INT_HESS_H__*/ + diff --git a/src/c/linearAlgebra/interfaces/int_spec.h b/src/c/linearAlgebra/interfaces/int_spec.h new file mode 100644 index 0000000..8772a6a --- /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_sva.h b/src/c/linearAlgebra/interfaces/int_sva.h new file mode 100644 index 0000000..4a2ec56 --- /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,size2,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 0000000..449ee74 --- /dev/null +++ b/src/c/linearAlgebra/interfaces/int_svd.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: 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(in1,size1[0],size1[1],0,1,out1,NULL,NULL) +#define d2g2svdd2d2d2(in1,size1,in2,size2,out1,out2,out3) dsvda(in1,size1[0],size1[1],1,3,out1,out2,out3); +#define d2svdd2d2d2(in1,size1,out1,out2,out3) dsvda(in1,size1[0],size1[1],0,3,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/pbig/pbig.c b/src/c/linearAlgebra/pbig/pbig.c new file mode 100644 index 0000000..c13a942 --- /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/schur/zgschura.c b/src/c/linearAlgebra/schur/zgschura.c new file mode 100644 index 0000000..a49cbe5 --- /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 0000000..90dbd0a --- /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 0000000..9c34c9e --- /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 0000000..a2b6548 --- /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 0000000..28440be --- /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 0000000..1131ecf --- /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 0000000..50751a2 --- /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 0000000..25c8806 --- /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 0000000..9bd46ad --- /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 0000000..f696bff --- /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 0000000..dcdaea5 --- /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 0000000..0631bb4 --- /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 0000000..2ba2e59 --- /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 0000000..a2b1c25 --- /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 0000000..5a357fa --- /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 0000000..6e46c05 --- /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 0000000..d3a4312 --- /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 0000000..98b2c5a --- /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 0000000..d3ab00d --- /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 0000000..a090f02 --- /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 0000000..fb2bc25 --- /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 0000000..7c36943 --- /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 0000000..04f409d --- /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 0000000..f4154eb --- /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 0000000..0c38d2f --- /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 0000000..e33ed89 --- /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/sva/dsvaa.c b/src/c/linearAlgebra/sva/dsvaa.c new file mode 100644 index 0000000..ee27eef --- /dev/null +++ b/src/c/linearAlgebra/sva/dsvaa.c @@ -0,0 +1,92 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 + +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(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); + 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++){ + 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++){ + for(j=0;j<rk;j++){ + out3[i+j*arow] = V[i+j*arow]; + } + } +} diff --git a/src/c/linearAlgebra/svd/dsvda.c b/src/c/linearAlgebra/svd/dsvda.c new file mode 100644 index 0000000..e6af300 --- /dev/null +++ b/src/c/linearAlgebra/svd/dsvda.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: 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*); + +/* 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) */ + +void dsvda(double *in1,int row,int col,double in2,double nout,double *out1, \ + double *out2,double *out3){ + + char JOBU,JOBVT; + int 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; + + 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); + } + else{ + memcpy(out1,U,LDU*min(row,col)*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); + } +} + +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 0000000..0d36022 --- /dev/null +++ b/src/c/linearAlgebra/svd/zsvda.c @@ -0,0 +1,173 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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" + +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]); + } + } + //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{ + 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)]); + } + } + //free(U); + //free(VT); + } + /* 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); + } + } + } +} diff --git a/src/c/matrixOperations/cat/ccata.c b/src/c/matrixOperations/cat/ccata.c index a6ac6cf..cd2b4c9 100644 --- a/src/c/matrixOperations/cat/ccata.c +++ b/src/c/matrixOperations/cat/ccata.c @@ -26,7 +26,7 @@ void crowcata(floatComplex *in1, int lines1, int columns1, floatComplex *in2, i { for (j = 0 ; j < lines1 ; ++j) { - /*out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];*/ + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; } for (j = 0 ; j < lines2 ; ++j) { diff --git a/src/c/matrixOperations/cat/zcata.c b/src/c/matrixOperations/cat/zcata.c index bfb6e92..485553d 100644 --- a/src/c/matrixOperations/cat/zcata.c +++ b/src/c/matrixOperations/cat/zcata.c @@ -26,7 +26,7 @@ void zrowcata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, { for (j = 0 ; j < lines1 ; ++j) { - /*out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];*/ + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; } for (j = 0 ; j < lines2 ; ++j) { 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 0000000..7018df2 --- /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; + a = ((5*(float)analogRead(pin))/1023); + return(a); +} + 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 0000000..2dd82e4 --- /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; + a = ((value*255)/5); + analogWrite(pin,a); + +} 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 0000000..349bcb1 --- /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) + { + analogWrite(dcm_pin_1[motor_no],0); + analogWrite(dcm_pin_2[motor_no],0); + } + + else + { + digitalWrite(dcm_pin_1[motor_no],LOW); + digitalWrite(dcm_pin_2[motor_no],LOW); + } +} 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 index 6e1c2ca..e8fa8b3 100644 --- a/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c +++ b/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c @@ -6,6 +6,7 @@ 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 */ 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 index 389f911..0d04e74 100644 --- a/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c +++ b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c @@ -6,6 +6,7 @@ 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 */ 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 0000000..adc1a6e --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp @@ -0,0 +1,10 @@ +#include "cmd_i2c_dev.h" +#include "Arduino.h" +#include "Wire.h" + + +uint8 u8cmd_i2c_devs(uint8 address) +{ + Wire.begin(); + return((uint8)address); +} 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 0000000..8f02a87 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp @@ -0,0 +1,18 @@ +#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 0000000..0a2ec2e --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp @@ -0,0 +1,26 @@ +#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 0000000..0239097 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp @@ -0,0 +1,13 @@ +#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 0000000..63cc7c7 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp @@ -0,0 +1,16 @@ +#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/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h b/src/c/scilab-arduino/includes/cmd_analog_in_volt.h index 68ed6e0..ec47142 100644 --- a/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h +++ b/src/c/scilab-arduino/includes/cmd_analog_in_volt.h @@ -1,25 +1,28 @@ - /* Copyright (C) 2016 - IIT Bombay - FOSSEE +/* Copyright (C) 2017 - IIT Bombay - FOSSEE This file must be used under the terms of the CeCILL. This source file is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani + Author: Yash Pratap Singh Tomar Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in - */ -#ifndef __INT_RPIPERIPHERALTHREADING_H__ -#define __INT_RPIPERIPHERALTHREADING_H__ +*/ + +#ifndef __CMD_ANALOG_IN_VOLT_H__ +#define __CMD_ANALOG_IN_VOLT_H__ + +#include "types.h" #ifdef __cplusplus extern "C" { #endif - -#define RPI_ThreadCreate(fn) RPIThreadCreate(fn); + +float u8cmd_analog_in_volts(uint8 board_no, uint8 pin); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__INT_RPIPERIPHERALTHREADING_H__*/ +#endif /* __CMD_ANALOG_IN_VOLT_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 0000000..51580fb --- /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 0000000..d185fb5 --- /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 index 2b69c99..1b5d41c 100644 --- a/src/c/scilab-arduino/includes/cmd_dcmotor_run.h +++ b/src/c/scilab-arduino/includes/cmd_dcmotor_run.h @@ -22,7 +22,7 @@ extern "C" { extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; -void u8cmd_dc_motor_runs(uint8 board_no, uint8 motor_no, int16 duty); +void u8cmd_dcmotor_runs(uint8 board_no, uint8 motor_no, int16 duty); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h index cecd465..45854ff 100644 --- a/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h +++ b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h @@ -22,7 +22,7 @@ extern "C" { extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; -void u8cmd_dc_motor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ +void u8cmd_dcmotor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ uint8 pin_1, uint8 pin_2); #ifdef __cplusplus 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 0000000..861a8e7 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_dev.h @@ -0,0 +1,16 @@ +#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 0000000..791bdd3 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_read.h @@ -0,0 +1,16 @@ +#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 0000000..ea203ad --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_read_register.h @@ -0,0 +1,16 @@ +#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 0000000..6a57222 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_write.h @@ -0,0 +1,16 @@ +#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 0000000..ff1b9ec --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_write_register.h @@ -0,0 +1,16 @@ +#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/interfaces/int_cmd_analog_in_volt.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.h new file mode 100644 index 0000000..e8fe65d --- /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_volt.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.h new file mode 100644 index 0000000..283f8fa --- /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 index 61e0d2e..d465ff6 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h +++ b/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h @@ -6,6 +6,7 @@ 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 */ @@ -20,16 +21,16 @@ 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 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); + (uint8)in2, (int16)in3); + +#define d0d0cmd_dcmotor_release(in1,in2) u8cmd_dcmotor_releases((uint8)in1,(uint8)in2) #ifdef __cplusplus 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 0000000..c4d93d7 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h @@ -0,0 +1,17 @@ +#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 0000000..b0633a0 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h @@ -0,0 +1,19 @@ +#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 0000000..5f4c529 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h @@ -0,0 +1,18 @@ +#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 0000000..a7705a8 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h @@ -0,0 +1,20 @@ +#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 0000000..35c0527 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h @@ -0,0 +1,19 @@ +#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/sleep/u16sleeps.c b/src/c/scilab-arduino/sleep/u16sleeps.c index 88f8a66..3045978 100644 --- a/src/c/scilab-arduino/sleep/u16sleeps.c +++ b/src/c/scilab-arduino/sleep/u16sleeps.c @@ -6,11 +6,13 @@ 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) { diff --git a/src/c/signalProcessing/includes/dct.h b/src/c/signalProcessing/includes/dct.h new file mode 100644 index 0000000..80668ff --- /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/idct.h b/src/c/signalProcessing/includes/idct.h new file mode 100644 index 0000000..1e7b85b --- /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/interfaces/int_dct.h b/src/c/signalProcessing/interfaces/int_dct.h new file mode 100644 index 0000000..3481c4d --- /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 d2dctd2(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/string/strchr/strchr.h b/src/c/signalProcessing/interfaces/int_idct.h index 7e30641..f705fe2 100644 --- a/src/c/string/strchr/strchr.h +++ b/src/c/signalProcessing/interfaces/int_idct.h @@ -5,21 +5,24 @@ you should 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 + Author: Ukasha Noor 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 +#ifndef __INT_IDCT_H__ +#define __INT_IDCT_H__ + + + +#define d2idctd2(in,size,out) didcta(in,size[0],size[1],out) -#endif /*__STRCHR_H__*/ +#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/modk/dmodka.c b/src/c/signalProcessing/modk/dmodka.c new file mode 100644 index 0000000..c0630ec --- /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/transforms/dct/cdcta.c b/src/c/signalProcessing/transforms/dct/cdcta.c new file mode 100644 index 0000000..5bc2792 --- /dev/null +++ b/src/c/signalProcessing/transforms/dct/cdcta.c @@ -0,0 +1,177 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "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; + float re,z,q,m; + floatComplex accu = DoubleComplex(0, 0); + floatComplex temp,mm; + 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; + temp=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); + out[x]=cadds(out[x],temp); + } + } + 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]=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); + mm=in[y]*(cos(q*z)); + temp=cadds(temp,mm); + } + z=(float)(((float)i+1.0/2.0)*(float)u); + q=(float)(M_PI/(float)row); + temp*=cos(q*z); + out[x]=cadds(out[x],temp); + } + if(u==0) + { + out[x]*=1./sqrt((float)row); + if(v==0) + out[x]*=1./sqrt((float)col); + else + out[x]*=sqrt(2./col); + } + else + { + out[x]*=sqrt(2./row); + if(v==0) + out[x]*=1./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]=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)); + out[x]=cadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=cadds(out[x],in[y]*q); + } + } + } + } + + } + } + 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); + mm=mm*(cos(q*z)); + if(j==0) + temp=cadds(temp,mm*(1./sqrt((float)col))); + else + temp=cadds(temp,mm*sqrt(2./col)); + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + out[x]=cadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=cadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/dct/ddcta.c b/src/c/signalProcessing/transforms/dct/ddcta.c new file mode 100644 index 0000000..3802c81 --- /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 0000000..9f380e8 --- /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 0000000..0204d68 --- /dev/null +++ b/src/c/signalProcessing/transforms/dct/zdcta.c @@ -0,0 +1,177 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should 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 "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; + double re,z,q,m; + doubleComplex accu = DoubleComplex(0, 0); + doubleComplex temp,mm; + 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; + temp=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); + out[x]=zadds(out[x],temp); + } + } + 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]=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); + mm=in[y]*(cos(q*z)); + temp=zadds(temp,mm); + } + z=(double)(((double)i+1.0/2.0)*(double)u); + q=(double)(M_PI/(double)row); + temp*=cos(q*z); + out[x]=zadds(out[x],temp); + } + if(u==0) + { + out[x]*=1./sqrt((double)row); + if(v==0) + out[x]*=1./sqrt((double)col); + else + out[x]*=sqrt(2./col); + } + else + { + out[x]*=sqrt(2./row); + if(v==0) + out[x]*=1./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]=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)); + out[x]=zadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=zadds(out[x],in[y]*q); + } + } + } + } + + } + } + 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); + mm=mm*(cos(q*z)); + if(j==0) + temp=zadds(temp,mm*(1./sqrt((double)col))); + else + temp=zadds(temp,mm*sqrt(2./col)); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]=zadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=zadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/idct/cidcta.c b/src/c/signalProcessing/transforms/idct/cidcta.c new file mode 100644 index 0000000..ec0df0c --- /dev/null +++ b/src/c/signalProcessing/transforms/idct/cidcta.c @@ -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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "idct.h" +#include "addition.h" +#include "types.h" +#include "floatComplex.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; + float re,z,q,m; + floatComplex accu = DoubleComplex(0, 0); + floatComplex temp,mm; + 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)); + out[x]=cadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=cadds(out[x],in[y]*q); + } + } + } + } + + } + } + 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); + mm=mm*(cos(q*z)); + if(j==0) + temp=cadds(temp,mm*(1./sqrt((float)col))); + else + temp=cadds(temp,mm*sqrt(2./col)); + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + out[x]=cadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=cadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } +} diff --git a/src/c/signalProcessing/transforms/idct/didcta.c b/src/c/signalProcessing/transforms/idct/didcta.c new file mode 100644 index 0000000..5f47516 --- /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 0000000..62f85da --- /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 0000000..2177b18 --- /dev/null +++ b/src/c/signalProcessing/transforms/idct/zidcta.c @@ -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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "idct.h" +#include "addition.h" +#include "types.h" +#include "doubleComplex.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; + double re,z,q,m; + doubleComplex accu = DoubleComplex(0, 0); + doubleComplex temp,mm; + 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)); + out[x]=zadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=zadds(out[x],in[y]*q); + } + } + } + } + + } + } + 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); + mm=mm*(cos(q*z)); + if(j==0) + temp=zadds(temp,mm*(1./sqrt((double)col))); + else + temp=zadds(temp,mm*sqrt(2./col)); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]=zadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=zadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } +} diff --git a/src/c/string/ascii/ascii.h b/src/c/string/ascii/ascii.h deleted file mode 100644 index 2d46b74..0000000 --- a/src/c/string/ascii/ascii.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should 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__ - -#ifdef __cplusplus -extern "C" { -#endif - -void gasciia(char* str,int size, int* out); - -#ifdef __cplusplus -}/* extern "C" */ -#endif - -#endif /*___ASCII_H__*/ diff --git a/src/c/string/disp/zdispa.c b/src/c/string/disp/zdispa.c index 5d085d3..bc71de4 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(" %1.20lf + %1.20lfi " ,zreals(in[i+j*rows]) ,zimags(in[i+j*rows])); printf("\n"); } return 0; diff --git a/src/c/string/strcspn/strcspn.h b/src/c/string/strcspn/strcspn.h deleted file mode 100644 index 6170afa..0000000 --- a/src/c/string/strcspn/strcspn.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should 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__ - -#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/strncpy/strncpy.h b/src/c/string/strncpy/strncpy.h deleted file mode 100644 index 3885550..0000000 --- a/src/c/string/strncpy/strncpy.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should 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 key,char* oup); - -#ifdef __cplusplus -}/* extern "C" */ -#endif - -#endif /*__STRNCPY_H__*/ diff --git a/src/c/string/strspn/gstrspna.c b/src/c/string/strspn/gstrspna.c index 94a5181..af1acbb 100644 --- a/src/c/string/strspn/gstrspna.c +++ b/src/c/string/strspn/gstrspna.c @@ -12,7 +12,7 @@ #include<stdio.h> #include "strspn.h" -int max(int a,int b){ +int maxg(int a,int b){ if(a>b) return a; return b; } @@ -37,28 +37,8 @@ uint8 gstrspna(char *str1,int size1,char *str2,int size2) { ct=ct-1; } - m = max(m,ct); + m = maxg(m,ct); } } return m; } -/* -int main() -{ - int n1,n2; - char inp1[100000],inp2[100000]; - printf("Enter the length of the first string"); - scanf("%d",&n1); - for(int i=0;i<=(n1+1);i++) - { - scanf("%c",&inp1[i]); - } - printf("Enter the length of the second string"); - scanf("%d",&n2 ); - for(int j=0;j<=(n2+1);j++) - { - scanf("%c",&inp2[j]); - } - strcspnfn(inp1,n1+1,inp2,n2+1); -} -*/ diff --git a/src/c/string/strspn/strspn.h b/src/c/string/strspn/strspn.h deleted file mode 100644 index f7c2a3c..0000000 --- a/src/c/string/strspn/strspn.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should 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__ - -#ifdef __cplusplus -extern "C" { -#endif - -uint8 gstrspna(char* str1,int size1,char* str2,int size2); - -#ifdef __cplusplus -}/* extern "C" */ -#endif - -#endif /* __STRSPN_H */ |