EVSL  1.1.0
EigenValues Slicing Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
cs_norm.c
Go to the documentation of this file.
1 #include "cs.h"
2 /* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */
3 double cs_norm (const cs *A)
4 {
5  CS_INT p, j, n, *Ap ;
6  CS_ENTRY *Ax ;
7  double norm = 0, s ;
8  if (!CS_CSC (A) || !A->x) return (-1) ; /* check inputs */
9  n = A->n ; Ap = A->p ; Ax = A->x ;
10  for (j = 0 ; j < n ; j++)
11  {
12  for (s = 0, p = Ap [j] ; p < Ap [j+1] ; p++) s += CS_ABS (Ax [p]) ;
13  norm = CS_MAX (norm, s) ;
14  }
15  return (norm) ;
16 }
#define cs
Definition: cs.h:637
#define CS_ENTRY
Definition: cs.h:635
double cs_norm(const cs *A)
Definition: cs_norm.c:3
#define CS_MAX(a, b)
Definition: cs.h:653
#define CS_ABS(x)
Definition: cs.h:650
#define CS_CSC(A)
Definition: cs.h:659
#define CS_INT
Definition: cs.h:627