00001 #include "cs.h"
00002
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) ;
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 }