cs_reach.c
Go to the documentation of this file.
1 #include "cs.h"
2 /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k).
3  * xi [n...2n-1] used as workspace */
4 int cs_reach (cs *G, const cs *B, int k, int *xi, const int *pinv)
5 {
6  int p, n, top, *Bp, *Bi, *Gp ;
7  if (!CS_CSC (G) || !CS_CSC (B) || !xi) return (-1) ; /* check inputs */
8  n = G->n ; Bp = B->p ; Bi = B->i ; Gp = G->p ;
9  top = n ;
10  for (p = Bp [k] ; p < Bp [k+1] ; p++)
11  {
12  if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */
13  {
14  top = cs_dfs (Bi [p], G, top, xi, xi+n, pinv) ;
15  }
16  }
17  for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */
18  return (top) ;
19 }
#define CS_MARKED(w, j)
Definition: cs.h:138
#define CS_MARK(w, j)
Definition: cs.h:139
int n
Definition: cs.h:20
int cs_reach(cs *G, const cs *B, int k, int *xi, const int *pinv)
Definition: cs_reach.c:4
int cs_dfs(int j, cs *G, int top, int *xi, int *pstack, const int *pinv)
Definition: cs_dfs.c:3
#define CS_CSC(A)
Definition: cs.h:140
int * p
Definition: cs.h:21
Definition: cs.h:16
int * i
Definition: cs.h:22


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