summaryrefslogtreecommitdiff
path: root/src/c/linearAlgebra
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-08-10 20:33:46 +0530
committerAbhinav Dronamraju2017-08-10 20:33:46 +0530
commit5b728d8239b1a1f4467e2485d54c7ed7db1d4f11 (patch)
treed8db631e058bae294362b2087079150569fc9581 /src/c/linearAlgebra
parent6422b5c0a45161d6571fd6d7077b6d551cbb5e26 (diff)
parent4bc007e5b44a13b582b0275bf7fc6693942ba2ac (diff)
downloadScilab2C_fossee_old-5b728d8239b1a1f4467e2485d54c7ed7db1d4f11.tar.gz
Scilab2C_fossee_old-5b728d8239b1a1f4467e2485d54c7ed7db1d4f11.tar.bz2
Scilab2C_fossee_old-5b728d8239b1a1f4467e2485d54c7ed7db1d4f11.zip
Merge and functions added
Diffstat (limited to 'src/c/linearAlgebra')
-rw-r--r--src/c/linearAlgebra/includes/range.h34
-rw-r--r--src/c/linearAlgebra/interfaces/int_range.h27
-rw-r--r--src/c/linearAlgebra/range/drangea.c78
3 files changed, 139 insertions, 0 deletions
diff --git a/src/c/linearAlgebra/includes/range.h b/src/c/linearAlgebra/includes/range.h
new file mode 100644
index 0000000..cb1d3a3
--- /dev/null
+++ b/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/src/c/linearAlgebra/interfaces/int_range.h b/src/c/linearAlgebra/interfaces/int_range.h
new file mode 100644
index 0000000..d0c529d
--- /dev/null
+++ b/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/src/c/linearAlgebra/range/drangea.c b/src/c/linearAlgebra/range/drangea.c
new file mode 100644
index 0000000..7627f24
--- /dev/null
+++ b/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;
+
+}