diff options
author | Sandeep Gupta | 2017-06-18 23:55:40 +0530 |
---|---|---|
committer | Sandeep Gupta | 2017-06-18 23:55:40 +0530 |
commit | 277d1edfa17bf3719d90ddbac8e31f6181e952c3 (patch) | |
tree | 0661f1f52af0a0fd654edd4984c30e57037303c6 /src/c/matrixOperations/includes | |
download | Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.tar.gz Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.tar.bz2 Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.zip |
First commit
Diffstat (limited to 'src/c/matrixOperations/includes')
31 files changed, 2059 insertions, 0 deletions
diff --git a/src/c/matrixOperations/includes/cat.h b/src/c/matrixOperations/includes/cat.h new file mode 100644 index 0000000..dde6b9b --- /dev/null +++ b/src/c/matrixOperations/includes/cat.h @@ -0,0 +1,162 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __CAT_H__ +#define __CAT_H__ +#include "types.h" +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** \brief concat 2 floats scalars +*/ +EXTERN_MATOPS void srowcats(float in1, float in2, float *out); +EXTERN_MATOPS void scolumncats(float in1, float in2, float *out); + +/* +** \brief concat 2 double scalars +*/ +EXTERN_MATOPS void drowcats(double in1, double in2, double *out); +EXTERN_MATOPS void dcolumncats(double in1, double in2, double *out); + +/* +** \brief concat 2 floats complex scalars +*/ +EXTERN_MATOPS void crowcats(floatComplex in1, floatComplex in2, floatComplex *out); +EXTERN_MATOPS void ccolumncats(floatComplex in1, floatComplex in2, floatComplex *out); + +/* +** \brief concat 2 double complex scalars +*/ +EXTERN_MATOPS void zrowcats(doubleComplex in1, doubleComplex in2, doubleComplex *out); +EXTERN_MATOPS void zcolumncats(doubleComplex in1, doubleComplex in2, doubleComplex *out); + +/* +** \brief Concat float arrays +** \param in1 the float array to process +** \param lines1 +** \param columns1 +** \param in2 the float array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ +EXTERN_MATOPS void srowcata(float *in1, int lines1, int columns1, float *in2, int lines2, int columns2, float* out); +EXTERN_MATOPS void scolumncata(float *in1, int lines1, int columns1, float *in2, int lines2, int columns2, float* out); + +/* +** \brief Concat double arrays +** \param in1 the double array to process +** \param lines1 +** \param columns1 +** \param in2 the double array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ +EXTERN_MATOPS void drowcata(double *in1, int lines1, int columns1, double *in2, int lines2, int columns2, double* out); +EXTERN_MATOPS void dcolumncata(double *in1, int lines1, int columns1, double *in2, int lines2, int columns2, double* out); + +/* +** \brief Concat Complex float arrays +** \param in1 the Complex float array to process +** \param lines1 +** \param columns1 +** \param in2 the Complex float array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ +EXTERN_MATOPS void crowcata(floatComplex *in1, int lines1, int columns1, floatComplex *in2, int lines2, int columns2, floatComplex* out); +EXTERN_MATOPS void ccolumncata(floatComplex *in1, int lines1, int columns1, floatComplex *in2, int lines2, int columns2, floatComplex* out); + +/* +** \brief Concat Complex double arrays +** \param in1 the Complex double array to process +** \param lines1 +** \param columns1 +** \param in2 the Complex double array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ +EXTERN_MATOPS void zrowcata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex* out); +EXTERN_MATOPS void zcolumncata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, int lines2, int columns2, doubleComplex* out); + +/* +** \brief Concat uint8 arrays +** \param in1 the uint8 array to process +** \param lines1 +** \param columns1 +** \param in2 the uint8 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void u8rowcata(uint8 *in1, int lines1, int columns1, uint8 *in2, int lines2, int columns2, uint8* out); +EXTERN_MATOPS void u8columncata(uint8 *in1, int lines1, int columns1, uint8 *in2, int lines2, int columns2, uint8* out); + +/* +** \brief Concat uint16 arrays +** \param in1 the uint16 array to process +** \param lines1 +** \param columns1 +** \param in2 the uint16 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void u16rowcata(uint16 *in1, int lines1, int columns1, uint16 *in2, int lines2, int columns2, uint16* out); +EXTERN_MATOPS void u16columncata(uint16 *in1, int lines1, int columns1, uint16 *in2, int lines2, int columns2, uint16* out); + + +/* +** \brief Concat int8 arrays +** \param in1 the int8 array to process +** \param lines1 +** \param columns1 +** \param in2 the int8 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void i8rowcata(int8 *in1, int lines1, int columns1, int8 *in2, int lines2, int columns2, int8* out); +EXTERN_MATOPS void i8columncata(int8 *in1, int lines1, int columns1, int8 *in2, int lines2, int columns2, int8* out); + +/* +** \brief Concat int16 arrays +** \param in1 the int16 array to process +** \param lines1 +** \param columns1 +** \param in2 the int16 array to process to concat +** \param lines2 +** \param columns2 +** \param out the concatenation +*/ + +EXTERN_MATOPS void i16rowcata(int16 *in1, int lines1, int columns1, int16 *in2, int lines2, int columns2, int16* out); +EXTERN_MATOPS void i16columncata(int16 *in1, int lines1, int columns1, int16 *in2, int lines2, int columns2, int16* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__CAT_H__ */ diff --git a/src/c/matrixOperations/includes/chol.h b/src/c/matrixOperations/includes/chol.h new file mode 100644 index 0000000..0a17406 --- /dev/null +++ b/src/c/matrixOperations/includes/chol.h @@ -0,0 +1,43 @@ +/* + * 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 __CHOL_H__ +#define __CHOL_H__ + +#include "dynlib_matrixoperations.h" +#include "doubleComplex.h" +#include "floatComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS double dchols(double in); +EXTERN_MATOPS void dchola(double *in, int size, double *out); + +EXTERN_MATOPS float schols(float in); +EXTERN_MATOPS void schola(float *in, int size, float *out); + +#define zchols(in) DoubleComplex(dchols(zreals(in)),0) + +EXTERN_MATOPS void zchola (doubleComplex *in, int size, doubleComplex *out); + +#define cchols(in) FloatComplex(schols(creals(in)),0) +EXTERN_MATOPS void cchola(floatComplex *in, int size, floatComplex *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHOL_H__ */ + diff --git a/src/c/matrixOperations/includes/cumprod.h b/src/c/matrixOperations/includes/cumprod.h new file mode 100644 index 0000000..f47fd77 --- /dev/null +++ b/src/c/matrixOperations/includes/cumprod.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CUMPROD_H__ +#define __CUMPROD_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcumproda(double *in1, int row, int column, double *out); +void drowcumproda(double *in1, int row, int column, double *out); +void dcolumncumproda(double *in1, int row, int column, double *out); + +void scumproda(float *in1, int row, int column, float *out); +void srowcumproda(float *in1, int row, int column, float *out); +void scolumncumproda(float *in1, int row, int column, float *out); + +void u8cumproda(uint8 *in1, int row, int column, uint8 *out); +void u8rowcumproda(uint8 *in1, int row, int column, uint8 *out); +void u8columncumproda(uint8 *in1, int row, int column, uint8 *out); + +void i8cumproda(int8 *in1, int row, int column, int8 *out); +void i8rowcumproda(int8 *in1, int row, int column, int8 *out); +void i8columncumproda(int8 *in1, int row, int column, int8 *out); + +void u16cumproda(uint16 *in1, int row, int column, uint16 *out); +void u16rowcumproda(uint16 *in1, int row, int column, uint16 *out); +void u16columncumproda(uint16 *in1, int row, int column, uint16 *out); + +void i16cumproda(int16 *in1, int row, int column, int16 *out); +void i16rowcumproda(int16 *in1, int row, int column, int16 *out); +void i16columncumproda(int16 *in1, int row, int column, int16 *out); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CUMPROD_H__*/ diff --git a/src/c/matrixOperations/includes/cumsum.h b/src/c/matrixOperations/includes/cumsum.h new file mode 100644 index 0000000..24d81bd --- /dev/null +++ b/src/c/matrixOperations/includes/cumsum.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CUMSUM_H__ +#define __CUMSUM_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcumsuma(double *in1, int row, int column, double *out); +void drowcumsuma(double *in1, int row, int column, double *out); +void dcolumncumsuma(double *in1, int row, int column, double *out); + +void scumsuma(float *in1, int row, int column, float *out); +void srowcumsuma(float *in1, int row, int column, float *out); +void scolumncumsuma(float *in1, int row, int column, float *out); + +void u8cumsuma(uint8 *in1, int row, int column, uint8 *out); +void u8rowcumsuma(uint8 *in1, int row, int column, uint8 *out); +void u8columncumsuma(uint8 *in1, int row, int column, uint8 *out); + +void i8cumsuma(int8 *in1, int row, int column, int8 *out); +void i8rowcumsuma(int8 *in1, int row, int column, int8 *out); +void i8columncumsuma(int8 *in1, int row, int column, int8 *out); + +void u16cumsuma(uint16 *in1, int row, int column, uint16 *out); +void u16rowcumsuma(uint16 *in1, int row, int column, uint16 *out); +void u16columncumsuma(uint16 *in1, int row, int column, uint16 *out); + +void i16cumsuma(int16 *in1, int row, int column, int16 *out); +void i16rowcumsuma(int16 *in1, int row, int column, int16 *out); +void i16columncumsuma(int16 *in1, int row, int column, int16 *out); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CUMSUM_H__*/ diff --git a/src/c/matrixOperations/includes/determ.h b/src/c/matrixOperations/includes/determ.h new file mode 100644 index 0000000..d915c31 --- /dev/null +++ b/src/c/matrixOperations/includes/determ.h @@ -0,0 +1,39 @@ +/* + * 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 __DETERM_H__ +#define __DETERM_H__ + +#include "dynlib_matrixoperations.h" +#include "doubleComplex.h" +#include "floatComplex.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS double ddeterma (double *in, int rows); + +EXTERN_MATOPS float sdeterma (float *in, int rows); + +EXTERN_MATOPS doubleComplex zdeterma (doubleComplex *in, int rows); + +EXTERN_MATOPS floatComplex cdeterma (floatComplex *in, int rows); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __DETERM_H__ */ + diff --git a/src/c/matrixOperations/includes/diag.h b/src/c/matrixOperations/includes/diag.h new file mode 100644 index 0000000..5f97923 --- /dev/null +++ b/src/c/matrixOperations/includes/diag.h @@ -0,0 +1,97 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __DIAG_H__ +#define __DIAG_H__ + +#include "dynlib_matrixoperations.h" +#include "types.h" +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS double ddiags(double in ); + +EXTERN_MATOPS void ddiaga(double in, int size,int insert_post,double *out); + +EXTERN_MATOPS void ddiagina(double *in, int _row,int _column,int insert_post,double *out); + +EXTERN_MATOPS void ddiagins(double* in, int size, double* out ); + +EXTERN_MATOPS void ddiagexa(double* in,int row,int column,int insert_pos,double* out); + +EXTERN_MATOPS double ddiagexs(double* in,int row,int column,int extract_pos); + +EXTERN_MATOPS uint8 u8diags(uint8 in ); + +EXTERN_MATOPS void u8diaga(uint8 in, int size,int insert_post,uint8 *out); + +EXTERN_MATOPS void u8diagina(uint8 *in, int _row,int _column,int insert_post,uint8 *out); + +EXTERN_MATOPS void u8diagins(uint8* in, int size, uint8* out ); + +EXTERN_MATOPS void u8diagexa(uint8* in,int row,int column,int insert_pos,uint8* out); + +EXTERN_MATOPS uint8 u8diagexs(uint8* in,int row,int column,int extract_pos); + +EXTERN_MATOPS uint16 u16diags(uint16 in ); + +EXTERN_MATOPS void u16diaga(uint16 in, int size,int insert_post,uint16 *out); + +EXTERN_MATOPS void u16diagina(uint16 *in, int _row,int _column,int insert_post,uint16 *out); + +EXTERN_MATOPS void u16diagins(uint16* in, int size, uint16* out ); + +EXTERN_MATOPS void u16diagexa(uint16* in,int row,int column,int insert_pos,uint16* out); + +EXTERN_MATOPS uint16 u16diagexs(uint16* in,int row,int column,int extract_pos); + +EXTERN_MATOPS int8 i8diags(int8 in ); + +EXTERN_MATOPS void i8diaga(int8 in, int size,int insert_post,int8 *out); + +EXTERN_MATOPS void i8diagina(int8 *in, int _row,int _column,int insert_post,int8 *out); + +EXTERN_MATOPS void i8diagins(int8* in, int size, int8* out ); + +EXTERN_MATOPS void i8diagexa(int8* in,int row,int column,int insert_pos,int8* out); + +EXTERN_MATOPS int8 i8diagexs(int8* in,int row,int column,int extract_pos); + +EXTERN_MATOPS int16 i16diags(int16 in ); + +EXTERN_MATOPS void i16diaga(int16 in, int size,int insert_post,int16 *out); + +EXTERN_MATOPS void i16diagina(int16 *in, int _row,int _column,int insert_post,int16 *out); + +EXTERN_MATOPS void i16diagins(int16* in, int size, int16* out ); + +EXTERN_MATOPS void i16diagexa(int16* in,int row,int column,int insert_pos,int16* out); + +EXTERN_MATOPS int16 i16diagexs(int16* in,int row,int column,int extract_pos); + + + + + + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__DIAG_H__ */ + diff --git a/src/c/matrixOperations/includes/dist.h b/src/c/matrixOperations/includes/dist.h new file mode 100644 index 0000000..bf45a8d --- /dev/null +++ b/src/c/matrixOperations/includes/dist.h @@ -0,0 +1,48 @@ +/* + * 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 __DIST_H__ +#define __DIST_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + /* Computes the euclidian distance + between 2 scalars/arrays. + We assume both arrays have the same + numbers of lines and columns.*/ + +EXTERN_MATOPS float sdists( float in1, float in2); +EXTERN_MATOPS float sdista( float* in1, float* in2, int lines, int columns); + +EXTERN_MATOPS double ddists( double in1, double in2); +EXTERN_MATOPS double ddista( double* in1, double* in2, int lines, int columns); + +EXTERN_MATOPS float cdists( floatComplex in1, floatComplex in2); +EXTERN_MATOPS float cdista( floatComplex* in1, floatComplex* in2, int lines, int columns); + +EXTERN_MATOPS double zdists( doubleComplex in1, doubleComplex in2); +EXTERN_MATOPS double zdista( doubleComplex* in1, doubleComplex* in2, int lines, int columns); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__DIST_H__*/ + diff --git a/src/c/matrixOperations/includes/dynlib_matrixoperations.h b/src/c/matrixOperations/includes/dynlib_matrixoperations.h new file mode 100644 index 0000000..a0597a5 --- /dev/null +++ b/src/c/matrixOperations/includes/dynlib_matrixoperations.h @@ -0,0 +1,26 @@ +/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2009 - DIGITEO - Allan CORNET
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you 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 __DYNLIB_MATRIXOPERATIONS_H__
+#define __DYNLIB_MATRIXOPERATIONS_H__
+
+#if defined(_MSC_VER) && defined(_USRDLL)
+ #if MATRIXOPERATIONS_EXPORTS
+ #define EXTERN_MATOPS __declspec (dllexport)
+ #else
+ #define EXTERN_MATOPS __declspec (dllimport)
+ #endif
+#else
+ #define EXTERN_MATOPS
+#endif
+
+#endif /* __DYNLIB_MATRIXOPERATIONS_H__ */
diff --git a/src/c/matrixOperations/includes/eye.h b/src/c/matrixOperations/includes/eye.h new file mode 100644 index 0000000..95bdd79 --- /dev/null +++ b/src/c/matrixOperations/includes/eye.h @@ -0,0 +1,110 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __EYE_H__ +#define __EYE_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "ones.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** \brief create a float Eye value +*/ +#define seyes(in) 1.0f + +/* +** \brief create a Double Eye value +*/ +#define deyes(in) 1.0 + +/* +** \brief create a float complex Eye value +*/ +#define ceyes(in) FloatComplex(1.0f, 0) + +/* +** \brief create a Double complex Eye value +*/ +#define zeyes(in) DoubleComplex(1, 0) + +/* +** \brief create a Uint8 Eye value +*/ +#define u8eyes(in) (uint8)1 + +/* +** \brief create a int8 Eye value +*/ +#define i8eyes(in) (int8)1 + +/* +** \brief create a Uint16 Eye value +*/ +#define u16eyes(in) (uint16)1 + +/* +** \brief create a int16 Eye value +*/ +#define i16eyes(in) (int16)1 + +/* +** \brief create a float Eye matrix +*/ +EXTERN_MATOPS void seyea(float* in, int _iRows, int _iCols); + +/* +** \brief create a Double Eye matrix +*/ +EXTERN_MATOPS void deyea(double* in, int _iRows, int _iCols); + +/* +** \brief create a float complex Eye matrix +*/ +EXTERN_MATOPS void ceyea(floatComplex* in, int _iRows, int _iCols); + +/* +** \brief create a Double complex Eye matrix +*/ +EXTERN_MATOPS void zeyea(doubleComplex* in, int _iRows, int _iCols); + +/* +** \brief create a uint8 Eye matrix +*/ +EXTERN_MATOPS void u8eyea(uint8* in, int _iRows, int _iCols); + +/* +** \brief create a int8 Eye matrix +*/ +EXTERN_MATOPS void i8eyea(int8* in, int _iRows, int _iCols); + +/* +** \brief create a uint16 Eye matrix +*/ +EXTERN_MATOPS void u16eyea(uint16* in, int _iRows, int _iCols); + +/* +** \brief create a int16 Eye matrix +*/ +EXTERN_MATOPS void i16eyea(int16* in, int _iRows, int _iCols); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__EYE_H__ */ + diff --git a/src/c/matrixOperations/includes/fill.h b/src/c/matrixOperations/includes/fill.h new file mode 100644 index 0000000..09b8d81 --- /dev/null +++ b/src/c/matrixOperations/includes/fill.h @@ -0,0 +1,40 @@ +/* + * 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 __FILL_H__ +#define __FILL_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif +/*filling of a array with constant*/ + +EXTERN_MATOPS void dfilla (double* in, int rows, int cols, double constant); + +EXTERN_MATOPS void sfilla (float* in, int rows, int cols, float constant); + +EXTERN_MATOPS void cfilla (floatComplex* in, int rows, int cols, floatComplex constant); + +EXTERN_MATOPS void zfilla (doubleComplex* in, int rows, int cols, doubleComplex constant); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FILL_H__ */ + + diff --git a/src/c/matrixOperations/includes/flipdim.h b/src/c/matrixOperations/includes/flipdim.h new file mode 100644 index 0000000..bdf4a68 --- /dev/null +++ b/src/c/matrixOperations/includes/flipdim.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __FLIPDIM_H__ +#define __FLIPDIM_H__ + +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void dflipdima (double *in, int row, int col, int dim, int blk_size, double *out); + +void sflipdima (float *in, int row, int col, int dim, int blk_size, float *out); + +void u8flipdima (uint8 *in, int row, int col, int dim, int blk_size, uint8 *out); + +void i8flipdima (int8 *in, int row, int col, int dim, int blk_size, int8 *out); + +void u16flipdima (uint16 *in, int row, int col, int dim, int blk_size, uint16 *out); + +void i16flipdima (int16 *in, int row, int col, int dim, int blk_size, int16 *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__FLIPDIM_H__*/ diff --git a/src/c/matrixOperations/includes/hilb.h b/src/c/matrixOperations/includes/hilb.h new file mode 100644 index 0000000..65efd0e --- /dev/null +++ b/src/c/matrixOperations/includes/hilb.h @@ -0,0 +1,46 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __HILB_H__ +#define __HILB_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include <math.h> + +#ifdef __cplusplus +extern "C" { +#endif +/* +** generate an Hilbert's matrix +** param out : the hilbert's matrix in float precision +** param size: matrix's size +*/ + +EXTERN_MATOPS void shilba ( float* out, int size) ; + +/* +** generate an Hilbert's matrix +** param out : the hilbert's matrix in double precision +** param size: matrix's size +*/ + + +EXTERN_MATOPS void dhilba ( double* out, int size ) ; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__HILB_H__ */ + diff --git a/src/c/matrixOperations/includes/infiniteNorm.h b/src/c/matrixOperations/includes/infiniteNorm.h new file mode 100644 index 0000000..130cfea --- /dev/null +++ b/src/c/matrixOperations/includes/infiniteNorm.h @@ -0,0 +1,67 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __INFINITENORM_H__ +#define __INFINITENORM_H__ + +#include "dynlib_matrixoperations.h" +#include "sign.h" +#include "pythag.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** \brief Compute the infinite norm of a given floats matrix. +** \param in : input matrix. +** \param _iRows : number of rows of the matrix . +** \param _iCols : number of columns of the matrix . +*/ + +EXTERN_MATOPS float sinfnorma(float* in, int _iRows, int _iCols); + +/* +** \brief Compute the infinite norm of a given doubles matrix. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS double dinfnorma(double* in, int _iRows, int _iCols); + +/* +** \brief Compute the infinite norm of a given complex floats matrix. +** \param in : input matrix. +** \param _iRows : number of rows of the matrix . +** \param _iCols : number of columns of the matrix . +*/ + +EXTERN_MATOPS float cinfnorma(floatComplex* in, int _iRows, int _iCols); + +/* +** \brief Compute the infinite norm of a given complex doubles matrix. +** \param in : input matrix. +** \param _iRows : number of rows of the matrix . +** \param _iCols : number of columns of the matrix . +*/ + +EXTERN_MATOPS double zinfnorma(doubleComplex* in, int _iRows, int _iCols); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__INFINITENORM_H__ */ + diff --git a/src/c/matrixOperations/includes/jmat.h b/src/c/matrixOperations/includes/jmat.h new file mode 100644 index 0000000..38a8b1e --- /dev/null +++ b/src/c/matrixOperations/includes/jmat.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-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 __JMAT_H__ +#define __JMAT_H__ + +#include "dynlib_matrixoperations.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS void sjmata(float in1, float in2, float* out); +EXTERN_MATOPS void djmata(double in1, double in2, double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__JMAT_H__ */ diff --git a/src/c/matrixOperations/includes/kron.h b/src/c/matrixOperations/includes/kron.h new file mode 100644 index 0000000..e4cff2d --- /dev/null +++ b/src/c/matrixOperations/includes/kron.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __KRON_H__ +#define __KRON_H__ + +#include "kron.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dkrona (double *in1, int row1, int col1, double *in2, int row2, \ + int col2, double *out); +void skrona (float *in1, int row1, int col1, float *in2, int row2, \ + int col2, float *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__KRON_H__*/ diff --git a/src/c/matrixOperations/includes/logm.h b/src/c/matrixOperations/includes/logm.h new file mode 100644 index 0000000..7eec569 --- /dev/null +++ b/src/c/matrixOperations/includes/logm.h @@ -0,0 +1,37 @@ +/* + * 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 __LOGM_H__ +#define __LOGM_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS void slogma (float* in, int size, float* out); + +EXTERN_MATOPS void dlogma (double* in, int size, double* out); + +EXTERN_MATOPS void clogma (floatComplex* in, int size, floatComplex* out); + +EXTERN_MATOPS void zlogma (doubleComplex* in, int size, doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __LOGM_H__ */ diff --git a/src/c/matrixOperations/includes/matrixDivision.h b/src/c/matrixOperations/includes/matrixDivision.h new file mode 100644 index 0000000..7702313 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixDivision.h @@ -0,0 +1,102 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __MATRIXDIVISION_H__ +#define __MATRIXDIVISION_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "lapack.h" +#include "cat.h" +#include "matrixTranspose.h" +#include "conj.h" +#include "min.h" +#include "max.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS void srdivma ( float* in1, int lines1, int columns1 , + float* in2, int lines2, int columns2 , + float* out ); + +EXTERN_MATOPS void sldivma ( float* in1, int lines1, int columns1 , + float* in2, int lines2, int columns2 , + float* out ); + + +EXTERN_MATOPS void drdivma ( double* in1, int lines1, int columns1 , + double* in2, int lines2, int columns2 , + double* out ); + + +EXTERN_MATOPS void dldivma ( double* in1, int lines1, int columns1 , + double* in2, int lines2, int columns2 , + double* out ); + +EXTERN_MATOPS void zrdivma( doubleComplex* in1, int lines1, int columns1 , + doubleComplex* in2, int lines2, int columns2 , + doubleComplex* out ); + +EXTERN_MATOPS void zldivma( doubleComplex* in1, int lines1, int columns1 , + doubleComplex* in2, int lines2, int columns2 , + doubleComplex* out ); + +EXTERN_MATOPS void crdivma( floatComplex* in1, int lines1, int columns1 , + floatComplex* in2, int lines2, int columns2 , + floatComplex* out ); + +EXTERN_MATOPS void cldivma( floatComplex* in1, int lines1, int columns1 , + floatComplex* in2, int lines2, int columns2 , + floatComplex* out ); + +/*special case row vector /row vector => scalar */ +/* +** \brief Compute a division for double. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the right division of the two vectors = in1 .* in2. +*/ +EXTERN_MATOPS double drdivv(double *in1, double *in2, int size2); + +EXTERN_MATOPS doubleComplex zrdivv(doubleComplex *in1, doubleComplex *in2, int size2); + +EXTERN_MATOPS doubleComplex zrdivzdv(doubleComplex *in1, double *in2, int size2); + +EXTERN_MATOPS doubleComplex zrdivdzv(double *in1, doubleComplex *in2, int size2); + +/* +** \brief Compute a division for float. +** \param in1 : input array. +** \param in2 : input array. +** \param size : size of in2 array. +** \return : scalar that contains the division of the two vectors = in1 .* in2. +*/ +EXTERN_MATOPS float srdivv(float *in1, float *in2, int size2); + +EXTERN_MATOPS floatComplex crdivv(floatComplex *in1, floatComplex *in2, int size2); + +EXTERN_MATOPS floatComplex crdivcsv(floatComplex *in1, float *in2, int size2); + +EXTERN_MATOPS floatComplex crdivscv(float *in1, floatComplex *in2, int size2); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__MATRIXDIVISION_H__ */ diff --git a/src/c/matrixOperations/includes/matrixExponential.h b/src/c/matrixOperations/includes/matrixExponential.h new file mode 100644 index 0000000..4b3cd8a --- /dev/null +++ b/src/c/matrixOperations/includes/matrixExponential.h @@ -0,0 +1,51 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __MATRIXEXPONENTIAL_H__ +#define __MATRIXEXPONENTIAL_H__ + +#include <math.h> +#include <stdlib.h> +#include "dynlib_matrixoperations.h" +#include "lapack.h" +#include "blas.h" +#include "abs.h" +#include "exp.h" +#include "max.h" +#include "pow.h" +#include "matrixDivision.h" +#include "matrixMultiplication.h" +#include "addition.h" +#include "subtraction.h" +#include "eye.h" +#include "infiniteNorm.h" +#include "frexp.h" +#include "division.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS void sexpma (float* in, float* out, int _iLeadDim); + +EXTERN_MATOPS void dexpma (double* in, double* out, int _iLeadDim); + +EXTERN_MATOPS void cexpma(floatComplex * in, floatComplex * out, int _iLeadDim); + +EXTERN_MATOPS void zexpma (doubleComplex * in, doubleComplex * out, int _iLeadDim); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__MATRIXEXPONENTIAL_H__ */ + diff --git a/src/c/matrixOperations/includes/matrixInversion.h b/src/c/matrixOperations/includes/matrixInversion.h new file mode 100644 index 0000000..e547bb9 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixInversion.h @@ -0,0 +1,104 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __MATRIXINVERSION_H__ +#define __MATRIXINVERSION_H__ + +#include "abs.h" +#include "dynlib_matrixoperations.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* +** \brief Compute the matrix inverse for floats. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void sinverma ( float* in, float* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for doubles. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + + +EXTERN_MATOPS void dinverma ( double* in, double* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for complex floats . +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + + +EXTERN_MATOPS void cinverma ( floatComplex* in, floatComplex* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for complex doubles. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + + +EXTERN_MATOPS void zinverma ( doubleComplex* in, doubleComplex* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for uint8. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void u8inverma ( uint8* in, float* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for int8. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void i8inverma ( int8* in, float* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for uint16. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void u16inverma ( uint16* in, float* out, int leadDimIn ); + +/* +** \brief Compute the matrix inverse for int16. +** \param in : input matrix. +** \param leadDimIn : the leading dimension of the matrix . +** \param out : the matrix inverse of the input . +*/ + +EXTERN_MATOPS void i16inverma ( int16* in, float* out, int leadDimIn ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__MATRIXINVERSION_H__ */ diff --git a/src/c/matrixOperations/includes/matrixMagnitude.h b/src/c/matrixOperations/includes/matrixMagnitude.h new file mode 100644 index 0000000..a9f4e71 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixMagnitude.h @@ -0,0 +1,54 @@ + +/* + * 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 __MAGNITUDE_H__ +#define __MAGNITUDE_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS float smagns(float in); +EXTERN_MATOPS float smagna(float* in, int rows, int cols); + +EXTERN_MATOPS double dmagns(double in); +EXTERN_MATOPS double dmagna(double* in, int rows, int cols); + +EXTERN_MATOPS float cmagns(floatComplex in); +EXTERN_MATOPS float cmagna(floatComplex* in, int rows, int cols); + +EXTERN_MATOPS double zmagns(doubleComplex in); +EXTERN_MATOPS double zmagna(doubleComplex* in, int rows, int cols); + +EXTERN_MATOPS uint8 u8magns(uint8 in); +EXTERN_MATOPS uint8 u8magna(uint8* in, int rows, int cols); + +EXTERN_MATOPS uint16 u16magns(uint16 in); +EXTERN_MATOPS uint16 u16magna(uint16* in, int rows, int cols); + +EXTERN_MATOPS int8 i8magns(int8 in); +EXTERN_MATOPS int8 i8magna(int8* in, int rows, int cols); + +EXTERN_MATOPS int16 i16magns(int16 in); +EXTERN_MATOPS int16 i16magna(int16* in, int rows, int cols); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MAGNITUDE_H__*/ diff --git a/src/c/matrixOperations/includes/matrixMultiplication.h b/src/c/matrixOperations/includes/matrixMultiplication.h new file mode 100644 index 0000000..c2235c8 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixMultiplication.h @@ -0,0 +1,150 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __MATRIXMULTIPLICATION_H__ +#define __MATRIXMULTIPLICATION_H__ + +#include "dynlib_matrixoperations.h" +#include "multiplication.h" +#include "addition.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** +** WARNING WE ASSUME MATRIXES TO BE CONSCISTENT +** columns1 = lines2; +** +*/ + +/* +** \brief Compute a multiplication for floats matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void smulma(float *in1, int lines1, int columns1, + float *in2, int lines2, int columns2, + float *out); + +/* +** \brief Compute a multiplication for doubles matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void dmulma(double *in1, int lines1, int columns1, + double *in2, int lines2, int columns2, + double *out); + +/* +** \brief Compute a multiplication for floats complex matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void cmulma(floatComplex *in1, int lines1, int columns1, + floatComplex *in2, int lines2, int columns2, + floatComplex *out); + +/* +** \brief Compute a multiplication for doubles matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void zmulma(doubleComplex *in1, int lines1, int columns1, + doubleComplex *in2, int lines2, int columns2, + doubleComplex *out); + +/* +** \brief Compute a multiplication for uint8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void u8mulma(uint8 *in1, int lines1, int columns1, + uint8 *in2, int lines2, int columns2, + uint8 *out); + +/* +** \brief Compute a multiplication for uint16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void u16mulma(uint16 *in1, int lines1, int columns1, + uint16 *in2, int lines2, int columns2, + uint16 *out); + +/* +** \brief Compute a multiplication for int8 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void i8mulma(int8 *in1, int lines1, int columns1, + int8 *in2, int lines2, int columns2, + int8 *out); + +/* +** \brief Compute a multiplication for int16 matrixes. +** \param in1 : input matrix. +** \param lines1 : lines of in1 matrix. +** \param columns1 : columns of in1 matrix. +** \param in2 : input arry. +** \param lines2 : lines of in2 matrix. +** \param columns2 : columns of in2 matrix. +** \param out : Matrix that contains the multiplication in1 * in2. +*/ +EXTERN_MATOPS void i16mulma(int16 *in1, int lines1, int columns1, + int16 *in2, int lines2, int columns2, + int16 *out); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__MATRIXMULTIPLICATION_H__ */ diff --git a/src/c/matrixOperations/includes/matrixPow.h b/src/c/matrixOperations/includes/matrixPow.h new file mode 100644 index 0000000..d7ffab3 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixPow.h @@ -0,0 +1,43 @@ + +/* + * 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 __MATRIXPOW_H__ +#define __MATRIXPOW_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + powm is only working on square matrix + so the size is limited to rows +*/ +EXTERN_MATOPS void spowma(float* in, int rows, float expand, float* out); + +EXTERN_MATOPS void dpowma(double* in, int rows, double expand, double* out); + +EXTERN_MATOPS void cpowma(floatComplex* in, int rows, floatComplex expand, floatComplex* out); + +EXTERN_MATOPS void zpowma(doubleComplex* in, int rows, doubleComplex expand, doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + + +#endif/*__MATRIXPOW_H__*/ diff --git a/src/c/matrixOperations/includes/matrixSquaredMagnitude.h b/src/c/matrixOperations/includes/matrixSquaredMagnitude.h new file mode 100644 index 0000000..9ee64c3 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixSquaredMagnitude.h @@ -0,0 +1,41 @@ + +/* + * 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 __SQUAREDMAGNITUDE_H__ +#define __SQUAREDMAGNITUDE_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS float ssquMagns(float in); +EXTERN_MATOPS float ssquMagna(float* in, int rows, int cols); + +EXTERN_MATOPS double dsquMagns(double in); +EXTERN_MATOPS double dsquMagna(double* in, int rows, int cols); + +EXTERN_MATOPS float csquMagns(floatComplex in); +EXTERN_MATOPS float csquMagna(floatComplex* in, int rows, int cols); + +EXTERN_MATOPS double zsquMagns(doubleComplex in); +EXTERN_MATOPS double zsquMagna(doubleComplex* in, int rows, int cols); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SQUAREDMAGNITUDE_H__*/ diff --git a/src/c/matrixOperations/includes/matrixTrace.h b/src/c/matrixOperations/includes/matrixTrace.h new file mode 100644 index 0000000..80f895d --- /dev/null +++ b/src/c/matrixOperations/includes/matrixTrace.h @@ -0,0 +1,109 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __MATRICXTRACE_H__ +#define __MATRICXTRACE_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** +** WARNING WE ASSUME MATRIXES TO BE SQUARE +** +*/ + + +/* +** \brief Compute the trace of a float scalar matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : float scalar containing the trace. +*/ + +EXTERN_MATOPS float stracea ( float* in ,int lines ) ; + + +/* +** \brief Compute the trace of a double scalar matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : double scalar containing the trace. +*/ +EXTERN_MATOPS double dtracea ( double* in ,int lines ) ; + +/* +** \brief Compute the trace of a float complex matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : float complex containing the trace. +*/ +EXTERN_MATOPS floatComplex ctracea ( floatComplex* in ,int lines ) ; + + +/* +** \brief Compute the trace of a double complex matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : double complex containing the trace. +*/ +EXTERN_MATOPS doubleComplex ztracea ( doubleComplex* in ,int lines ) ; + + +/* +** \brief Compute the trace of a uint8 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : uint8 containing the trace. +*/ +EXTERN_MATOPS uint8 u8tracea ( uint8* in ,int lines ) ; + + +/* +** \brief Compute the trace of a uint16 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : uint16 containing the trace. +*/ +EXTERN_MATOPS uint16 u16tracea ( uint16* in ,int lines ) ; + + +/* +** \brief Compute the trace of a int8 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : int8 containing the trace. +*/ +EXTERN_MATOPS int8 i8tracea ( int8* in ,int lines ) ; + + +/* +** \brief Compute the trace of a int16 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : int16 containing the trace. +*/ +EXTERN_MATOPS int16 i16tracea ( int16* in ,int lines ) ; + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__MATRICXTRACE_H__ */ diff --git a/src/c/matrixOperations/includes/matrixTranspose.h b/src/c/matrixOperations/includes/matrixTranspose.h new file mode 100644 index 0000000..7e2acbf --- /dev/null +++ b/src/c/matrixOperations/includes/matrixTranspose.h @@ -0,0 +1,101 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __MATRIXTRANSPOSE_H__ +#define __MATRIXTRANSPOSE_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" +#include <math.h> + +#ifdef __cplusplus +extern "C" { +#endif +/* +** \brief Compute the transpose of a float matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed float matrix. +*/ +EXTERN_MATOPS void stransposea ( float* in , int lines1 , int column1, float* out ); +/* +** \brief Compute the transpose of a double matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed double matrix. +*/ +EXTERN_MATOPS void dtransposea ( double* in , int lines1 , int column1, double* out ); +/* +** \brief Compute the transpose of a float complex matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed float complex matrix. +*/ +EXTERN_MATOPS void ctransposea ( floatComplex* in , int lines1 , int column1, floatComplex* out ); +/* +** \brief Compute the transpose of a double complex matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed double complex matrix. +*/ +EXTERN_MATOPS void ztransposea ( doubleComplex* in , int lines1 , int column1, doubleComplex* out ); + + +/* +** \brief Compute the transpose of a uint8 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed uint8 matrix. +*/ +EXTERN_MATOPS void u8transposea ( uint8* in , int lines1 , int column1, uint8* out ); + +/* +** \brief Compute the transpose of a uint16 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed uint16 matrix. +*/ +EXTERN_MATOPS void u16transposea ( uint16* in , int lines1 , int column1, uint16* out ); + +/* +** \brief Compute the transpose of a int8 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed int8 matrix. +*/ +EXTERN_MATOPS void i8transposea ( int8* in , int lines1 , int column1, int8* out ); + +/* +** \brief Compute the transpose of a int16 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed int16 matrix. +*/ +EXTERN_MATOPS void i16transposea ( int16* in , int lines1 , int column1, int16* out ); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__MATRIXTRANSPOSE_H__ */ diff --git a/src/c/matrixOperations/includes/norm.h b/src/c/matrixOperations/includes/norm.h new file mode 100644 index 0000000..dc9d351 --- /dev/null +++ b/src/c/matrixOperations/includes/norm.h @@ -0,0 +1,32 @@ + /* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __NORM_H__ +#define __NORM_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +double dnormv (double *in, int size, int norm); + +double dnorma (double *in, int row, int col, int norm); + +float snormv (float *in, int size, int norm); + +float snorma (float *in, int row, int col, int norm); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__NORM_H__*/ diff --git a/src/c/matrixOperations/includes/ones.h b/src/c/matrixOperations/includes/ones.h new file mode 100644 index 0000000..6734017 --- /dev/null +++ b/src/c/matrixOperations/includes/ones.h @@ -0,0 +1,112 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __ONES_H__ +#define __ONES_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** \brief create a float one value +*/ +#define soness(in) 1.0f + +/* +** \brief create a Double one value +*/ +#define doness(in) 1.0 + +/* +** \brief create a float complex one value +*/ +#define coness(in) FloatComplex(1.0f, 0) + +/* +** \brief create a Double complex one value +*/ +#define zoness(in) DoubleComplex(1, 0) + +/* +** \brief create a uint8 one value +*/ +#define u8oness(in) (uint8)1 + +/* +** \brief create a int8 one value +*/ +#define i8oness(in) (int8)1 + +/* +** \brief create a uint16 one value +*/ +#define u16oness(in) (uint16)1 + +/* +** \brief create a int16 one value +*/ +#define i16oness(in) (int16)1 + + +/* +** \brief create a float matrix full of one +*/ +EXTERN_MATOPS void sonesa ( float* in , int rows , int cols ); + +/* +** \brief create a float complex matrix full of one +*/ +EXTERN_MATOPS void conesa ( floatComplex* in , int rows ,int cols ); + +/* +** \brief create a double matrix full of one +*/ +EXTERN_MATOPS void donesa ( double* in , int rows ,int cols ); + +/* +** \brief create a double complex matrix full of one +*/ +EXTERN_MATOPS void zonesa ( doubleComplex* in , int rows ,int cols ); + +/* +** \brief create a uint8 matrix full of one +*/ +EXTERN_MATOPS void u8onesa ( uint8* in , int rows , int cols ); + +/* +** \brief create a int8 matrix full of one +*/ +EXTERN_MATOPS void i8onesa ( int8* in , int rows , int cols ); + +/* +** \brief create a uint16 matrix full of one +*/ +EXTERN_MATOPS void u16onesa ( uint16* in , int rows , int cols ); + +/* +** \brief create a int16 matrix full of one +*/ +EXTERN_MATOPS void i16onesa ( int16* in , int rows , int cols ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ONES_H__ */ diff --git a/src/c/matrixOperations/includes/spec.h b/src/c/matrixOperations/includes/spec.h new file mode 100644 index 0000000..b7b7d35 --- /dev/null +++ b/src/c/matrixOperations/includes/spec.h @@ -0,0 +1,56 @@ +/* + * 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); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SPEC_H__ */ diff --git a/src/c/matrixOperations/includes/tril.h b/src/c/matrixOperations/includes/tril.h new file mode 100644 index 0000000..486e81f --- /dev/null +++ b/src/c/matrixOperations/includes/tril.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __TRIL_H__ +#define __TRIL_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dtrila (double *in, int row, int column, double diag, double *out); +void strila (float *in, int row, int column, double diag, float *out); +void u8trila (uint8 *in, int row, int column, double diag, uint8 *out); +void u16trila (uint16 *in, int row, int column, double diag, uint16 *out); +void i8trila (int8 *in, int row, int column, double diag, int8 *out); +void i16trila (int16 *in, int row, int column, double diag, int16 *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__TRIL_H__*/ diff --git a/src/c/matrixOperations/includes/triu.h b/src/c/matrixOperations/includes/triu.h new file mode 100644 index 0000000..2b62e22 --- /dev/null +++ b/src/c/matrixOperations/includes/triu.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __TRIU_H__ +#define __TRIU_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dtriua (double *in, int row, int column, double diag, double *out); +void striua (float *in, int row, int column, double diag, float *out); +void u8triua (uint8 *in, int row, int column, double diag, uint8 *out); +void u16triua (uint16 *in, int row, int column, double diag, uint16 *out); +void i8triua (int8 *in, int row, int column, double diag, int8 *out); +void i16triua (int16 *in, int row, int column, double diag, int16 *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__TRIU_H__*/ diff --git a/src/c/matrixOperations/includes/zeros.h b/src/c/matrixOperations/includes/zeros.h new file mode 100644 index 0000000..993940f --- /dev/null +++ b/src/c/matrixOperations/includes/zeros.h @@ -0,0 +1,114 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you 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 __ZEROS_H__ +#define __ZEROS_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** \brief create a float one value +*/ +#define szeross(in) 0.0f + +/* +** \brief create a Double one value +*/ +#define dzeross(in) 0 + +/* +** \brief create a float complex one value +*/ +#define czeross(in) FloatComplex(0.0f, 0) + +/* +** \brief create a Double complex one value +*/ +#define zzeross(in) DoubleComplex(0, 0) + + +/* +** \brief create a single uint8 zero +*/ +#define u8zerosu8(in) (uint8)0 + +/* +** \brief create a single int8 zero +*/ +#define i8zerosi8(in) (int8)0 + +/* +** \brief create a single uint8 zero +*/ +#define u16zerosu16(in) (uint16)0 + +/* +** \brief create a single int8 zero +*/ +#define i16zerosi16(in) (int16)0 + +/* +** \brief create a float matrix full of one +*/ +EXTERN_MATOPS void szerosa ( float* in , int rows , int cols ); +/* +** \brief create a float complex matrix full of one +*/ +EXTERN_MATOPS void czerosa ( floatComplex* in , int rows ,int cols ); +/* +** \brief create a double matrix full of one +*/ +EXTERN_MATOPS void dzerosa ( double* in , int rows ,int cols ); +/* +** \brief create a double complex matrix full of one +*/ +EXTERN_MATOPS void zzerosa ( doubleComplex* in , int rows ,int cols ); + +/* +** \brief create a double complex matrix full of one +*/ +EXTERN_MATOPS void dzerosh ( double* in , int rows ,int cols , int levels); + +/* +** \brief create a uint8 matrix full of zero +*/ +EXTERN_MATOPS void u8zerosa ( uint8* in , int rows , int cols ); + +/* +** \brief create a int8 matrix full of zero +*/ +EXTERN_MATOPS void i8zerosa ( int8* in , int rows , int cols ); + +/* +** \brief create a uint16 matrix full of zero +*/ +EXTERN_MATOPS void u16zerosa ( uint16* in , int rows , int cols ); + +/* +** \brief create a int16 matrix full of zero +*/ +EXTERN_MATOPS void i16zerosa ( int16* in , int rows , int cols ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ZEROS_H__ */ |