osqp_rust_sys/src32/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_int;
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_LP64: ::std::os::raw::c_int = 0 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;
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 {
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,
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)
252            .wrapping_mul(n_plus_m 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)
257            .wrapping_mul(n_plus_m 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)
262            .wrapping_mul(n_plus_m as ::std::os::raw::c_ulong),
263    ) as *mut c_float;
264    if polish != 0 {
265        i = 0 as ::std::os::raw::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,
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_ulong)
287                .wrapping_mul(::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong),
288        ) as *mut c_int;
289        let ref mut fresh9 = (*s).AtoKKT;
290        *fresh9 = malloc(
291            (*((*A).p).offset((*A).n as isize) as ::std::os::raw::c_ulong)
292                .wrapping_mul(::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong),
293        ) as *mut c_int;
294        let ref mut fresh10 = (*s).rhotoKKT;
295        *fresh10 = malloc(
296            ((*A).m as ::std::os::raw::c_ulong)
297                .wrapping_mul(::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong),
298        ) as *mut c_int;
299        i = 0 as ::std::os::raw::c_int;
300        while i < (*A).m {
301            *((*s).rho_inv_vec)
302                .offset(i as isize) = 1.0f64 / *rho_vec.offset(i as isize);
303            i += 1;
304        }
305        let ref mut fresh11 = (*s).KKT;
306        *fresh11 = form_KKT(
307            P,
308            A,
309            1 as ::std::os::raw::c_int,
310            sigma,
311            (*s).rho_inv_vec,
312            (*s).PtoKKT,
313            (*s).AtoKKT,
314            &mut (*s).Pdiag_idx,
315            &mut (*s).Pdiag_n,
316            (*s).rhotoKKT,
317        );
318    }
319    if ((*s).KKT).is_null() {
320        printf(
321            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
322            (*::std::mem::transmute::<
323                &[u8; 27],
324                &[::std::os::raw::c_char; 27],
325            >(b"init_linsys_solver_pardiso\0"))
326                .as_ptr(),
327        );
328        printf(b"Error in forming KKT matrix\0" as *const u8 as *const ::std::os::raw::c_char);
329        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
330        free_linsys_solver_pardiso(s);
331        return OSQP_LINSYS_SOLVER_INIT_ERROR as ::std::os::raw::c_int;
332    } else {
333        nnzKKT = *((*(*s).KKT).p).offset((*(*s).KKT).m as isize);
334        let ref mut fresh12 = (*s).KKT_i;
335        *fresh12 = malloc(
336            (nnzKKT as ::std::os::raw::c_ulong)
337                .wrapping_mul(::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong),
338        ) as *mut c_int;
339        let ref mut fresh13 = (*s).KKT_p;
340        *fresh13 = malloc(
341            (((*(*s).KKT).m + 1 as ::std::os::raw::c_int) as ::std::os::raw::c_ulong)
342                .wrapping_mul(::std::mem::size_of::<c_int>() as ::std::os::raw::c_ulong),
343        ) as *mut c_int;
344        i = 0 as ::std::os::raw::c_int;
345        while i < nnzKKT {
346            *((*s).KKT_i)
347                .offset(
348                    i as isize,
349                ) = *((*(*s).KKT).i).offset(i as isize) + 1 as ::std::os::raw::c_int;
350            i += 1;
351        }
352        i = 0 as ::std::os::raw::c_int;
353        while i < n_plus_m + 1 as ::std::os::raw::c_int {
354            *((*s).KKT_p)
355                .offset(
356                    i as isize,
357                ) = *((*(*s).KKT).p).offset(i as isize) + 1 as ::std::os::raw::c_int;
358            i += 1;
359        }
360    }
361    mkl_set_interface_layer(MKL_INTERFACE_LP64);
362    (*s).mtype = -(2 as ::std::os::raw::c_int);
363    (*s).nrhs = 1 as ::std::os::raw::c_int;
364    (*s).maxfct = 1 as ::std::os::raw::c_int;
365    (*s).mnum = 1 as ::std::os::raw::c_int;
366    (*s).msglvl = 0 as ::std::os::raw::c_int;
367    (*s).error = 0 as ::std::os::raw::c_int;
368    i = 0 as ::std::os::raw::c_int;
369    while i < 64 as ::std::os::raw::c_int {
370        (*s).iparm[i as usize] = 0 as ::std::os::raw::c_int;
371        let ref mut fresh14 = (*s).pt[i as usize];
372        *fresh14 = 0 as *mut ::std::os::raw::c_void;
373        i += 1;
374    }
375    (*s).iparm[0 as ::std::os::raw::c_int as usize] = 1 as ::std::os::raw::c_int;
376    (*s).iparm[1 as ::std::os::raw::c_int as usize] = 3 as ::std::os::raw::c_int;
377    if polish != 0 {
378        (*s).iparm[5 as ::std::os::raw::c_int as usize] = 1 as ::std::os::raw::c_int;
379    } else {
380        (*s).iparm[5 as ::std::os::raw::c_int as usize] = 0 as ::std::os::raw::c_int;
381    }
382    (*s).iparm[7 as ::std::os::raw::c_int as usize] = 0 as ::std::os::raw::c_int;
383    (*s).iparm[9 as ::std::os::raw::c_int as usize] = 13 as ::std::os::raw::c_int;
384    (*s).iparm[34 as ::std::os::raw::c_int as usize] = 0 as ::std::os::raw::c_int;
385    (*s).nthreads = mkl_get_max_threads();
386    (*s).phase = PARDISO_SYMBOLIC;
387    pardiso(
388        ((*s).pt).as_mut_ptr(),
389        &mut (*s).maxfct,
390        &mut (*s).mnum,
391        &mut (*s).mtype,
392        &mut (*s).phase,
393        &mut (*s).nKKT,
394        (*(*s).KKT).x,
395        (*s).KKT_p,
396        (*s).KKT_i,
397        &mut (*s).idum,
398        &mut (*s).nrhs,
399        ((*s).iparm).as_mut_ptr(),
400        &mut (*s).msglvl,
401        &mut (*s).fdum,
402        &mut (*s).fdum,
403        &mut (*s).error,
404    );
405    if (*s).error != 0 as ::std::os::raw::c_int {
406        printf(
407            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
408            (*::std::mem::transmute::<
409                &[u8; 27],
410                &[::std::os::raw::c_char; 27],
411            >(b"init_linsys_solver_pardiso\0"))
412                .as_ptr(),
413        );
414        printf(
415            b"Error during symbolic factorization: %d\0" as *const u8
416                as *const ::std::os::raw::c_char,
417            (*s).error,
418        );
419        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
420        free_linsys_solver_pardiso(s);
421        *sp = OSQP_NULL as *mut pardiso_solver;
422        return OSQP_LINSYS_SOLVER_INIT_ERROR as ::std::os::raw::c_int;
423    }
424    (*s).phase = PARDISO_NUMERIC;
425    pardiso(
426        ((*s).pt).as_mut_ptr(),
427        &mut (*s).maxfct,
428        &mut (*s).mnum,
429        &mut (*s).mtype,
430        &mut (*s).phase,
431        &mut (*s).nKKT,
432        (*(*s).KKT).x,
433        (*s).KKT_p,
434        (*s).KKT_i,
435        &mut (*s).idum,
436        &mut (*s).nrhs,
437        ((*s).iparm).as_mut_ptr(),
438        &mut (*s).msglvl,
439        &mut (*s).fdum,
440        &mut (*s).fdum,
441        &mut (*s).error,
442    );
443    if (*s).error != 0 {
444        printf(
445            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
446            (*::std::mem::transmute::<
447                &[u8; 27],
448                &[::std::os::raw::c_char; 27],
449            >(b"init_linsys_solver_pardiso\0"))
450                .as_ptr(),
451        );
452        printf(
453            b"Error during numerical factorization: %d\0" as *const u8
454                as *const ::std::os::raw::c_char,
455            (*s).error,
456        );
457        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
458        free_linsys_solver_pardiso(s);
459        *sp = OSQP_NULL as *mut pardiso_solver;
460        return OSQP_LINSYS_SOLVER_INIT_ERROR as ::std::os::raw::c_int;
461    }
462    return 0 as ::std::os::raw::c_int;
463}
464#[no_mangle]
465pub unsafe extern "C" fn solve_linsys_pardiso(
466    mut s: *mut pardiso_solver,
467    mut b: *mut c_float,
468) -> c_int {
469    let mut j: c_int = 0;
470    (*s).phase = PARDISO_SOLVE;
471    pardiso(
472        ((*s).pt).as_mut_ptr(),
473        &mut (*s).maxfct,
474        &mut (*s).mnum,
475        &mut (*s).mtype,
476        &mut (*s).phase,
477        &mut (*s).nKKT,
478        (*(*s).KKT).x,
479        (*s).KKT_p,
480        (*s).KKT_i,
481        &mut (*s).idum,
482        &mut (*s).nrhs,
483        ((*s).iparm).as_mut_ptr(),
484        &mut (*s).msglvl,
485        b,
486        (*s).sol,
487        &mut (*s).error,
488    );
489    if (*s).error != 0 as ::std::os::raw::c_int {
490        printf(
491            b"ERROR in %s: \0" as *const u8 as *const ::std::os::raw::c_char,
492            (*::std::mem::transmute::<
493                &[u8; 21],
494                &[::std::os::raw::c_char; 21],
495            >(b"solve_linsys_pardiso\0"))
496                .as_ptr(),
497        );
498        printf(
499            b"Error during linear system solution: %d\0" as *const u8
500                as *const ::std::os::raw::c_char,
501            (*s).error,
502        );
503        printf(b"\n\0" as *const u8 as *const ::std::os::raw::c_char);
504        return 1 as ::std::os::raw::c_int;
505    }
506    if (*s).polish == 0 {
507        j = 0 as ::std::os::raw::c_int;
508        while j < (*s).n {
509            *b.offset(j as isize) = *((*s).sol).offset(j as isize);
510            j += 1;
511        }
512        j = 0 as ::std::os::raw::c_int;
513        while j < (*s).m {
514            let ref mut fresh15 = *b.offset((j + (*s).n) as isize);
515            *fresh15
516                += *((*s).rho_inv_vec).offset(j as isize)
517                    * *((*s).sol).offset((j + (*s).n) as isize);
518            j += 1;
519        }
520    }
521    return 0 as ::std::os::raw::c_int;
522}
523#[no_mangle]
524pub unsafe extern "C" fn update_linsys_solver_matrices_pardiso(
525    mut s: *mut pardiso_solver,
526    mut P: *const csc,
527    mut A: *const csc,
528) -> c_int {
529    update_KKT_P((*s).KKT, P, (*s).PtoKKT, (*s).sigma, (*s).Pdiag_idx, (*s).Pdiag_n);
530    update_KKT_A((*s).KKT, A, (*s).AtoKKT);
531    (*s).phase = PARDISO_NUMERIC;
532    pardiso(
533        ((*s).pt).as_mut_ptr(),
534        &mut (*s).maxfct,
535        &mut (*s).mnum,
536        &mut (*s).mtype,
537        &mut (*s).phase,
538        &mut (*s).nKKT,
539        (*(*s).KKT).x,
540        (*s).KKT_p,
541        (*s).KKT_i,
542        &mut (*s).idum,
543        &mut (*s).nrhs,
544        ((*s).iparm).as_mut_ptr(),
545        &mut (*s).msglvl,
546        &mut (*s).fdum,
547        &mut (*s).fdum,
548        &mut (*s).error,
549    );
550    return (*s).error;
551}
552#[no_mangle]
553pub unsafe extern "C" fn update_linsys_solver_rho_vec_pardiso(
554    mut s: *mut pardiso_solver,
555    mut rho_vec: *const c_float,
556) -> c_int {
557    let mut i: c_int = 0;
558    i = 0 as ::std::os::raw::c_int;
559    while i < (*s).m {
560        *((*s).rho_inv_vec).offset(i as isize) = 1.0f64 / *rho_vec.offset(i as isize);
561        i += 1;
562    }
563    update_KKT_param2((*s).KKT, (*s).rho_inv_vec, (*s).rhotoKKT, (*s).m);
564    (*s).phase = PARDISO_NUMERIC;
565    pardiso(
566        ((*s).pt).as_mut_ptr(),
567        &mut (*s).maxfct,
568        &mut (*s).mnum,
569        &mut (*s).mtype,
570        &mut (*s).phase,
571        &mut (*s).nKKT,
572        (*(*s).KKT).x,
573        (*s).KKT_p,
574        (*s).KKT_i,
575        &mut (*s).idum,
576        &mut (*s).nrhs,
577        ((*s).iparm).as_mut_ptr(),
578        &mut (*s).msglvl,
579        &mut (*s).fdum,
580        &mut (*s).fdum,
581        &mut (*s).error,
582    );
583    return (*s).error;
584}