6 CS_INT *Ap, *Ai, head = 0, tail = 0, j, i, p, j2 ;
8 for (j = 0 ; j < n ; j++)
10 if (imatch [j] >= 0) continue ;
14 if (tail == 0)
return (1) ;
17 Ap = C->p ; Ai = C->i ;
21 for (p = Ap [j] ; p < Ap [j+1] ; p++)
24 if (wi [i] >= 0) continue ;
27 if (wj [j2] >= 0) continue ;
42 for (j = 0 ; j < n ; j++)
44 if (wj [j] != mark) continue ;
45 p [kr++] = imatch [j] ;
56 for (i = 0 ; i < m ; i++)
if (wi [i] == 0) p [kr++] = i ;
64 return (i >= rr [1] && i < rr [2]) ;
70 CS_INT m, n, i, j, k, cnz, nc, *jmatch, *imatch, *wi, *wj, *pinv, *Cp, *Ci,
71 *ps, *rs, nb1, nb2, *p, *q, *cc, *rr, *r, *s, ok ;
75 if (!
CS_CSC (A))
return (NULL) ;
78 if (!D)
return (NULL) ;
79 p = D->p ; q = D->q ; r = D->r ; s = D->s ; cc = D->cc ; rr = D->rr ;
82 if (!jmatch)
return (
cs_ddone (D, NULL, jmatch, 0)) ;
85 for (j = 0 ; j < n ; j++) wj [j] = -1 ;
86 for (i = 0 ; i < m ; i++) wi [i] = -1 ;
87 cs_bfs (A, n, wi, wj, q, imatch, jmatch, 1) ;
88 ok = cs_bfs (A, m, wj, wi, p, jmatch, imatch, 3) ;
89 if (!ok)
return (
cs_ddone (D, NULL, jmatch, 0)) ;
90 cs_unmatched (n, wj, q, cc, 0) ;
91 cs_matched (n, wj, imatch, p, q, cc, rr, 1, 1) ;
92 cs_matched (n, wj, imatch, p, q, cc, rr, 2, -1) ;
93 cs_matched (n, wj, imatch, p, q, cc, rr, 3, 3) ;
94 cs_unmatched (m, wi, p, rr, 3) ;
98 if (!pinv)
return (
cs_ddone (D, NULL, NULL, 0)) ;
101 if (!C)
return (
cs_ddone (D, NULL, NULL, 0)) ;
103 nc = cc [3] - cc [2] ;
104 if (cc [2] > 0)
for (j = cc [2] ; j <= cc [3] ; j++) Cp [j-cc[2]] = Cp [j] ;
106 if (rr [2] - rr [1] < m)
111 if (rr [1] > 0)
for (k = 0 ; k < cnz ; k++) Ci [k] -= rr [1] ;
115 if (!scc)
return (
cs_ddone (D, C, NULL, 0)) ;
120 for (k = 0 ; k < nc ; k++) wj [k] = q [ps [k] + cc [2]] ;
121 for (k = 0 ; k < nc ; k++) q [k + cc [2]] = wj [k] ;
122 for (k = 0 ; k < nc ; k++) wi [k] = p [ps [k] + rr [1]] ;
123 for (k = 0 ; k < nc ; k++) p [k + rr [1]] = wi [k] ;
126 if (cc [2] > 0) nb2++ ;
127 for (k = 0 ; k < nb1 ; k++)
129 r [nb2] = rs [k] + rr [1] ;
130 s [nb2] = rs [k] + cc [2] ;
CS_INT * cs_pinv(CS_INT const *p, CS_INT n)
csd * cs_dmperm(const cs *A, CS_INT seed)
CS_INT cs_fkeep(cs *A, CS_INT(*fkeep)(CS_INT, CS_INT, CS_ENTRY, void *), void *other)
cs * cs_transpose(const cs *A, CS_INT values)
cs * cs_permute(const cs *A, const CS_INT *pinv, const CS_INT *q, CS_INT values)
csd * cs_dalloc(CS_INT m, CS_INT n)
csd * cs_ddone(csd *D, cs *C, void *w, CS_INT ok)
CS_INT * cs_maxtrans(const cs *A, CS_INT seed)