diff options
author | Sandeep Gupta | 2017-07-07 00:29:35 +0530 |
---|---|---|
committer | Sandeep Gupta | 2017-07-07 00:29:35 +0530 |
commit | 7a7f685a8436b456b246c49baf76bb8af930b214 (patch) | |
tree | e39f449c661d2b182a952e5b96e4e63ab80af685 /src/c/matrixOperations/norm | |
parent | ea958d3c401761dcc24865d9639b2fab31038db8 (diff) | |
download | Scilab2C_fossee_old-7a7f685a8436b456b246c49baf76bb8af930b214.tar.gz Scilab2C_fossee_old-7a7f685a8436b456b246c49baf76bb8af930b214.tar.bz2 Scilab2C_fossee_old-7a7f685a8436b456b246c49baf76bb8af930b214.zip |
NORM
Diffstat (limited to 'src/c/matrixOperations/norm')
-rw-r--r-- | src/c/matrixOperations/norm/dnorma.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/c/matrixOperations/norm/dnorma.c b/src/c/matrixOperations/norm/dnorma.c index c912f85..2bb9b8b 100644 --- a/src/c/matrixOperations/norm/dnorma.c +++ b/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 +} |