diff options
author | jofret | 2010-06-21 06:24:38 +0000 |
---|---|---|
committer | jofret | 2010-06-21 06:24:38 +0000 |
commit | 8b44229ef44f0558ce045e46ff833fb44df913c9 (patch) | |
tree | 4fdd89b2258c18c905d2f17ef4bea8ea9cf32893 /src/c/matrixOperations/includes | |
parent | af0366230e14cc75d9e9a183375ee9cb69fb46b6 (diff) | |
download | scilab2c-8b44229ef44f0558ce045e46ff833fb44df913c9.tar.gz scilab2c-8b44229ef44f0558ce045e46ff833fb44df913c9.tar.bz2 scilab2c-8b44229ef44f0558ce045e46ff833fb44df913c9.zip |
Tagging the 2.0 release of scilab2crelease-2.0
Diffstat (limited to 'src/c/matrixOperations/includes')
23 files changed, 1308 insertions, 0 deletions
diff --git a/src/c/matrixOperations/includes/cat.h b/src/c/matrixOperations/includes/cat.h new file mode 100644 index 00000000..9f64a157 --- /dev/null +++ b/src/c/matrixOperations/includes/cat.h @@ -0,0 +1,105 @@ +/* + * 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 "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); + +#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 00000000..0a17406d --- /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/determ.h b/src/c/matrixOperations/includes/determ.h new file mode 100644 index 00000000..d915c31b --- /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/dist.h b/src/c/matrixOperations/includes/dist.h new file mode 100644 index 00000000..bf45a8d7 --- /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 00000000..a0597a59 --- /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 00000000..f7f2ef2f --- /dev/null +++ b/src/c/matrixOperations/includes/eye.h @@ -0,0 +1,69 @@ +/* + * 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" + +#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 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); + +#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 00000000..09b8d811 --- /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/hilb.h b/src/c/matrixOperations/includes/hilb.h new file mode 100644 index 00000000..65efd0e2 --- /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 00000000..130cfeaf --- /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 00000000..38a8b1e2 --- /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/logm.h b/src/c/matrixOperations/includes/logm.h new file mode 100644 index 00000000..7eec569d --- /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 00000000..7702313b --- /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 00000000..4b3cd8a0 --- /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 00000000..90312459 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixInversion.h @@ -0,0 +1,66 @@ +/* + * 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" + +#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 ); + +#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 00000000..7b65c6d9 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixMagnitude.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 __MAGNITUDE_H__ +#define __MAGNITUDE_H__ + +#include "dynlib_matrixoperations.h" +#include "floatComplex.h" +#include "doubleComplex.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); + +#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 00000000..228dd163 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixMultiplication.h @@ -0,0 +1,91 @@ +/* + * 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" + +#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); + +#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 00000000..d7ffab31 --- /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 00000000..9ee64c32 --- /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 00000000..76b77454 --- /dev/null +++ b/src/c/matrixOperations/includes/matrixTrace.h @@ -0,0 +1,70 @@ +/* + * 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" + +#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 ) ; + +#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 00000000..122b618d --- /dev/null +++ b/src/c/matrixOperations/includes/matrixTranspose.h @@ -0,0 +1,61 @@ +/* + * 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 <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 ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__MATRIXTRANSPOSE_H__ */ diff --git a/src/c/matrixOperations/includes/ones.h b/src/c/matrixOperations/includes/ones.h new file mode 100644 index 00000000..63d8bd4b --- /dev/null +++ b/src/c/matrixOperations/includes/ones.h @@ -0,0 +1,69 @@ +/* + * 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" + + +#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 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 ); + +#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 00000000..b7b7d35c --- /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/zeros.h b/src/c/matrixOperations/includes/zeros.h new file mode 100644 index 00000000..e2f3f002 --- /dev/null +++ b/src/c/matrixOperations/includes/zeros.h @@ -0,0 +1,68 @@ +/* + * 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" + +#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 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 ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ZEROS_H__ */ |