EVSL
1.1.0
EigenValues Slicing Library
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
EXTERNAL
CXSparse
Source
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
}
cs
#define cs
Definition:
cs.h:637
CS_ENTRY
#define CS_ENTRY
Definition:
cs.h:635
cs_norm
double cs_norm(const cs *A)
Definition:
cs_norm.c:3
CS_MAX
#define CS_MAX(a, b)
Definition:
cs.h:653
CS_ABS
#define CS_ABS(x)
Definition:
cs.h:650
cs.h
CS_CSC
#define CS_CSC(A)
Definition:
cs.h:659
CS_INT
#define CS_INT
Definition:
cs.h:627
Generated by
1.8.6