mop_structs/doc_tests.rs
1//! Instances for documentation tests.
2
3use crate::matrix::csr_matrix::CsrMatrixArray;
4use crate::matrix::csr_matrix::CsrMatrixVecArray;
5use crate::matrix::dr_matrix::DrMatrixArray;
6use crate::matrix::dr_matrix::DrMatrixVecArray;
7use crate::vec::css::CssArray;
8use crate::vec::VecArray;
9
10/// ```rust
11/// // _______________________________________
12/// // | | 1 | | 2 | | | | | | 3 |
13/// // | | | | | | | | | | |
14/// // ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
15/// ```
16pub fn css_array() -> CssArray<[i32; 3], [usize; 3]> {
17 CssArray::new(10, [1, 2, 3], [1, 3, 9])
18}
19
20/// Empty matrix with 5 columns. Supports maximum of 5 values and 4 rows.
21pub fn csr_matrix_empty_vec_array() -> CsrMatrixVecArray<[i32; 5], [usize; 5]> {
22 CsrMatrixVecArray::with_vec_array(5)
23}
24
25/// ```rust
26/// // ___________________
27/// // | 1 | | 2 | | |
28/// // |___|___|___|___|___|
29/// // | | 3 | | 4 | |
30/// // |___|___|___|___|___|
31/// // | | | | | |
32/// // |___|___|___|___|___|
33/// // | | | | | 5 |
34/// // | | | | | |
35/// // ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
36/// ```
37pub fn csr_matrix_array() -> CsrMatrixArray<[i32; 5], [usize; 5]> {
38 CsrMatrixArray::new([4, 5], [1, 2, 3, 4, 5], [0, 2, 1, 3, 4], [0, 2, 4, 4, 5])
39}
40
41/// Empty matrix with 5 columns. Supports maximum of 20 values and 4 rows.
42pub fn dr_matrix_empty_vec_array() -> DrMatrixVecArray<[i32; 20]> {
43 DrMatrixVecArray::with_vec_array(5)
44}
45
46/// ```rust
47/// // ___________________
48/// // | 1 | 2 | 3 | 4 | 5 |
49/// // |___|___|___|___|___|
50/// // | 6 | 7 | 8 | 9 | 10|
51/// // |___|___|___|___|___|
52/// // | 11| 12| 13| 14| 15|
53/// // |___|___|___|___|___|
54/// // | 16| 17| 18| 19| 20|
55/// // | | | | | |
56/// // ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
57/// ```
58pub fn dr_matrix_array() -> DrMatrixArray<[i32; 20]> {
59 DrMatrixArray::new(
60 [4, 5],
61 [
62 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
63 ],
64 )
65}
66
67/// ```rust
68/// // _______________________________________
69/// // | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10|
70/// // | | | | | | | | | | |
71/// // ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
72/// ```
73pub fn vec_array() -> VecArray<[i32; 16]> {
74 use crate::prelude::DynDenseStoMut;
75 let mut va = VecArray::<[i32; 16]>::with_capacity();
76 va.extend(&[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
77 va
78}