From ea958d3c401761dcc24865d9639b2fab31038db8 Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Thu, 6 Jul 2017 15:48:47 +0530 Subject: Revert "LinearAlgebra Function Added" --- .../elementaryFunctions/Trigonometry/sinc/dsinca.c | 46 +++++++++++++++ .../Trigonometry/sinc/int_sinc.h | 18 ++++++ src/c/elementaryFunctions/Trigonometry/sinc/sinc.h | 27 +++++++++ .../elementaryFunctions/Trigonometry/sinc/zsinca.c | 35 +++++++++++ .../discrete_mathematics/gcd/dgcda.c | 32 ++++++++++ .../discrete_mathematics/gcd/u8gcda.c | 62 +++++++++++++++++++ .../discrete_mathematics/gcd/u8gcds.c | 32 ++++++++++ .../discrete_mathematics/lcm/u8lcma.c | 69 ++++++++++++++++++++++ src/c/elementaryFunctions/includes/gcd.h | 26 ++++++++ src/c/elementaryFunctions/includes/int32.h | 62 +++++++++++++++++++ src/c/elementaryFunctions/includes/isreal.h | 30 ++++++++++ src/c/elementaryFunctions/includes/lcm.h | 27 +++++++++ src/c/elementaryFunctions/includes/linspace.h | 3 + src/c/elementaryFunctions/includes/nextpow2.h | 28 +++++++++ src/c/elementaryFunctions/includes/sec.h | 2 +- src/c/elementaryFunctions/includes/sinc.h | 29 +++++++++ src/c/elementaryFunctions/includes/uint32.h | 62 +++++++++++++++++++ src/c/elementaryFunctions/int32/dint32a.c | 18 ++++++ src/c/elementaryFunctions/int32/dint32s.c | 18 ++++++ src/c/elementaryFunctions/int32/i16int32a.c | 17 ++++++ src/c/elementaryFunctions/int32/i16int32s.c | 17 ++++++ src/c/elementaryFunctions/int32/i8int32a.c | 17 ++++++ src/c/elementaryFunctions/int32/i8int32s.c | 17 ++++++ src/c/elementaryFunctions/int32/sint32a.c | 18 ++++++ src/c/elementaryFunctions/int32/sint32s.c | 17 ++++++ src/c/elementaryFunctions/int32/u16int32a.c | 18 ++++++ src/c/elementaryFunctions/int32/u16int32s.c | 17 ++++++ src/c/elementaryFunctions/int32/u32int32a.c | 18 ++++++ src/c/elementaryFunctions/int32/u32int32s.c | 17 ++++++ src/c/elementaryFunctions/int32/u8int32a.c | 18 ++++++ src/c/elementaryFunctions/int32/u8int32s.c | 17 ++++++ src/c/elementaryFunctions/interfaces/int_gcd.h | 25 ++++++++ src/c/elementaryFunctions/interfaces/int_int32.h | 46 +++++++++++++++ src/c/elementaryFunctions/interfaces/int_isreal.h | 22 +++++++ src/c/elementaryFunctions/interfaces/int_lcm.h | 27 +++++++++ .../elementaryFunctions/interfaces/int_linspace.h | 4 ++ .../elementaryFunctions/interfaces/int_nextpow2.h | 26 ++++++++ src/c/elementaryFunctions/interfaces/int_sinc.h | 19 ++++++ src/c/elementaryFunctions/interfaces/int_uint32.h | 44 ++++++++++++++ src/c/elementaryFunctions/isreal/disreals.c | 17 ++++++ src/c/elementaryFunctions/isreal/sisreals.c | 17 ++++++ src/c/elementaryFunctions/linspace/slinspacea.c | 49 +++++++++++++++ src/c/elementaryFunctions/linspace/slinspaces.c | 33 +++++++++++ src/c/elementaryFunctions/nextpow2/dnextpow2a.c | 30 ++++++++++ src/c/elementaryFunctions/uint32/duint32a.c | 18 ++++++ src/c/elementaryFunctions/uint32/duint32s.c | 18 ++++++ src/c/elementaryFunctions/uint32/i16uint32a.c | 18 ++++++ src/c/elementaryFunctions/uint32/i16uint32s.c | 18 ++++++ src/c/elementaryFunctions/uint32/i32uint32a.c | 18 ++++++ src/c/elementaryFunctions/uint32/i32uint32s.c | 18 ++++++ src/c/elementaryFunctions/uint32/i8uint32a.c | 18 ++++++ src/c/elementaryFunctions/uint32/i8uint32s.c | 17 ++++++ src/c/elementaryFunctions/uint32/suint32a.c | 19 ++++++ src/c/elementaryFunctions/uint32/suint32s.c | 18 ++++++ src/c/elementaryFunctions/uint32/u16uint32a.c | 18 ++++++ src/c/elementaryFunctions/uint32/u16uint32s.c | 18 ++++++ src/c/elementaryFunctions/uint32/u8uint32a.c | 18 ++++++ src/c/elementaryFunctions/uint32/u8uint32s.c | 18 ++++++ 58 files changed, 1444 insertions(+), 1 deletion(-) create mode 100644 src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c create mode 100644 src/c/elementaryFunctions/Trigonometry/sinc/int_sinc.h create mode 100644 src/c/elementaryFunctions/Trigonometry/sinc/sinc.h create mode 100644 src/c/elementaryFunctions/Trigonometry/sinc/zsinca.c create mode 100644 src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c create mode 100644 src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c create mode 100644 src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c create mode 100644 src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c create mode 100644 src/c/elementaryFunctions/includes/gcd.h create mode 100644 src/c/elementaryFunctions/includes/int32.h create mode 100644 src/c/elementaryFunctions/includes/isreal.h create mode 100644 src/c/elementaryFunctions/includes/lcm.h create mode 100644 src/c/elementaryFunctions/includes/nextpow2.h create mode 100644 src/c/elementaryFunctions/includes/sinc.h create mode 100644 src/c/elementaryFunctions/includes/uint32.h create mode 100644 src/c/elementaryFunctions/int32/dint32a.c create mode 100644 src/c/elementaryFunctions/int32/dint32s.c create mode 100644 src/c/elementaryFunctions/int32/i16int32a.c create mode 100644 src/c/elementaryFunctions/int32/i16int32s.c create mode 100644 src/c/elementaryFunctions/int32/i8int32a.c create mode 100644 src/c/elementaryFunctions/int32/i8int32s.c create mode 100644 src/c/elementaryFunctions/int32/sint32a.c create mode 100644 src/c/elementaryFunctions/int32/sint32s.c create mode 100644 src/c/elementaryFunctions/int32/u16int32a.c create mode 100644 src/c/elementaryFunctions/int32/u16int32s.c create mode 100644 src/c/elementaryFunctions/int32/u32int32a.c create mode 100644 src/c/elementaryFunctions/int32/u32int32s.c create mode 100644 src/c/elementaryFunctions/int32/u8int32a.c create mode 100644 src/c/elementaryFunctions/int32/u8int32s.c create mode 100644 src/c/elementaryFunctions/interfaces/int_gcd.h create mode 100644 src/c/elementaryFunctions/interfaces/int_int32.h create mode 100644 src/c/elementaryFunctions/interfaces/int_isreal.h create mode 100644 src/c/elementaryFunctions/interfaces/int_lcm.h create mode 100644 src/c/elementaryFunctions/interfaces/int_nextpow2.h create mode 100644 src/c/elementaryFunctions/interfaces/int_sinc.h create mode 100644 src/c/elementaryFunctions/interfaces/int_uint32.h create mode 100644 src/c/elementaryFunctions/isreal/disreals.c create mode 100644 src/c/elementaryFunctions/isreal/sisreals.c create mode 100644 src/c/elementaryFunctions/linspace/slinspacea.c create mode 100644 src/c/elementaryFunctions/linspace/slinspaces.c create mode 100644 src/c/elementaryFunctions/nextpow2/dnextpow2a.c create mode 100644 src/c/elementaryFunctions/uint32/duint32a.c create mode 100644 src/c/elementaryFunctions/uint32/duint32s.c create mode 100644 src/c/elementaryFunctions/uint32/i16uint32a.c create mode 100644 src/c/elementaryFunctions/uint32/i16uint32s.c create mode 100644 src/c/elementaryFunctions/uint32/i32uint32a.c create mode 100644 src/c/elementaryFunctions/uint32/i32uint32s.c create mode 100644 src/c/elementaryFunctions/uint32/i8uint32a.c create mode 100644 src/c/elementaryFunctions/uint32/i8uint32s.c create mode 100644 src/c/elementaryFunctions/uint32/suint32a.c create mode 100644 src/c/elementaryFunctions/uint32/suint32s.c create mode 100644 src/c/elementaryFunctions/uint32/u16uint32a.c create mode 100644 src/c/elementaryFunctions/uint32/u16uint32s.c create mode 100644 src/c/elementaryFunctions/uint32/u8uint32a.c create mode 100644 src/c/elementaryFunctions/uint32/u8uint32s.c (limited to 'src/c/elementaryFunctions') diff --git a/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c b/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c new file mode 100644 index 0000000..0cd24e9 --- /dev/null +++ b/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c @@ -0,0 +1,46 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include +#include +#include "sinc.h" +#define PI 3.14159265358979 +void dsinca(double* sample,int size,double* oup) +{ + int j; + for(j=0;j +#include +#include "sinc.h" +#include "sin.h" +#include "doubleComplex.h" +#include "division.h" +void zsinca(doubleComplex* sample,int size,doubleComplex* oup) +{ + int j; + double r,i; + for(j=0;jb) + { + a=a-b; + } + else + { + b=b-a; + } + } + out[0]=b; +} diff --git a/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c new file mode 100644 index 0000000..121d26a --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c @@ -0,0 +1,62 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include +/* This is the "gcd" function , which takes two input. first + one is the array and the second one is the length of the array. + Now to calculate the gcd of two elements we fin the maximum of + the two elements, and then iterate from maximum value down to 1, + and check whether the particular value divides the two elements. + And in this way we can calculate the gcd of the whole array. +*/ +#include "gcd.h" +uint8 u8gcdua(uint8* in,int size) +{ + + int temp; + if(size==1) + { + temp=*in; + } + else + { + int x=*in; + int y=*(in+1); + int max=(x>y)?x:y; + int i; + for(i=max;i>=1;i--) + { + if(x%i==0 && y%i==0) + { + temp=i; + break; + } + } + int j; + for(j=2;jy)?x:y; + for(i=max;i>=1;i--) + { + if(x%i==0 && y%i==0) + { + temp=i; + break; + } + } + } +} + + return temp; +} + diff --git a/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c b/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c new file mode 100644 index 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/discrete_mathematics/lcm/u8lcma.c b/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c new file mode 100644 index 0000000..b01c804 --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c @@ -0,0 +1,69 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include +/* This is the "lcm" function, accepting two inputs which are the array of integers + and second the size of the array. The algorithm works like this: + We take a temproary variable and store the lcm of the first two elements of the + array in it. Now using this temproary variable we recursively fin the lcm of + the whole array. + Now to fin the lcm of two elements we fin the maximum of the two elements and + check whether it is divisible by both the elements, if the condition is true we + get the lcm, else increase the maximum value by itself unless we get the lcm. +*/ +#include "lcm.h" +uint8 u8lcma(uint8* in,int size) +{ + long long int lcm_temp; + if(size==1) + { + lcm_temp=*in; + } + else + { + + int x1=*in; + int x2=*(in+1); + long long int max=(x1>x2)?x1:x2; + long long int i=max; + while(1) + { + if(i%x1==0 && i%x2==0) + { + lcm_temp=i; + break; + } + else + i+=max; + } + int j; + for(j=2;jx2)?x1:x2; + i=max; + while(1) + { + if(i%x1==0 && i%x2==0) + { + lcm_temp=i; + break; + } + else + i+=max; + } + } + + } + return lcm_temp; +} + diff --git a/src/c/elementaryFunctions/includes/gcd.h b/src/c/elementaryFunctions/includes/gcd.h new file mode 100644 index 0000000..179eea0 --- /dev/null +++ b/src/c/elementaryFunctions/includes/gcd.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __GCD_H__ +#define __GCD_H__ +#include "types.h" + + #ifdef __cplusplus + extern "C"{ + #endif + +uint8 u8gcda(uint8* in,int size); + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /*__GCD_H__*/ diff --git a/src/c/elementaryFunctions/includes/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/lcm.h b/src/c/elementaryFunctions/includes/lcm.h new file mode 100644 index 0000000..3a3e66f --- /dev/null +++ b/src/c/elementaryFunctions/includes/lcm.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __LCM_H__ +#define __LCM_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8lcma(uint8* in,int size); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__LCM_H__*/ + diff --git a/src/c/elementaryFunctions/includes/linspace.h b/src/c/elementaryFunctions/includes/linspace.h 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/elementaryFunctions/includes/nextpow2.h b/src/c/elementaryFunctions/includes/nextpow2.h new file mode 100644 index 0000000..c86bea0 --- /dev/null +++ b/src/c/elementaryFunctions/includes/nextpow2.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __NEXTPOW2_H__ +#define __NEXTPOW2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void dnextpow2a(double *in,int size,double *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif + diff --git a/src/c/elementaryFunctions/includes/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 +//#include #include "types.h" #ifdef __cplusplus diff --git a/src/c/elementaryFunctions/includes/sinc.h b/src/c/elementaryFunctions/includes/sinc.h new file mode 100644 index 0000000..8bc98d2 --- /dev/null +++ b/src/c/elementaryFunctions/includes/sinc.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SINC_H__ +#define __SINC_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsinca(double* sample,int size,double* oup); +void zsinca(doubleComplex* sample,int size,doubleComplex* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINC_H__ */ diff --git a/src/c/elementaryFunctions/includes/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 +#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 + +void dnextpow2a(double *in,int size,double *out) +{ + int i,j,s; + double k; + i=2; + for(s=0;sk); + 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