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 }


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:36:56