summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/matrixOperations/norm/dnorma.c
diff options
context:
space:
mode:
authorBrijeshcr2017-07-06 15:24:41 +0530
committerGitHub2017-07-06 15:24:41 +0530
commita7eeecce4c7c39ea52a2d434815c574a2c42730d (patch)
tree9968264546fd54f9eaa6ad80ee7db47e366f8601 /2.3-1/src/c/matrixOperations/norm/dnorma.c
parent3308ea7a973e2c1e1c8bea99ac7cc783ce8e8b06 (diff)
parent115efeb443a7e6da44f628537811b69a01553ab2 (diff)
downloadScilab2C-a7eeecce4c7c39ea52a2d434815c574a2c42730d.tar.gz
Scilab2C-a7eeecce4c7c39ea52a2d434815c574a2c42730d.tar.bz2
Scilab2C-a7eeecce4c7c39ea52a2d434815c574a2c42730d.zip
Merge pull request #3 from sandeepgupta007/master
LinearAlgebra Function Added
Diffstat (limited to '2.3-1/src/c/matrixOperations/norm/dnorma.c')
-rw-r--r--2.3-1/src/c/matrixOperations/norm/dnorma.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/2.3-1/src/c/matrixOperations/norm/dnorma.c b/2.3-1/src/c/matrixOperations/norm/dnorma.c
index c912f857..2bb9b8b7 100644
--- a/2.3-1/src/c/matrixOperations/norm/dnorma.c
+++ b/2.3-1/src/c/matrixOperations/norm/dnorma.c
@@ -6,6 +6,8 @@
are also available at
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
Author: Siddhesh Wani
+
+ Edited by: Sandeep Gupta
Organization: FOSSEE, IIT Bombay
Email: toolbox@scilab.in
*/
@@ -14,13 +16,17 @@
/*Acceptable norms are: 1, 2, 'inf', 'fro', */
#include "norm.h"
+#include "svd.h"
#include <math.h>
+#include <stdio.h>
+#include<stdlib.h>
double dnorma (double *in, int row, int col, int norm)
{
double res = 0, sum = 0;
int col_count, row_count;
-
+ double *S;
+ S = (double *)malloc(min(row,col)*sizeof(double));
switch (norm)
{
case 1: /*largest column sum*/
@@ -37,6 +43,8 @@ double dnorma (double *in, int row, int col, int norm)
break;
case 2: /*Largest singular value of the matrix*/
+ dsvda(0,in,row,col,0,1,S,NULL,NULL);
+ res = S[0];
break;
case 3: /*inf: largest row sum*/
@@ -69,4 +77,4 @@ double dnorma (double *in, int row, int col, int norm)
return res;
-} \ No newline at end of file
+}