1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use *;
// TODO: Remove all these tests. Currently we keep them here in case we want to use them to test
// some similar functionality that we can port to nalgebra-sparse
// #[test]
// fn csr_from_diagonal() {
// let a = CsrMatrix::from_diagonal(&Vector3::new(2.0, -1.0, -4.0));
//
// let a_diag: Vec<_> = a.diag_iter().collect();
// let a_expected_diag = vec![2.0, -1.0, -4.0];
// assert_eq!(a.nnz(), 3);
// assert_eq!(a.nrows(), a.ncols());
// assert_eq!(a.nrows(), 3);
// assert_eq!(a_diag, a_expected_diag);
// }
// #[test]
// fn scale_rows_cols() {
// let a = DMatrix::from_row_slice(3, 3, &[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]);
// let a = CsrMatrix::from(&a);
//
// let d = DVector::from_column_slice(&[2.0, -4.0, 3.0]);
//
// // Scale rows
// {
// let mut a = a.clone();
// a.scale_rows(&d);
// let a_dense = a.build_dense();
// let a_expected = DMatrix::from_row_slice(
// 3,
// 3,
// &[2.0, 4.0, 6.0, -16.0, -20.0, -24.0, 21.0, 24.0, 27.0],
// );
// assert_approx_matrix_eq!(&a_dense, &a_expected, abstol = 1e-12);
// }
//
// // Scale cols
// {
// let mut a = a.clone();
// a.scale_cols(&d);
// let a_dense = a.build_dense();
// let a_expected =
// DMatrix::from_row_slice(3, 3, &[2.0, -8.0, 9.0, 8.0, -20.0, 18.0, 14.0, -32.0, 27.0]);
// assert_approx_matrix_eq!(&a_dense, &a_expected, abstol = 1e-12);
// }
// }
proptest!