1pub const LIBSVM_VERSION: u32 = 325;
4extern "C" {
5 pub static mut libsvm_version: ::std::os::raw::c_int;
6}
7#[repr(C)]
8#[derive(Debug, Copy, Clone)]
9pub struct svm_node {
10 pub index: ::std::os::raw::c_int,
11 pub value: f64,
12}
13#[test]
14fn bindgen_test_layout_svm_node() {
15 assert_eq!(
16 ::std::mem::size_of::<svm_node>(),
17 16usize,
18 concat!("Size of: ", stringify!(svm_node))
19 );
20 assert_eq!(
21 ::std::mem::align_of::<svm_node>(),
22 8usize,
23 concat!("Alignment of ", stringify!(svm_node))
24 );
25 assert_eq!(
26 unsafe { &(*(::std::ptr::null::<svm_node>())).index as *const _ as usize },
27 0usize,
28 concat!(
29 "Offset of field: ",
30 stringify!(svm_node),
31 "::",
32 stringify!(index)
33 )
34 );
35 assert_eq!(
36 unsafe { &(*(::std::ptr::null::<svm_node>())).value as *const _ as usize },
37 8usize,
38 concat!(
39 "Offset of field: ",
40 stringify!(svm_node),
41 "::",
42 stringify!(value)
43 )
44 );
45}
46#[repr(C)]
47#[derive(Debug, Copy, Clone)]
48pub struct svm_problem {
49 pub l: ::std::os::raw::c_int,
50 pub y: *mut f64,
51 pub x: *mut *mut svm_node,
52}
53#[test]
54fn bindgen_test_layout_svm_problem() {
55 assert_eq!(
56 ::std::mem::size_of::<svm_problem>(),
57 24usize,
58 concat!("Size of: ", stringify!(svm_problem))
59 );
60 assert_eq!(
61 ::std::mem::align_of::<svm_problem>(),
62 8usize,
63 concat!("Alignment of ", stringify!(svm_problem))
64 );
65 assert_eq!(
66 unsafe { &(*(::std::ptr::null::<svm_problem>())).l as *const _ as usize },
67 0usize,
68 concat!(
69 "Offset of field: ",
70 stringify!(svm_problem),
71 "::",
72 stringify!(l)
73 )
74 );
75 assert_eq!(
76 unsafe { &(*(::std::ptr::null::<svm_problem>())).y as *const _ as usize },
77 8usize,
78 concat!(
79 "Offset of field: ",
80 stringify!(svm_problem),
81 "::",
82 stringify!(y)
83 )
84 );
85 assert_eq!(
86 unsafe { &(*(::std::ptr::null::<svm_problem>())).x as *const _ as usize },
87 16usize,
88 concat!(
89 "Offset of field: ",
90 stringify!(svm_problem),
91 "::",
92 stringify!(x)
93 )
94 );
95}
96pub const C_SVC: ::std::os::raw::c_uint = 0;
97pub const NU_SVC: ::std::os::raw::c_uint = 1;
98pub const ONE_CLASS: ::std::os::raw::c_uint = 2;
99pub const EPSILON_SVR: ::std::os::raw::c_uint = 3;
100pub const NU_SVR: ::std::os::raw::c_uint = 4;
101pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
102pub const LINEAR: ::std::os::raw::c_uint = 0;
103pub const POLY: ::std::os::raw::c_uint = 1;
104pub const RBF: ::std::os::raw::c_uint = 2;
105pub const SIGMOID: ::std::os::raw::c_uint = 3;
106pub const PRECOMPUTED: ::std::os::raw::c_uint = 4;
107pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
108#[repr(C)]
109#[derive(Debug, Copy, Clone)]
110pub struct svm_parameter {
111 pub svm_type: ::std::os::raw::c_int,
112 pub kernel_type: ::std::os::raw::c_int,
113 pub degree: ::std::os::raw::c_int,
114 pub gamma: f64,
115 pub coef0: f64,
116 pub cache_size: f64,
117 pub eps: f64,
118 pub C: f64,
119 pub nr_weight: ::std::os::raw::c_int,
120 pub weight_label: *mut ::std::os::raw::c_int,
121 pub weight: *mut f64,
122 pub nu: f64,
123 pub p: f64,
124 pub shrinking: ::std::os::raw::c_int,
125 pub probability: ::std::os::raw::c_int,
126}
127#[test]
128fn bindgen_test_layout_svm_parameter() {
129 assert_eq!(
130 ::std::mem::size_of::<svm_parameter>(),
131 104usize,
132 concat!("Size of: ", stringify!(svm_parameter))
133 );
134 assert_eq!(
135 ::std::mem::align_of::<svm_parameter>(),
136 8usize,
137 concat!("Alignment of ", stringify!(svm_parameter))
138 );
139 assert_eq!(
140 unsafe { &(*(::std::ptr::null::<svm_parameter>())).svm_type as *const _ as usize },
141 0usize,
142 concat!(
143 "Offset of field: ",
144 stringify!(svm_parameter),
145 "::",
146 stringify!(svm_type)
147 )
148 );
149 assert_eq!(
150 unsafe { &(*(::std::ptr::null::<svm_parameter>())).kernel_type as *const _ as usize },
151 4usize,
152 concat!(
153 "Offset of field: ",
154 stringify!(svm_parameter),
155 "::",
156 stringify!(kernel_type)
157 )
158 );
159 assert_eq!(
160 unsafe { &(*(::std::ptr::null::<svm_parameter>())).degree as *const _ as usize },
161 8usize,
162 concat!(
163 "Offset of field: ",
164 stringify!(svm_parameter),
165 "::",
166 stringify!(degree)
167 )
168 );
169 assert_eq!(
170 unsafe { &(*(::std::ptr::null::<svm_parameter>())).gamma as *const _ as usize },
171 16usize,
172 concat!(
173 "Offset of field: ",
174 stringify!(svm_parameter),
175 "::",
176 stringify!(gamma)
177 )
178 );
179 assert_eq!(
180 unsafe { &(*(::std::ptr::null::<svm_parameter>())).coef0 as *const _ as usize },
181 24usize,
182 concat!(
183 "Offset of field: ",
184 stringify!(svm_parameter),
185 "::",
186 stringify!(coef0)
187 )
188 );
189 assert_eq!(
190 unsafe { &(*(::std::ptr::null::<svm_parameter>())).cache_size as *const _ as usize },
191 32usize,
192 concat!(
193 "Offset of field: ",
194 stringify!(svm_parameter),
195 "::",
196 stringify!(cache_size)
197 )
198 );
199 assert_eq!(
200 unsafe { &(*(::std::ptr::null::<svm_parameter>())).eps as *const _ as usize },
201 40usize,
202 concat!(
203 "Offset of field: ",
204 stringify!(svm_parameter),
205 "::",
206 stringify!(eps)
207 )
208 );
209 assert_eq!(
210 unsafe { &(*(::std::ptr::null::<svm_parameter>())).C as *const _ as usize },
211 48usize,
212 concat!(
213 "Offset of field: ",
214 stringify!(svm_parameter),
215 "::",
216 stringify!(C)
217 )
218 );
219 assert_eq!(
220 unsafe { &(*(::std::ptr::null::<svm_parameter>())).nr_weight as *const _ as usize },
221 56usize,
222 concat!(
223 "Offset of field: ",
224 stringify!(svm_parameter),
225 "::",
226 stringify!(nr_weight)
227 )
228 );
229 assert_eq!(
230 unsafe { &(*(::std::ptr::null::<svm_parameter>())).weight_label as *const _ as usize },
231 64usize,
232 concat!(
233 "Offset of field: ",
234 stringify!(svm_parameter),
235 "::",
236 stringify!(weight_label)
237 )
238 );
239 assert_eq!(
240 unsafe { &(*(::std::ptr::null::<svm_parameter>())).weight as *const _ as usize },
241 72usize,
242 concat!(
243 "Offset of field: ",
244 stringify!(svm_parameter),
245 "::",
246 stringify!(weight)
247 )
248 );
249 assert_eq!(
250 unsafe { &(*(::std::ptr::null::<svm_parameter>())).nu as *const _ as usize },
251 80usize,
252 concat!(
253 "Offset of field: ",
254 stringify!(svm_parameter),
255 "::",
256 stringify!(nu)
257 )
258 );
259 assert_eq!(
260 unsafe { &(*(::std::ptr::null::<svm_parameter>())).p as *const _ as usize },
261 88usize,
262 concat!(
263 "Offset of field: ",
264 stringify!(svm_parameter),
265 "::",
266 stringify!(p)
267 )
268 );
269 assert_eq!(
270 unsafe { &(*(::std::ptr::null::<svm_parameter>())).shrinking as *const _ as usize },
271 96usize,
272 concat!(
273 "Offset of field: ",
274 stringify!(svm_parameter),
275 "::",
276 stringify!(shrinking)
277 )
278 );
279 assert_eq!(
280 unsafe { &(*(::std::ptr::null::<svm_parameter>())).probability as *const _ as usize },
281 100usize,
282 concat!(
283 "Offset of field: ",
284 stringify!(svm_parameter),
285 "::",
286 stringify!(probability)
287 )
288 );
289}
290#[repr(C)]
291#[derive(Debug, Copy, Clone)]
292pub struct svm_model {
293 pub param: svm_parameter,
294 pub nr_class: ::std::os::raw::c_int,
295 pub l: ::std::os::raw::c_int,
296 pub SV: *mut *mut svm_node,
297 pub sv_coef: *mut *mut f64,
298 pub rho: *mut f64,
299 pub probA: *mut f64,
300 pub probB: *mut f64,
301 pub sv_indices: *mut ::std::os::raw::c_int,
302 pub label: *mut ::std::os::raw::c_int,
303 pub nSV: *mut ::std::os::raw::c_int,
304 pub free_sv: ::std::os::raw::c_int,
305}
306#[test]
307fn bindgen_test_layout_svm_model() {
308 assert_eq!(
309 ::std::mem::size_of::<svm_model>(),
310 184usize,
311 concat!("Size of: ", stringify!(svm_model))
312 );
313 assert_eq!(
314 ::std::mem::align_of::<svm_model>(),
315 8usize,
316 concat!("Alignment of ", stringify!(svm_model))
317 );
318 assert_eq!(
319 unsafe { &(*(::std::ptr::null::<svm_model>())).param as *const _ as usize },
320 0usize,
321 concat!(
322 "Offset of field: ",
323 stringify!(svm_model),
324 "::",
325 stringify!(param)
326 )
327 );
328 assert_eq!(
329 unsafe { &(*(::std::ptr::null::<svm_model>())).nr_class as *const _ as usize },
330 104usize,
331 concat!(
332 "Offset of field: ",
333 stringify!(svm_model),
334 "::",
335 stringify!(nr_class)
336 )
337 );
338 assert_eq!(
339 unsafe { &(*(::std::ptr::null::<svm_model>())).l as *const _ as usize },
340 108usize,
341 concat!(
342 "Offset of field: ",
343 stringify!(svm_model),
344 "::",
345 stringify!(l)
346 )
347 );
348 assert_eq!(
349 unsafe { &(*(::std::ptr::null::<svm_model>())).SV as *const _ as usize },
350 112usize,
351 concat!(
352 "Offset of field: ",
353 stringify!(svm_model),
354 "::",
355 stringify!(SV)
356 )
357 );
358 assert_eq!(
359 unsafe { &(*(::std::ptr::null::<svm_model>())).sv_coef as *const _ as usize },
360 120usize,
361 concat!(
362 "Offset of field: ",
363 stringify!(svm_model),
364 "::",
365 stringify!(sv_coef)
366 )
367 );
368 assert_eq!(
369 unsafe { &(*(::std::ptr::null::<svm_model>())).rho as *const _ as usize },
370 128usize,
371 concat!(
372 "Offset of field: ",
373 stringify!(svm_model),
374 "::",
375 stringify!(rho)
376 )
377 );
378 assert_eq!(
379 unsafe { &(*(::std::ptr::null::<svm_model>())).probA as *const _ as usize },
380 136usize,
381 concat!(
382 "Offset of field: ",
383 stringify!(svm_model),
384 "::",
385 stringify!(probA)
386 )
387 );
388 assert_eq!(
389 unsafe { &(*(::std::ptr::null::<svm_model>())).probB as *const _ as usize },
390 144usize,
391 concat!(
392 "Offset of field: ",
393 stringify!(svm_model),
394 "::",
395 stringify!(probB)
396 )
397 );
398 assert_eq!(
399 unsafe { &(*(::std::ptr::null::<svm_model>())).sv_indices as *const _ as usize },
400 152usize,
401 concat!(
402 "Offset of field: ",
403 stringify!(svm_model),
404 "::",
405 stringify!(sv_indices)
406 )
407 );
408 assert_eq!(
409 unsafe { &(*(::std::ptr::null::<svm_model>())).label as *const _ as usize },
410 160usize,
411 concat!(
412 "Offset of field: ",
413 stringify!(svm_model),
414 "::",
415 stringify!(label)
416 )
417 );
418 assert_eq!(
419 unsafe { &(*(::std::ptr::null::<svm_model>())).nSV as *const _ as usize },
420 168usize,
421 concat!(
422 "Offset of field: ",
423 stringify!(svm_model),
424 "::",
425 stringify!(nSV)
426 )
427 );
428 assert_eq!(
429 unsafe { &(*(::std::ptr::null::<svm_model>())).free_sv as *const _ as usize },
430 176usize,
431 concat!(
432 "Offset of field: ",
433 stringify!(svm_model),
434 "::",
435 stringify!(free_sv)
436 )
437 );
438}
439extern "C" {
440 pub fn svm_train(prob: *const svm_problem, param: *const svm_parameter) -> *mut svm_model;
441}
442extern "C" {
443 pub fn svm_cross_validation(
444 prob: *const svm_problem,
445 param: *const svm_parameter,
446 nr_fold: ::std::os::raw::c_int,
447 target: *mut f64,
448 );
449}
450extern "C" {
451 pub fn svm_save_model(
452 model_file_name: *const ::std::os::raw::c_char,
453 model: *const svm_model,
454 ) -> ::std::os::raw::c_int;
455}
456extern "C" {
457 pub fn svm_load_model(model_file_name: *const ::std::os::raw::c_char) -> *mut svm_model;
458}
459extern "C" {
460 pub fn svm_get_svm_type(model: *const svm_model) -> ::std::os::raw::c_int;
461}
462extern "C" {
463 pub fn svm_get_nr_class(model: *const svm_model) -> ::std::os::raw::c_int;
464}
465extern "C" {
466 pub fn svm_get_labels(model: *const svm_model, label: *mut ::std::os::raw::c_int);
467}
468extern "C" {
469 pub fn svm_get_sv_indices(model: *const svm_model, sv_indices: *mut ::std::os::raw::c_int);
470}
471extern "C" {
472 pub fn svm_get_nr_sv(model: *const svm_model) -> ::std::os::raw::c_int;
473}
474extern "C" {
475 pub fn svm_get_svr_probability(model: *const svm_model) -> f64;
476}
477extern "C" {
478 pub fn svm_predict_values(
479 model: *const svm_model,
480 x: *const svm_node,
481 dec_values: *mut f64,
482 ) -> f64;
483}
484extern "C" {
485 pub fn svm_predict(model: *const svm_model, x: *const svm_node) -> f64;
486}
487extern "C" {
488 pub fn svm_predict_probability(
489 model: *const svm_model,
490 x: *const svm_node,
491 prob_estimates: *mut f64,
492 ) -> f64;
493}
494extern "C" {
495 pub fn svm_free_model_content(model_ptr: *mut svm_model);
496}
497extern "C" {
498 pub fn svm_free_and_destroy_model(model_ptr_ptr: *mut *mut svm_model);
499}
500extern "C" {
501 pub fn svm_destroy_param(param: *mut svm_parameter);
502}
503extern "C" {
504 pub fn svm_check_parameter(
505 prob: *const svm_problem,
506 param: *const svm_parameter,
507 ) -> *const ::std::os::raw::c_char;
508}
509extern "C" {
510 pub fn svm_check_probability_model(model: *const svm_model) -> ::std::os::raw::c_int;
511}
512extern "C" {
513 pub fn svm_set_print_string_function(
514 print_func: ::std::option::Option<
515 unsafe extern "C" fn(arg1: *const ::std::os::raw::c_char),
516 >,
517 );
518}