1 // =============================================================================
2 // === spqr_csize ==============================================================
3 // =============================================================================
4 
5 #include "spqr.hpp"
6 
spqr_csize(Long c,Long * Rp,Long * Cm,Long * Super)7 Long spqr_csize     // returns # of entries in C of a child
8 (
9     // input, not modified
10     Long c,                 // child c
11     Long *Rp,               // size nf+1, pointers for pattern of R
12     Long *Cm,               // size nf, Cm [c] = # of rows in child C
13     Long *Super             // size nf, pivotal columns in each front
14 )
15 {
16     Long pc, cm, fnc, fpc, cn, csize ;
17 
18     pc = Rp [c] ;                   // get the pattern of child R
19     cm = Cm [c] ;                   // # of rows in child C
20     fnc = Rp [c+1] - pc ;           // total # cols in child F
21     fpc = Super [c+1] - Super [c] ; // # of pivot cols in child
22     cn = fnc - fpc ;                // # of cols in child C
23     ASSERT (cm >= 0 && cm <= cn) ;
24     ASSERT (pc + cm <= Rp [c+1]) ;
25     // Note that this is safe from Long overflow
26     csize = (cm * (cm+1)) / 2 + cm * (cn - cm) ;
27     return (csize) ;
28 }
29 
30