44 #ifndef KLU2_EXTRACT_HPP
45 #define KLU2_EXTRACT_HPP
47 #include "klu2_internal.h"
49 template <
typename Entry,
typename Int>
53 KLU_numeric<Entry, Int> *Numeric,
54 KLU_symbolic<Entry, Int> *Symbolic,
94 KLU_common<Entry> *Common
97 Int *Lip, *Llen, *Uip, *Ulen, *Li2, *Ui2 ;
99 Entry *Lx2, *Ux2, *Ukk ;
100 Int i, k, block, nblocks, n, nz, k1, k2, nk, len, kk, p ;
107 if (Symbolic == NULL || Numeric == NULL)
109 Common->status = KLU_INVALID ;
113 Common->status = KLU_OK ;
115 nblocks = Symbolic->nblocks ;
123 if (Numeric->Rs != NULL)
125 for (i = 0 ; i < n ; i++)
127 Rs [i] = Numeric->Rs [i] ;
133 for (i = 0 ; i < n ; i++)
146 for (block = 0 ; block <= nblocks ; block++)
148 R [block] = Symbolic->R [block] ;
158 for (k = 0 ; k < n ; k++)
160 P [k] = Numeric->Pnum [k] ;
170 for (k = 0 ; k < n ; k++)
172 Q [k] = Symbolic->Q [k] ;
180 if (Lp != NULL && Li != NULL && Lx != NULL
187 for (block = 0 ; block < nblocks ; block++)
189 k1 = Symbolic->R [block] ;
190 k2 = Symbolic->R [block+1] ;
206 LU = (Unit *) Numeric->LUbx [block] ;
207 Lip = Numeric->Lip + k1 ;
208 Llen = Numeric->Llen + k1 ;
209 for (kk = 0 ; kk < nk ; kk++)
219 GET_POINTER (LU, Lip, Llen, Li2, Lx2, kk, len) ;
220 for (p = 0 ; p < len ; p++)
222 Li [nz] = k1 + Li2 [p] ;
223 Lx [nz] = REAL (Lx2 [p]) ;
225 Lz [nz] = IMAG (Lx2 [p]) ;
233 ASSERT (nz == Numeric->lnz) ;
240 if (Up != NULL && Ui != NULL && Ux != NULL
247 for (block = 0 ; block < nblocks ; block++)
249 k1 = Symbolic->R [block] ;
250 k2 = Symbolic->R [block+1] ;
252 Ukk = ((Entry *) Numeric->Udiag) + k1 ;
258 Ux [nz] = REAL (Ukk [0]) ;
260 Uz [nz] = IMAG (Ukk [0]) ;
267 LU = (Unit *) Numeric->LUbx [block] ;
268 Uip = Numeric->Uip + k1 ;
269 Ulen = Numeric->Ulen + k1 ;
270 for (kk = 0 ; kk < nk ; kk++)
273 GET_POINTER (LU, Uip, Ulen, Ui2, Ux2, kk, len) ;
274 for (p = 0 ; p < len ; p++)
276 Ui [nz] = k1 + Ui2 [p] ;
277 Ux [nz] = REAL (Ux2 [p]) ;
279 Uz [nz] = IMAG (Ux2 [p]) ;
285 Ux [nz] = REAL (Ukk [kk]) ;
287 Uz [nz] = IMAG (Ukk [kk]) ;
294 ASSERT (nz == Numeric->unz) ;
301 if (Fp != NULL && Fi != NULL && Fx != NULL
307 for (k = 0 ; k <= n ; k++)
309 Fp [k] = Numeric->Offp [k] ;
312 for (k = 0 ; k < nz ; k++)
314 Fi [k] = Numeric->Offi [k] ;
316 for (k = 0 ; k < nz ; k++)
318 Fx [k] = REAL (((Entry *) Numeric->Offx) [k]) ;
320 Fz [k] = IMAG (((Entry *) Numeric->Offx) [k]) ;