20 #ifndef KLU2_EXTRACT_HPP
21 #define KLU2_EXTRACT_HPP
23 #include "klu2_internal.h"
25 template <
typename Entry,
typename Int>
29 KLU_numeric<Entry, Int> *Numeric,
30 KLU_symbolic<Entry, Int> *Symbolic,
70 KLU_common<Entry> *Common
73 Int *Lip, *Llen, *Uip, *Ulen, *Li2, *Ui2 ;
75 Entry *Lx2, *Ux2, *Ukk ;
76 Int i, k, block, nblocks, n, nz, k1, k2, nk, len, kk, p ;
83 if (Symbolic == NULL || Numeric == NULL)
85 Common->status = KLU_INVALID ;
89 Common->status = KLU_OK ;
91 nblocks = Symbolic->nblocks ;
99 if (Numeric->Rs != NULL)
101 for (i = 0 ; i < n ; i++)
103 Rs [i] = Numeric->Rs [i] ;
109 for (i = 0 ; i < n ; i++)
122 for (block = 0 ; block <= nblocks ; block++)
124 R [block] = Symbolic->R [block] ;
134 for (k = 0 ; k < n ; k++)
136 P [k] = Numeric->Pnum [k] ;
146 for (k = 0 ; k < n ; k++)
148 Q [k] = Symbolic->Q [k] ;
156 if (Lp != NULL && Li != NULL && Lx != NULL
163 for (block = 0 ; block < nblocks ; block++)
165 k1 = Symbolic->R [block] ;
166 k2 = Symbolic->R [block+1] ;
182 LU = (Unit *) Numeric->LUbx [block] ;
183 Lip = Numeric->Lip + k1 ;
184 Llen = Numeric->Llen + k1 ;
185 for (kk = 0 ; kk < nk ; kk++)
195 GET_POINTER (LU, Lip, Llen, Li2, Lx2, kk, len) ;
196 for (p = 0 ; p < len ; p++)
198 Li [nz] = k1 + Li2 [p] ;
199 Lx [nz] = REAL (Lx2 [p]) ;
201 Lz [nz] = IMAG (Lx2 [p]) ;
209 ASSERT (nz == Numeric->lnz) ;
216 if (Up != NULL && Ui != NULL && Ux != NULL
223 for (block = 0 ; block < nblocks ; block++)
225 k1 = Symbolic->R [block] ;
226 k2 = Symbolic->R [block+1] ;
228 Ukk = ((Entry *) Numeric->Udiag) + k1 ;
234 Ux [nz] = REAL (Ukk [0]) ;
236 Uz [nz] = IMAG (Ukk [0]) ;
243 LU = (Unit *) Numeric->LUbx [block] ;
244 Uip = Numeric->Uip + k1 ;
245 Ulen = Numeric->Ulen + k1 ;
246 for (kk = 0 ; kk < nk ; kk++)
249 GET_POINTER (LU, Uip, Ulen, Ui2, Ux2, kk, len) ;
250 for (p = 0 ; p < len ; p++)
252 Ui [nz] = k1 + Ui2 [p] ;
253 Ux [nz] = REAL (Ux2 [p]) ;
255 Uz [nz] = IMAG (Ux2 [p]) ;
261 Ux [nz] = REAL (Ukk [kk]) ;
263 Uz [nz] = IMAG (Ukk [kk]) ;
270 ASSERT (nz == Numeric->unz) ;
277 if (Fp != NULL && Fi != NULL && Fx != NULL
283 for (k = 0 ; k <= n ; k++)
285 Fp [k] = Numeric->Offp [k] ;
288 for (k = 0 ; k < nz ; k++)
290 Fi [k] = Numeric->Offi [k] ;
292 for (k = 0 ; k < nz ; k++)
294 Fx [k] = REAL (((Entry *) Numeric->Offx) [k]) ;
296 Fz [k] = IMAG (((Entry *) Numeric->Offx) [k]) ;