cs_norm.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */
00003 double cs_norm (const cs *A)
00004 {
00005     int p, j, n, *Ap ;
00006     double *Ax,  norm = 0, s ;
00007     if (!CS_CSC (A) || !A->x) return (-1) ;             /* check inputs */
00008     n = A->n ; Ap = A->p ; Ax = A->x ;
00009     for (j = 0 ; j < n ; j++)
00010     {
00011         for (s = 0, p = Ap [j] ; p < Ap [j+1] ; p++) s += fabs (Ax [p]) ;
00012         norm = CS_MAX (norm, s) ;
00013     }
00014     return (norm) ;
00015 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Wed Dec 26 2012 15:36:47