diff options
Diffstat (limited to '2.3-1/src/c/linearAlgebra')
-rw-r--r-- | 2.3-1/src/c/linearAlgebra/includes/range.h | 34 | ||||
-rw-r--r-- | 2.3-1/src/c/linearAlgebra/interfaces/int_range.h | 27 | ||||
-rw-r--r-- | 2.3-1/src/c/linearAlgebra/range/drangea.c | 78 |
3 files changed, 139 insertions, 0 deletions
diff --git a/2.3-1/src/c/linearAlgebra/includes/range.h b/2.3-1/src/c/linearAlgebra/includes/range.h new file mode 100644 index 00000000..cb1d3a3e --- /dev/null +++ b/2.3-1/src/c/linearAlgebra/includes/range.h @@ -0,0 +1,34 @@ + /* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __RANGE_H__ +#define __RANGE_H__ +#include "types.h" +#include "eye.h" +#include "rowcomp.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double drangea(double* inp1, int row, int col, double inp2, double* out1); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RANGE_H__*/ diff --git a/2.3-1/src/c/linearAlgebra/interfaces/int_range.h b/2.3-1/src/c/linearAlgebra/interfaces/int_range.h new file mode 100644 index 00000000..d0c529d8 --- /dev/null +++ b/2.3-1/src/c/linearAlgebra/interfaces/int_range.h @@ -0,0 +1,27 @@ + /* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_RANGE_H__ +#define __INT_RANGE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2d0ranged2d0(in1,size1,in2,out1) drangea(in1,size1[0],size1[1],in2,out1) +#define d2ranged2d0(in1,size1,out1) drangea(in1,size1[0],size1[1], 1,out1) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RANGE_H__*/ diff --git a/2.3-1/src/c/linearAlgebra/range/drangea.c b/2.3-1/src/c/linearAlgebra/range/drangea.c new file mode 100644 index 00000000..7627f24a --- /dev/null +++ b/2.3-1/src/c/linearAlgebra/range/drangea.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "range.h" + +double drangea(double* inp1, int row, int col, double inp2, double* out1) +{ + double a[row*col], aprod[row*col], dim = 0, u[row*row], utrans[row*row], o[row*row], unew[row*col], otemp[row*col]; + if (inp2 == 0) + { + deyea(out1, row, col); + return row; + + } + + dim = drowcompa(1,inp1,row,col,NULL,0,u); + + + for(int i = 0; i < row*row; i++) + o[i] = u[i]; + + for(int i = 0; i < row*col; i++) + a[i] = inp1[i]; + + dtransposea(u,row,row, utrans); + + + for(int i = 2; i <= inp2; i++) + { + + dmulma(a, row, col, utrans, row, row, aprod); + + for(int i = 0; i < row*col; i++) + a[i] = aprod[i]; + + + double acut[row*(int)dim]; + + for(int i = 0; i < row*dim; i++) + acut[i] = a[i]; + + + + dim = drowcompa(1,acut,row,(int)dim,NULL,0,unew); + + for(int i = 0; i < row*col; i++) + u[i] = unew[i]; + + + + dmulma(u, row, row, o, row, col, otemp); + + for(int i = 0; i < row*col; i++) + o[i] = otemp[i]; + + + } + + + + for(int i = 0; i < row*col; i++) + out1[i] = o[i]; + + return dim; + +} |