1 #ifndef RAW_MATRIX_U32_H_
2 #define RAW_MATRIX_U32_H_
3 
4 #include <stdint.h>
5 #include <stddef.h>
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 struct matrix_u32_s {
12     // input arguments.
13     const char * mfile;    // matrix file name
14     const char * bfile;    // balancing file name ; NULL will mean auto-detect
15     /* The 'transpose' flag just tells that the in-memory representation
16      * of the sparse matrix below is given by columns and not by rows.
17      * This is sometimes the format that is preferred by some MM layers,
18      * and cado-nfs decides to present the local matrices to the MM
19      * layers precisely in their preferred format.
20      */
21     int transpose;
22     int withcoeffs;
23     // output arguments.
24     uint32_t * p;
25     size_t size;
26 };
27 typedef struct matrix_u32_s matrix_u32[1];
28 typedef struct matrix_u32_s * matrix_u32_ptr;
29 
30 /* The interface around matrix_u32 is pretty thin, as this header defines
31  * no function...
32  */
33 /* Constructors:
34  *
35  * It's the entire responsibility of the caller. Structures of type
36  * matrix_u32 are to be created empty and zeroed out by the caller. The
37  * fields mfile and bfile are also expected from the caller.
38  */
39 /*
40  * Initialization:
41  *
42  * The main initializer function is balancing_get_matrix_u32 defined in
43  * balancing_workhorse.c
44  * Alternatively, there is also the random_matrix_get_u32 function,
45  * defined in random_matrix.c.
46  */
47 /*
48  * Destructors:
49  *
50  * There is no destructor function for this type. The global assumption
51  * is that the mm layer which is fed with this structure has the right to
52  * claim ownership of the data referenced from this structure. If it does
53  * not, then it is this layer's responsibility to release the memory. In
54  * a sense, matmul_build_cache *is* the destructor...
55  *
56  * To illustrate this, the layer mm_basic reuses (and in fact, also
57  * modifies) the m->p data, and thus it remains in memory.  In contrast,
58  * the bucket layer discards this data, as the post-processed matrix form
59  * is more efficient eventually.
60  */
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif	/* RAW_MATRIX_U32_H_ */
67