summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/c/linearAlgebra/hess/dhessa.c8
-rw-r--r--src/c/linearAlgebra/projspec/dprojspeca.c3
-rw-r--r--src/c/linearAlgebra/sqroot/dsqroota.c4
-rw-r--r--src/c/linearAlgebra/sva/dsvaa.c7
-rw-r--r--src/c/matrixOperations/Slash/dslasha.c32
5 files changed, 43 insertions, 11 deletions
diff --git a/src/c/linearAlgebra/hess/dhessa.c b/src/c/linearAlgebra/hess/dhessa.c
index 57f81b3..e1f2e2d 100644
--- a/src/c/linearAlgebra/hess/dhessa.c
+++ b/src/c/linearAlgebra/hess/dhessa.c
@@ -20,11 +20,13 @@
#include "matrixTranspose.h"
#include "matrixMultiplication.h"
+/* Lapack subroutines - which are used*/
extern int dgehrd_(int *, int *,int *,double *,int *,double *,double *,int *,int *);
extern int dorghr_(int *, int *,int *,double *,int *,double *,double *,int *,int *);
-
+/* All the vairbale names are given exactly the same name as scilab source code */
void dhessa(double *in1,int size,int nout,double *out1, double *out2){
+/* Variables names are done through, Lapack library. */
int i,j,k;
int N = size;
int ILO=1;
@@ -41,11 +43,11 @@ void dhessa(double *in1,int size,int nout,double *out1, double *out2){
WORK = (double *)malloc((double)LWORK*sizeof(double));
dgehrd_(&N,&ILO,&IHI,A,&LDA,TAU,WORK,&N,&INFO);
- for(i=0;i<N;i++)
+ for(i=0;i<N;i++) /* copying it in output */
for(j=0;j<N;j++)
out2[i+j*N] = A[i+j*N];
- for(j=1;j<=N-2;j++){
+ for(j=1;j<=N-2;j++){ /* copying it in output */
for(i=j+2;i<=N;i++){
out2[(i-1)+(j-1)*N] = 0;
}
diff --git a/src/c/linearAlgebra/projspec/dprojspeca.c b/src/c/linearAlgebra/projspec/dprojspeca.c
index 6bb6fa5..aea9713 100644
--- a/src/c/linearAlgebra/projspec/dprojspeca.c
+++ b/src/c/linearAlgebra/projspec/dprojspeca.c
@@ -63,8 +63,5 @@ double dprojspeca(double *inp1,int row,int col,double *out1,double *out2,double
index = 0;
return index;
}
-
index = 1;
-
-
}
diff --git a/src/c/linearAlgebra/sqroot/dsqroota.c b/src/c/linearAlgebra/sqroot/dsqroota.c
index 038afc9..a9062e6 100644
--- a/src/c/linearAlgebra/sqroot/dsqroota.c
+++ b/src/c/linearAlgebra/sqroot/dsqroota.c
@@ -108,9 +108,9 @@ void dsqroota(double *inp,int row,int col, double *out){
}
for(i=0;i<col*rk;i++){
B[i] = V[i];
- printf("%lf ",B[i]);
+ //printf("%lf ",B[i]);
}
- printf("\n");
+ //printf("\n");
/*for(i=0;i<rk;i++){
for(j=0;j<rk;j++){
//A[i*rk+j] = sqrt(S[i*row+j]);
diff --git a/src/c/linearAlgebra/sva/dsvaa.c b/src/c/linearAlgebra/sva/dsvaa.c
index 0d34d8d..691694e 100644
--- a/src/c/linearAlgebra/sva/dsvaa.c
+++ b/src/c/linearAlgebra/sva/dsvaa.c
@@ -20,6 +20,7 @@
#define eps 2.22044604925e-16
+/* Ref: Scilab source code */
void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \
double *out2,double *out3){
@@ -70,21 +71,21 @@ void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \
}
}
arow = M;
- acol = Min(M,N);
+ acol = Min(M,N); /* Copying, the output in required format */
for(i=0;i<arow;i++){
for(j=0;j<rk;j++){
out1[i+j*row]=U[i+j*arow];
}
}
arow = Min(M,N);
- for(i=0;i<rk;i++){
+ for(i=0;i<rk;i++){ /* Copying, the output in required format */
for(j=0;j<rk;j++){
out2[i+j*(int)rk] = S[i+j*arow];
}
}
arow = N;
acol = Min(M,N);
- for(i=0;i<arow;i++){
+ for(i=0;i<arow;i++){ /* Copying, the output in required format */
for(j=0;j<rk;j++){
out3[i+j*arow] = V[i+j*arow];
}
diff --git a/src/c/matrixOperations/Slash/dslasha.c b/src/c/matrixOperations/Slash/dslasha.c
new file mode 100644
index 0000000..cb2007b
--- /dev/null
+++ b/src/c/matrixOperations/Slash/dslasha.c
@@ -0,0 +1,32 @@
+/* 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: Sandeep Gupta
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+/*This function finds the A/B. */
+
+/* X = slash(A,B) <=> X = A/B */
+
+#include <stdio.h>
+#include "string.h"
+#include "stdlib.h"
+#include "lapack.h"
+#include "matrixTranspose.h"
+#include "matrixMultiplication.h"
+
+void dslasha(double *A,int m1,int n1,double *B,int m2,int n2,double *out){
+ if(m1 != n1 && m1 != m2 && m2 != n2){
+ return;
+ }
+
+ double AF;
+ AF = (double *)malloc();
+
+}