m4ri_sys/djb.rs
1//! Corresponds to djb.h
2use crate::misc::Rci;
3use crate::mzd::Mzd;
4
5#[repr(C)]
6pub struct Djb {
7 private: [u8; 0],
8}
9
10#[repr(C)]
11pub enum Srctyp {
12 /// Add from target matrix
13 SourceTarget,
14 /// Add from source matrix
15 SourceSource,
16}
17
18extern "C" {
19 /// Allocate a new DJB linear map
20 ///
21 /// nrows: number of rows
22 /// ncols: Number of columns
23 pub fn djb_init(nrows: Rci, ncols: Rci) -> *mut Djb;
24
25 /// free a DJB linear map
26 pub fn djb_free(m: *mut Djb);
27
28 /// Add a new operation ``out[target] ^= srctype[source]`` to queue
29 ///
30 /// z: DJB linear map
31 /// target: output index
32 /// source: input index
33 /// srctyp: Type of input (source_source or source_target)
34 pub fn djb_push_back(z: *mut Djb, target: Rci, source: Rci, srctyp: Srctyp);
35
36 /// Compile an new DJB linear map from A
37 ///
38 /// param: A
39 pub fn djb_compile(a: *mut Mzd) -> *mut Djb;
40
41 /// apply the linear map m to V and write the result in W
42 ///
43 /// z: DJB linear map
44 /// W: output matrix
45 /// V: input matrix
46 pub fn djb_apply_mzd(z: *mut Djb, w: *mut Mzd, v: *const Mzd);
47
48 /// Print information on linear map mA
49 pub fn djb_info(z: *const Djb);
50}