cs_print.c
Go to the documentation of this file.
1 #include "cs.h"
2 /* print a sparse matrix */
3 int cs_print (const cs *A, int brief)
4 {
5  int p, j, m, n, nzmax, nz, *Ap, *Ai ;
6  double *Ax ;
7  if (!A) { printf ("(null)\n") ; return (0) ; }
8  m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ;
9  nzmax = A->nzmax ; nz = A->nz ;
10  printf ("CSparse Version %d.%d.%d, %s. %s\n", CS_VER, CS_SUBVER,
12  if (nz < 0)
13  {
14  printf ("%d-by-%d, nzmax: %d nnz: %d, 1-norm: %g\n", m, n, nzmax,
15  Ap [n], cs_norm (A)) ;
16  for (j = 0 ; j < n ; j++)
17  {
18  printf (" col %d : locations %d to %d\n", j, Ap [j], Ap [j+1]-1);
19  for (p = Ap [j] ; p < Ap [j+1] ; p++)
20  {
21  printf (" %d : %g\n", Ai [p], Ax ? Ax [p] : 1) ;
22  if (brief && p > 20) { printf (" ...\n") ; return (1) ; }
23  }
24  }
25  }
26  else
27  {
28  printf ("triplet: %d-by-%d, nzmax: %d nnz: %d\n", m, n, nzmax, nz) ;
29  for (p = 0 ; p < nz ; p++)
30  {
31  printf (" %d %d : %g\n", Ai [p], Ap [p], Ax ? Ax [p] : 1) ;
32  if (brief && p > 20) { printf (" ...\n") ; return (1) ; }
33  }
34  }
35  return (1) ;
36 }
#define CS_SUBSUB
Definition: cs.h:9
int n
Definition: cs.h:20
#define CS_VER
Definition: cs.h:7
#define CS_SUBVER
Definition: cs.h:8
int nzmax
Definition: cs.h:18
int nz
Definition: cs.h:24
#define CS_COPYRIGHT
Definition: cs.h:11
int * p
Definition: cs.h:21
double cs_norm(const cs *A)
Definition: cs_norm.c:3
Definition: cs.h:16
int * i
Definition: cs.h:22
int cs_print(const cs *A, int brief)
Definition: cs_print.c:3
double * x
Definition: cs.h:23
int m
Definition: cs.h:19
#define CS_DATE
Definition: cs.h:10


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:31