osqp_rust_sys/src64/lin_sys/direct/pardiso/
pardiso_interface.rs

1extern "C" {
2    fn malloc(_: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void;
3    fn calloc(_: ::std::os::raw::c_ulong, _: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void;
4    fn free(_: *mut ::std::os::raw::c_void);
5    fn update_KKT_param2(
6        KKT: *mut csc,
7        param2: *const c_float,
8        param2toKKT: *const c_int,
9        m: c_int,
10    );
11    fn update_KKT_A(KKT: *mut csc, A: *const csc, AtoKKT: *const c_int);
12    fn update_KKT_P(
13        KKT: *mut csc,
14        P: *const csc,
15        PtoKKT: *const c_int,
16        param1: c_float,
17        Pdiag_idx: *const c_int,
18        Pdiag_n: c_int,
19    );
20    fn form_KKT(
21        P: *const csc,
22        A: *const csc,
23        format: c_int,
24        param1: c_float,
25        param2: *mut c_float,
26        PtoKKT: *mut c_int,
27        AtoKKT: *mut c_int,
28        Pdiag_idx: *mut *mut c_int,
29        Pdiag_n: *mut c_int,
30        param2toKKT: *mut c_int,
31    ) -> *mut csc;
32    fn printf(_: *const ::std::os::raw::c_char, _: ...) -> ::std::os::raw::c_int;
33    fn csc_spfree(A: *mut csc);
34    fn pardiso(
35        _: *mut *mut ::std::os::raw::c_void,
36        _: *const c_int,
37        _: *const c_int,
38        _: *const c_int,
39        _: *const c_int,
40        _: *const c_int,
41        _: *const c_float,
42        _: *const c_int,
43        _: *const c_int,
44        _: *mut c_int,
45        _: *const c_int,
46        _: *mut c_int,
47        _: *const c_int,
48        _: *mut c_float,
49        _: *mut c_float,
50        _: *mut c_int,
51    );
52    fn mkl_set_interface_layer(_: c_int) -> c_int;
53    fn mkl_get_max_threads() -> c_int;
54}
55pub type c_int = ::std::os::raw::c_longlong;
56pub type c_float = ::std::os::raw::c_double;
57pub type linsys_solver_type = ::std::os::raw::c_uint;
58pub const MKL_PARDISO_SOLVER: linsys_solver_type = 1;
59pub const QDLDL_SOLVER: linsys_solver_type = 0;
60pub type osqp_error_type = ::std::os::raw::c_uint;
61pub const OSQP_WORKSPACE_NOT_INIT_ERROR: osqp_error_type = 7;
62pub const OSQP_MEM_ALLOC_ERROR: osqp_error_type = 6;
63pub const OSQP_NONCVX_ERROR: osqp_error_type = 5;
64pub const OSQP_LINSYS_SOLVER_INIT_ERROR: osqp_error_type = 4;
65pub const OSQP_LINSYS_SOLVER_LOAD_ERROR: osqp_error_type = 3;
66pub const OSQP_SETTINGS_VALIDATION_ERROR: osqp_error_type = 2;
67pub const OSQP_DATA_VALIDATION_ERROR: osqp_error_type = 1;
68#[derive(Copy, Clone)]
69#[repr(C)]
70pub struct csc {
71    pub nzmax: c_int,
72    pub m: c_int,
73    pub n: c_int,
74    pub p: *mut c_int,
75    pub i: *mut c_int,
76    pub x: *mut c_float,
77    pub nz: c_int,
78}
79#[derive(Copy, Clone)]
80#[repr(C)]
81pub struct pardiso {
82    pub type_0: linsys_solver_type,
83    pub solve: Option::<unsafe extern "C" fn(*mut pardiso, *mut c_float) -> c_int>,
84    pub free: Option::<unsafe extern "C" fn(*mut pardiso) -> ()>,
85    pub update_matrices: Option::<
86        unsafe extern "C" fn(*mut pardiso, *const csc, *const csc) -> c_int,
87    >,
88    pub update_rho_vec: Option::<
89        unsafe extern "C" fn(*mut pardiso, *const c_float) -> c_int,
90    >,
91    pub nthreads: c_int,
92    pub KKT: *mut csc,
93    pub KKT_i: *mut c_int,
94    pub KKT_p: *mut c_int,
95    pub bp: *mut c_float,
96    pub sol: *mut c_float,
97    pub rho_inv_vec: *mut c_float,
98    pub sigma: c_float,
99    pub polish: c_int,
100    pub n: c_int,
101    pub m: c_int,
102    pub pt: [*mut ::std::os::raw::c_void; 64],
103    pub iparm: [c_int; 64],
104    pub nKKT: c_int,
105    pub mtype: c_int,
106    pub nrhs: c_int,
107    pub maxfct: c_int,
108    pub mnum: c_int,
109    pub phase: c_int,
110    pub error: c_int,
111    pub msglvl: c_int,
112    pub idum: c_int,
113    pub fdum: c_float,
114    pub Pdiag_idx: *mut c_int,
115    pub Pdiag_n: c_int,
116    pub PtoKKT: *mut c_int,
117    pub AtoKKT: *mut c_int,
118    pub rhotoKKT: *mut c_int,
119}
120pub type pardiso_solver = pardiso;
121pub const c_calloc: unsafe extern "C" fn(
122    ::std::os::raw::c_ulong,
123    ::std::os::raw::c_ulong,
124) -> *mut ::std::os::raw::c_void = calloc;
125pub const c_malloc: unsafe extern "C" fn(::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void = malloc;
126pub const c_print: unsafe extern "C" fn(*const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int = printf;
127pub const c_free: unsafe extern "C" fn(*mut ::std::os::raw::c_void) -> () = free;
128pub const OSQP_NULL: ::std::os::raw::c_int = 0 as ::std::os::raw::c_int;
129pub const MKL_INTERFACE_ILP64: ::std::os::raw::c_int = 0x1 as ::std::os::raw::c_int;
130pub const PARDISO_SYMBOLIC: ::std::os::raw::c_int = 11 as ::std::os::raw::c_int;
131pub const PARDISO_NUMERIC: ::std::os::raw::c_int = 22 as ::std::os::raw::c_int;
132pub const PARDISO_SOLVE: ::std::os::raw::c_int = 33 as ::std::os::raw::c_int;
133pub const PARDISO_CLEANUP: ::std::os::raw::c_int = -(1 as ::std::os::raw::c_int);
134#[no_mangle]
135pub unsafe extern "C" fn free_linsys_solver_pardiso(mut s: *mut pardiso_solver) {
136    if !s.is_null() {
137        (*s).phase = PARDISO_CLEANUP as c_int;
138        pardiso(
139            ((*s).pt).as_mut_ptr(),
140            &mut (*s).maxfct,
141            &mut (*s).mnum,
142            &mut (*s).mtype,
143            &mut (*s).phase,
144            &mut (*s).nKKT,
145            &mut (*s).fdum,
146            (*s).KKT_p,
147            (*s).KKT_i,
148            &mut (*s).idum,
149            &mut (*s).nrhs,
150            ((*s).iparm).as_mut_ptr(),
151            &mut (*s).msglvl,
152            &mut (*s).fdum,
153            &mut (*s).fdum,
154            &mut (*s).error,
155        );
156        if (*s).error != 0 as ::std::os::raw::c_int as ::std::os::raw::c_longlong {
157            printf(
158                b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
159                (*::std::mem::transmute::<
160                    &[u8; 27],
161                    &[::std::os::raw::c_char; 27],
162                >(b"free_linsys_solver_pardiso\0"))
163                    .as_ptr(),
164            );
165            printf(
166                b"Error during MKL Pardiso cleanup: %d\0" as *const u8
167                    as *const ::std::os::raw::c_char,
168                (*s).error as ::std::os::raw::c_int,
169            );
170            printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
171        }
172        if !((*s).KKT).is_null() {
173            csc_spfree((*s).KKT);
174        }
175        if !((*s).KKT_i).is_null() {
176            free((*s).KKT_i as *mut ::std::os::raw::c_void);
177        }
178        if !((*s).KKT_p).is_null() {
179            free((*s).KKT_p as *mut ::std::os::raw::c_void);
180        }
181        if !((*s).bp).is_null() {
182            free((*s).bp as *mut ::std::os::raw::c_void);
183        }
184        if !((*s).sol).is_null() {
185            free((*s).sol as *mut ::std::os::raw::c_void);
186        }
187        if !((*s).rho_inv_vec).is_null() {
188            free((*s).rho_inv_vec as *mut ::std::os::raw::c_void);
189        }
190        if !((*s).Pdiag_idx).is_null() {
191            free((*s).Pdiag_idx as *mut ::std::os::raw::c_void);
192        }
193        if !((*s).PtoKKT).is_null() {
194            free((*s).PtoKKT as *mut ::std::os::raw::c_void);
195        }
196        if !((*s).AtoKKT).is_null() {
197            free((*s).AtoKKT as *mut ::std::os::raw::c_void);
198        }
199        if !((*s).rhotoKKT).is_null() {
200            free((*s).rhotoKKT as *mut ::std::os::raw::c_void);
201        }
202        free(s as *mut ::std::os::raw::c_void);
203    }
204}
205#[no_mangle]
206pub unsafe extern "C" fn init_linsys_solver_pardiso(
207    mut sp: *mut *mut pardiso_solver,
208    mut P: *const csc,
209    mut A: *const csc,
210    mut sigma: c_float,
211    mut rho_vec: *const c_float,
212    mut polish: c_int,
213) -> c_int {
214    let mut i: c_int = 0;
215    let mut nnzKKT: c_int = 0;
216    let mut n_plus_m: c_int = 0;
217    let mut s: *mut pardiso_solver = 0 as *mut pardiso_solver;
218    s = calloc(
219        1 as ::std::os::raw::c_int as ::std::os::raw::c_ulong,
220        ::std::mem::size_of::<pardiso_solver>() as ::std::os::raw::c_ulong,
221    ) as *mut pardiso_solver;
222    *sp = s;
223    (*s).n = (*P).n;
224    (*s).m = (*A).m;
225    n_plus_m = (*s).n + (*s).m;
226    (*s).nKKT = n_plus_m;
227    (*s).sigma = sigma;
228    (*s).polish = polish;
229    let ref mut fresh0 = (*s).solve;
230    *fresh0 = Some(
231        solve_linsys_pardiso
232            as unsafe extern "C" fn(*mut pardiso_solver, *mut c_float) -> c_int,
233    );
234    let ref mut fresh1 = (*s).free;
235    *fresh1 = Some(
236        free_linsys_solver_pardiso as unsafe extern "C" fn(*mut pardiso_solver) -> (),
237    );
238    let ref mut fresh2 = (*s).update_matrices;
239    *fresh2 = Some(
240        update_linsys_solver_matrices_pardiso
241            as unsafe extern "C" fn(*mut pardiso_solver, *const csc, *const csc) -> c_int,
242    );
243    let ref mut fresh3 = (*s).update_rho_vec;
244    *fresh3 = Some(
245        update_linsys_solver_rho_vec_pardiso
246            as unsafe extern "C" fn(*mut pardiso_solver, *const c_float) -> c_int,
247    );
248    (*s).type_0 = MKL_PARDISO_SOLVER;
249    let ref mut fresh4 = (*s).bp;
250    *fresh4 = malloc(
251        (::std::mem::size_of::<c_float>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong)
252            .wrapping_mul(n_plus_m as ::std::os::raw::c_ulonglong) as ::std::os::raw::c_ulong,
253    ) as *mut c_float;
254    let ref mut fresh5 = (*s).sol;
255    *fresh5 = malloc(
256        (::std::mem::size_of::<c_float>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong)
257            .wrapping_mul(n_plus_m as ::std::os::raw::c_ulonglong) as ::std::os::raw::c_ulong,
258    ) as *mut c_float;
259    let ref mut fresh6 = (*s).rho_inv_vec;
260    *fresh6 = malloc(
261        (::std::mem::size_of::<c_float>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong)
262            .wrapping_mul(n_plus_m as ::std::os::raw::c_ulonglong) as ::std::os::raw::c_ulong,
263    ) as *mut c_float;
264    if polish != 0 {
265        i = 0 as ::std::os::raw::c_int as c_int;
266        while i < (*A).m {
267            *((*s).rho_inv_vec).offset(i as isize) = sigma;
268            i += 1;
269        }
270        let ref mut fresh7 = (*s).KKT;
271        *fresh7 = form_KKT(
272            P,
273            A,
274            1 as ::std::os::raw::c_int as c_int,
275            sigma,
276            (*s).rho_inv_vec,
277            OSQP_NULL as *mut c_int,
278            OSQP_NULL as *mut c_int,
279            OSQP_NULL as *mut *mut c_int,
280            OSQP_NULL as *mut c_int,
281            OSQP_NULL as *mut c_int,
282        );
283    } else {
284        let ref mut fresh8 = (*s).PtoKKT;
285        *fresh8 = malloc(
286            (*((*P).p).offset((*P).n as isize) as ::std::os::raw::c_ulonglong)
287                .wrapping_mul(
288                    ::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong,
289                ) as ::std::os::raw::c_ulong,
290        ) as *mut c_int;
291        let ref mut fresh9 = (*s).AtoKKT;
292        *fresh9 = malloc(
293            (*((*A).p).offset((*A).n as isize) as ::std::os::raw::c_ulonglong)
294                .wrapping_mul(
295                    ::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong,
296                ) as ::std::os::raw::c_ulong,
297        ) as *mut c_int;
298        let ref mut fresh10 = (*s).rhotoKKT;
299        *fresh10 = malloc(
300            ((*A).m as ::std::os::raw::c_ulonglong)
301                .wrapping_mul(
302                    ::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong,
303                ) as ::std::os::raw::c_ulong,
304        ) as *mut c_int;
305        i = 0 as ::std::os::raw::c_int as c_int;
306        while i < (*A).m {
307            *((*s).rho_inv_vec)
308                .offset(i as isize) = 1.0f64 / *rho_vec.offset(i as isize);
309            i += 1;
310        }
311        let ref mut fresh11 = (*s).KKT;
312        *fresh11 = form_KKT(
313            P,
314            A,
315            1 as ::std::os::raw::c_int as c_int,
316            sigma,
317            (*s).rho_inv_vec,
318            (*s).PtoKKT,
319            (*s).AtoKKT,
320            &mut (*s).Pdiag_idx,
321            &mut (*s).Pdiag_n,
322            (*s).rhotoKKT,
323        );
324    }
325    if ((*s).KKT).is_null() {
326        printf(
327            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
328            (*::std::mem::transmute::<
329                &[u8; 27],
330                &[::std::os::raw::c_char; 27],
331            >(b"init_linsys_solver_pardiso\0"))
332                .as_ptr(),
333        );
334        printf(b"Error in forming KKT matrix\0" as *const u8 as *const ::std::os::raw::c_char);
335        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
336        free_linsys_solver_pardiso(s);
337        return OSQP_LINSYS_SOLVER_INIT_ERROR as ::std::os::raw::c_int as c_int;
338    } else {
339        nnzKKT = *((*(*s).KKT).p).offset((*(*s).KKT).m as isize);
340        let ref mut fresh12 = (*s).KKT_i;
341        *fresh12 = malloc(
342            (nnzKKT as ::std::os::raw::c_ulonglong)
343                .wrapping_mul(
344                    ::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong,
345                ) as ::std::os::raw::c_ulong,
346        ) as *mut c_int;
347        let ref mut fresh13 = (*s).KKT_p;
348        *fresh13 = malloc(
349            (((*(*s).KKT).m + 1 as ::std::os::raw::c_int as ::std::os::raw::c_longlong) as ::std::os::raw::c_ulonglong)
350                .wrapping_mul(
351                    ::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong as ::std::os::raw::c_ulonglong,
352                ) as ::std::os::raw::c_ulong,
353        ) as *mut c_int;
354        i = 0 as ::std::os::raw::c_int as c_int;
355        while i < nnzKKT {
356            *((*s).KKT_i)
357                .offset(
358                    i as isize,
359                ) = *((*(*s).KKT).i).offset(i as isize)
360                + 1 as ::std::os::raw::c_int as ::std::os::raw::c_longlong;
361            i += 1;
362        }
363        i = 0 as ::std::os::raw::c_int as c_int;
364        while i < n_plus_m + 1 as ::std::os::raw::c_int as ::std::os::raw::c_longlong {
365            *((*s).KKT_p)
366                .offset(
367                    i as isize,
368                ) = *((*(*s).KKT).p).offset(i as isize)
369                + 1 as ::std::os::raw::c_int as ::std::os::raw::c_longlong;
370            i += 1;
371        }
372    }
373    mkl_set_interface_layer(MKL_INTERFACE_ILP64 as c_int);
374    (*s).mtype = -(2 as ::std::os::raw::c_int) as c_int;
375    (*s).nrhs = 1 as ::std::os::raw::c_int as c_int;
376    (*s).maxfct = 1 as ::std::os::raw::c_int as c_int;
377    (*s).mnum = 1 as ::std::os::raw::c_int as c_int;
378    (*s).msglvl = 0 as ::std::os::raw::c_int as c_int;
379    (*s).error = 0 as ::std::os::raw::c_int as c_int;
380    i = 0 as ::std::os::raw::c_int as c_int;
381    while i < 64 as ::std::os::raw::c_int as ::std::os::raw::c_longlong {
382        (*s).iparm[i as usize] = 0 as ::std::os::raw::c_int as c_int;
383        let ref mut fresh14 = (*s).pt[i as usize];
384        *fresh14 = 0 as *mut ::std::os::raw::c_void;
385        i += 1;
386    }
387    (*s).iparm[0 as ::std::os::raw::c_int as usize] = 1 as ::std::os::raw::c_int as c_int;
388    (*s).iparm[1 as ::std::os::raw::c_int as usize] = 3 as ::std::os::raw::c_int as c_int;
389    if polish != 0 {
390        (*s).iparm[5 as ::std::os::raw::c_int as usize] = 1 as ::std::os::raw::c_int as c_int;
391    } else {
392        (*s).iparm[5 as ::std::os::raw::c_int as usize] = 0 as ::std::os::raw::c_int as c_int;
393    }
394    (*s).iparm[7 as ::std::os::raw::c_int as usize] = 0 as ::std::os::raw::c_int as c_int;
395    (*s).iparm[9 as ::std::os::raw::c_int as usize] = 13 as ::std::os::raw::c_int as c_int;
396    (*s).iparm[34 as ::std::os::raw::c_int as usize] = 0 as ::std::os::raw::c_int as c_int;
397    (*s).nthreads = mkl_get_max_threads();
398    (*s).phase = PARDISO_SYMBOLIC as c_int;
399    pardiso(
400        ((*s).pt).as_mut_ptr(),
401        &mut (*s).maxfct,
402        &mut (*s).mnum,
403        &mut (*s).mtype,
404        &mut (*s).phase,
405        &mut (*s).nKKT,
406        (*(*s).KKT).x,
407        (*s).KKT_p,
408        (*s).KKT_i,
409        &mut (*s).idum,
410        &mut (*s).nrhs,
411        ((*s).iparm).as_mut_ptr(),
412        &mut (*s).msglvl,
413        &mut (*s).fdum,
414        &mut (*s).fdum,
415        &mut (*s).error,
416    );
417    if (*s).error != 0 as ::std::os::raw::c_int as ::std::os::raw::c_longlong {
418        printf(
419            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
420            (*::std::mem::transmute::<
421                &[u8; 27],
422                &[::std::os::raw::c_char; 27],
423            >(b"init_linsys_solver_pardiso\0"))
424                .as_ptr(),
425        );
426        printf(
427            b"Error during symbolic factorization: %d\0" as *const u8
428                as *const ::std::os::raw::c_char,
429            (*s).error as ::std::os::raw::c_int,
430        );
431        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
432        free_linsys_solver_pardiso(s);
433        *sp = OSQP_NULL as *mut pardiso_solver;
434        return OSQP_LINSYS_SOLVER_INIT_ERROR as ::std::os::raw::c_int as c_int;
435    }
436    (*s).phase = PARDISO_NUMERIC as c_int;
437    pardiso(
438        ((*s).pt).as_mut_ptr(),
439        &mut (*s).maxfct,
440        &mut (*s).mnum,
441        &mut (*s).mtype,
442        &mut (*s).phase,
443        &mut (*s).nKKT,
444        (*(*s).KKT).x,
445        (*s).KKT_p,
446        (*s).KKT_i,
447        &mut (*s).idum,
448        &mut (*s).nrhs,
449        ((*s).iparm).as_mut_ptr(),
450        &mut (*s).msglvl,
451        &mut (*s).fdum,
452        &mut (*s).fdum,
453        &mut (*s).error,
454    );
455    if (*s).error != 0 {
456        printf(
457            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
458            (*::std::mem::transmute::<
459                &[u8; 27],
460                &[::std::os::raw::c_char; 27],
461            >(b"init_linsys_solver_pardiso\0"))
462                .as_ptr(),
463        );
464        printf(
465            b"Error during numerical factorization: %d\0" as *const u8
466                as *const ::std::os::raw::c_char,
467            (*s).error as ::std::os::raw::c_int,
468        );
469        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
470        free_linsys_solver_pardiso(s);
471        *sp = OSQP_NULL as *mut pardiso_solver;
472        return OSQP_LINSYS_SOLVER_INIT_ERROR as ::std::os::raw::c_int as c_int;
473    }
474    return 0 as ::std::os::raw::c_int as c_int;
475}
476#[no_mangle]
477pub unsafe extern "C" fn solve_linsys_pardiso(
478    mut s: *mut pardiso_solver,
479    mut b: *mut c_float,
480) -> c_int {
481    let mut j: c_int = 0;
482    (*s).phase = PARDISO_SOLVE as c_int;
483    pardiso(
484        ((*s).pt).as_mut_ptr(),
485        &mut (*s).maxfct,
486        &mut (*s).mnum,
487        &mut (*s).mtype,
488        &mut (*s).phase,
489        &mut (*s).nKKT,
490        (*(*s).KKT).x,
491        (*s).KKT_p,
492        (*s).KKT_i,
493        &mut (*s).idum,
494        &mut (*s).nrhs,
495        ((*s).iparm).as_mut_ptr(),
496        &mut (*s).msglvl,
497        b,
498        (*s).sol,
499        &mut (*s).error,
500    );
501    if (*s).error != 0 as ::std::os::raw::c_int as ::std::os::raw::c_longlong {
502        printf(
503            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
504            (*::std::mem::transmute::<
505                &[u8; 21],
506                &[::std::os::raw::c_char; 21],
507            >(b"solve_linsys_pardiso\0"))
508                .as_ptr(),
509        );
510        printf(
511            b"Error during linear system solution: %d\0" as *const u8
512                as *const ::std::os::raw::c_char,
513            (*s).error as ::std::os::raw::c_int,
514        );
515        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
516        return 1 as ::std::os::raw::c_int as c_int;
517    }
518    if (*s).polish == 0 {
519        j = 0 as ::std::os::raw::c_int as c_int;
520        while j < (*s).n {
521            *b.offset(j as isize) = *((*s).sol).offset(j as isize);
522            j += 1;
523        }
524        j = 0 as ::std::os::raw::c_int as c_int;
525        while j < (*s).m {
526            let ref mut fresh15 = *b.offset((j + (*s).n) as isize);
527            *fresh15
528                += *((*s).rho_inv_vec).offset(j as isize)
529                    * *((*s).sol).offset((j + (*s).n) as isize);
530            j += 1;
531        }
532    }
533    return 0 as ::std::os::raw::c_int as c_int;
534}
535#[no_mangle]
536pub unsafe extern "C" fn update_linsys_solver_matrices_pardiso(
537    mut s: *mut pardiso_solver,
538    mut P: *const csc,
539    mut A: *const csc,
540) -> c_int {
541    update_KKT_P((*s).KKT, P, (*s).PtoKKT, (*s).sigma, (*s).Pdiag_idx, (*s).Pdiag_n);
542    update_KKT_A((*s).KKT, A, (*s).AtoKKT);
543    (*s).phase = PARDISO_NUMERIC as c_int;
544    pardiso(
545        ((*s).pt).as_mut_ptr(),
546        &mut (*s).maxfct,
547        &mut (*s).mnum,
548        &mut (*s).mtype,
549        &mut (*s).phase,
550        &mut (*s).nKKT,
551        (*(*s).KKT).x,
552        (*s).KKT_p,
553        (*s).KKT_i,
554        &mut (*s).idum,
555        &mut (*s).nrhs,
556        ((*s).iparm).as_mut_ptr(),
557        &mut (*s).msglvl,
558        &mut (*s).fdum,
559        &mut (*s).fdum,
560        &mut (*s).error,
561    );
562    return (*s).error;
563}
564#[no_mangle]
565pub unsafe extern "C" fn update_linsys_solver_rho_vec_pardiso(
566    mut s: *mut pardiso_solver,
567    mut rho_vec: *const c_float,
568) -> c_int {
569    let mut i: c_int = 0;
570    i = 0 as ::std::os::raw::c_int as c_int;
571    while i < (*s).m {
572        *((*s).rho_inv_vec).offset(i as isize) = 1.0f64 / *rho_vec.offset(i as isize);
573        i += 1;
574    }
575    update_KKT_param2((*s).KKT, (*s).rho_inv_vec, (*s).rhotoKKT, (*s).m);
576    (*s).phase = PARDISO_NUMERIC as c_int;
577    pardiso(
578        ((*s).pt).as_mut_ptr(),
579        &mut (*s).maxfct,
580        &mut (*s).mnum,
581        &mut (*s).mtype,
582        &mut (*s).phase,
583        &mut (*s).nKKT,
584        (*(*s).KKT).x,
585        (*s).KKT_p,
586        (*s).KKT_i,
587        &mut (*s).idum,
588        &mut (*s).nrhs,
589        ((*s).iparm).as_mut_ptr(),
590        &mut (*s).msglvl,
591        &mut (*s).fdum,
592        &mut (*s).fdum,
593        &mut (*s).error,
594    );
595    return (*s).error;
596}