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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
use ;
use *;
// ================================
//
// Vector Initialization
//
// ================================
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// Zero vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: i32 zero", |b| b.iter(|| Vector::<i32, 3>::zero()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: f64 zero", |b| b.iter(|| Vector::<f64, 3>::zero()));
// }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// i32 3D Vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: i32 3D from array", |b| {
// b.iter(|| Vector::<i32, 3>::from([1, 2, 3]))
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: i32 3D from iterator over array", |b| {
// b.iter(|| [1, 2, 3].into_iter().collect::<Vector<i32, 3>>())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: i32 3D from iterator over Vec", |b| {
// b.iter(|| vec![1, 2, 3].into_iter().collect::<Vector<i32, 3>>())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let arr = [1, 2, 3];
// let sli = &arr[..];
// c.bench_function("Vector Initialization: i32 3D from array slice", |b| {
// b.iter(|| Vector::<i32, 3>::try_from(sli).unwrap())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let vec = vec![1, 2, 3];
// let sli = &vec[..];
// c.bench_function("Vector Initialization: i32 3D from Vec slice", |b| {
// b.iter(|| Vector::<i32, 3>::try_from(sli).unwrap())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let vec = vec![1, 2, 3];
// c.bench_function("Vector Initialization: i32 3D from Vec ref", |b| {
// b.iter(|| Vector::<i32, 3>::try_from(&vec).unwrap())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// fn init_with_vec() {
// let vect = vec![1, 2, 3];
// let _: Vector<i32, 3> = Vector::try_from(black_box(vect)).unwrap();
// }
// c.bench_function("Vector Initialization: i32 3D from Vec", move |b| b.iter(|| init_with_vec()));
// }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// f64 3D Vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: f64 3D from array", |b| {
// b.iter(|| Vector::<f64, 3>::from([1.0, 2.0, 3.0]))
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: f64 3D from iterator over array", |b| {
// b.iter(|| [1.0, 2.0, 3.0].into_iter().collect::<Vector<f64, 3>>())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// c.bench_function("Vector Initialization: f64 3D from iterator over Vec", |b| {
// b.iter(|| vec![1.0, 2.0, 3.0].into_iter().collect::<Vector<f64, 3>>())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let arr = [1.0_f64, 2.0_f64, 3.0_f64];
// let sli = &arr[..];
// c.bench_function("Vector Initialization: f64 3D from array slice", |b| {
// b.iter(|| Vector::<f64, 3>::try_from(sli).unwrap())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let vec = vec![1.0_f64, 2.0_f64, 3.0_f64];
// let sli = &vec[..];
// c.bench_function("Vector Initialization: f64 3D from Vec slice", |b| {
// b.iter(|| Vector::<f64, 3>::try_from(sli).unwrap())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let vec = vec![1.0_f64, 2.0_f64, 3.0_f64];
// c.bench_function("Vector Initialization: f64 3D from Vec ref", |b| {
// b.iter(|| Vector::<f64, 3>::try_from(&vec).unwrap())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// fn init_with_vec() {
// let vect = vec![1.0_f64, 2.0_f64, 3.0_f64];
// let _: Vector<f64, 3> = Vector::try_from(black_box(vect)).unwrap();
// }
// c.bench_function("Vector Initialization: f64 3D from Vec", move |b| b.iter(|| init_with_vec()));
// }
// ================================
//
// Partial Eq relation testing
//
// ================================
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// i32 3D Vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// fn criterion_benchmark(c: &mut Criterion) {
// let v1: Vector<i32, 3> = Vector::from([1, 2, 3]);
// let v2: Vector<i32, 3> = Vector::from([1, 2, 3]);
// c.bench_function("PartialEq testing: i32 3D Vector : i32 3D Vector", |b| b.iter(|| v1 == v2));
// }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// f64 3D Vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// fn criterion_benchmark(c: &mut Criterion) {
// let v1: Vector<f64, 3> = Vector::from([1.0, 2.0, 3.0]);
// let v2: Vector<f64, 3> = Vector::from([1.0, 2.0, 3.0]);
// c.bench_function("PartialEq testing: f64 3D Vector : f64 3D Vector", |b| b.iter(|| v1 == v2));
// }
// ================================
//
// Method impl
//
// ================================
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<i32, 3> = Vector::from([1, -2, 3]);
// c.bench_function("Vector product method: i32 3D Vector", |b| b.iter(|| v.product()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 3> = Vector::from([1.0, -2.0, 3.0]);
// c.bench_function("Vector product method: f64 3D Vector", |b| b.iter(|| v.product()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 5> = Vector::from([1.0, -2.0, 3.0, 100.0, 24.0]);
// c.bench_function("Vector mean method: f32 5D Vector", |b| b.iter(|| v.mean()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 5> = Vector::from([1.0, -2.0, 3.0, 100.0, 24.0]);
// c.bench_function("Vector mean method: f64 5D Vector", |b| b.iter(|| v.mean()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 5> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0]);
// c.bench_function("Vector mean_geo method: f32 5D Vector", |b| b.iter(|| v.mean_geo()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 5> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0]);
// c.bench_function("Vector mean_geo method: f64 5D Vector", |b| b.iter(|| v.mean_geo()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 5> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0]);
// c.bench_function("Vector mean_harmonic method: f32 5D Vector", |b| {
// b.iter(|| v.mean_harmonic())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 5> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0]);
// c.bench_function("Vector mean_harmonic method: f64 5D Vector", |b| {
// b.iter(|| v.mean_harmonic())
// });
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector median method (even): f32 10D Vector", |b| b.iter(|| v.median()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 9> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0]);
// c.bench_function("Vector median method (odd): f32 10D Vector", |b| b.iter(|| v.median()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector median method (even): f64 10D Vector", |b| b.iter(|| v.median()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 9> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0]);
// c.bench_function("Vector median method (odd): f64 10D Vector", |b| b.iter(|| v.median()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector variance method: f32 10D Vector", |b| b.iter(|| v.variance(1.0)));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector variance method: f64 10D Vector", |b| b.iter(|| v.variance(1.0)));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector stddev method: f32 10D Vector", |b| b.iter(|| v.stddev(1.0)));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector stddev method: f64 10D Vector", |b| b.iter(|| v.stddev(1.0)));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<i32, 10> = Vector::from([1, 2, 3, 100, 24, 9, 72, 1, 52, 88]);
// c.bench_function("Vector min method: i32 10D Vector", |b| b.iter(|| v.min()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector min_fp method: f32 10D Vector", |b| b.iter(|| v.min_fp()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector min_fp method: f64 10D Vector", |b| b.iter(|| v.min_fp()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<i32, 10> = Vector::from([1, 2, 3, 100, 24, 9, 72, 1, 52, 88]);
// c.bench_function("Vector max method: i32 10D Vector", |b| b.iter(|| v.max()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f32, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector max_fp method: f32 10D Vector", |b| b.iter(|| v.max_fp()));
// }
// fn criterion_benchmark(c: &mut Criterion) {
// let v: Vector<f64, 10> = Vector::from([1.0, 2.0, 3.0, 100.0, 24.0, 9.0, 72.0, 1.0, 52.0, 88.0]);
// c.bench_function("Vector max_fp method: f64 10D Vector", |b| b.iter(|| v.max_fp()));
// }
criterion_group!;
criterion_main!;