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
mod add;
#[cfg(feature = "nalgebral")]
mod add_nalgebra;
#[cfg(feature = "ndarrayl")]
mod add_ndarray;
mod add_vec;
mod conj;
#[cfg(feature = "nalgebral")]
mod conj_nalgebra;
#[cfg(feature = "ndarrayl")]
mod conj_ndarray;
mod conj_vec;
mod div;
#[cfg(feature = "nalgebral")]
mod div_nalgebra;
#[cfg(feature = "ndarrayl")]
mod div_ndarray;
mod div_vec;
mod dot;
#[cfg(feature = "nalgebral")]
mod dot_nalgebra;
#[cfg(feature = "ndarrayl")]
mod dot_ndarray;
mod dot_vec;
#[cfg(feature = "nalgebral")]
mod eye_nalgebra;
#[cfg(feature = "ndarrayl")]
mod eye_ndarray;
mod eye_vec;
#[cfg(feature = "nalgebral")]
mod inv_nalgebra;
#[cfg(feature = "ndarrayl")]
mod inv_ndarray;
mod mul;
#[cfg(feature = "nalgebral")]
mod mul_nalgebra;
#[cfg(feature = "ndarrayl")]
mod mul_ndarray;
mod mul_vec;
mod norm;
#[cfg(feature = "nalgebral")]
mod norm_nalgebra;
#[cfg(feature = "ndarrayl")]
mod norm_ndarray;
mod norm_vec;
mod scaledadd;
#[cfg(feature = "nalgebral")]
mod scaledadd_nalgebra;
#[cfg(feature = "ndarrayl")]
mod scaledadd_ndarray;
mod scaledadd_vec;
mod scaledsub;
#[cfg(feature = "nalgebral")]
mod scaledsub_nalgebra;
#[cfg(feature = "ndarrayl")]
mod scaledsub_ndarray;
mod scaledsub_vec;
mod sub;
#[cfg(feature = "nalgebral")]
mod sub_nalgebra;
#[cfg(feature = "ndarrayl")]
mod sub_ndarray;
mod sub_vec;
mod transpose;
#[cfg(feature = "nalgebral")]
mod transpose_nalgebra;
#[cfg(feature = "ndarrayl")]
mod transpose_ndarray;
mod transpose_vec;
mod weighteddot;
mod zero;
#[cfg(feature = "nalgebral")]
mod zero_nalgebra;
#[cfg(feature = "ndarrayl")]
mod zero_ndarray;
mod zero_vec;
mod random_vec;
mod minmax_vec;
pub use crate::core::math::add::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::add_ndarray::*;
pub use crate::core::math::add_vec::*;
pub use crate::core::math::conj::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::conj_ndarray::*;
pub use crate::core::math::conj_vec::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::div_ndarray::*;
pub use crate::core::math::dot::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::dot_ndarray::*;
pub use crate::core::math::dot_vec::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::eye_ndarray::*;
pub use crate::core::math::eye_vec::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::inv_ndarray::*;
pub use crate::core::math::mul::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::mul_ndarray::*;
pub use crate::core::math::mul_vec::*;
pub use crate::core::math::norm::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::norm_ndarray::*;
pub use crate::core::math::norm_vec::*;
pub use crate::core::math::scaledadd::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::scaledadd_ndarray::*;
pub use crate::core::math::scaledadd_vec::*;
pub use crate::core::math::scaledsub::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::scaledsub_ndarray::*;
pub use crate::core::math::scaledsub_vec::*;
pub use crate::core::math::sub::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::sub_ndarray::*;
pub use crate::core::math::sub_vec::*;
pub use crate::core::math::transpose::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::transpose_ndarray::*;
pub use crate::core::math::transpose_vec::*;
pub use crate::core::math::weighteddot::*;
pub use crate::core::math::zero::*;
#[cfg(feature = "ndarrayl")]
pub use crate::core::math::zero_ndarray::*;
pub use crate::core::math::zero_vec::*;
pub use crate::core::math::random_vec::*;
pub use crate::core::math::minmax_vec::*;
use crate::core::Error;
pub trait ArgminDot<T, U> {
fn dot(&self, other: &T) -> U;
}
pub trait ArgminWeightedDot<T, U, V> {
fn weighted_dot(&self, w: &V, vec: &T) -> U;
}
pub trait ArgminZero {
fn zero() -> Self;
}
pub trait ArgminConj {
fn conj(&self) -> Self;
}
pub trait ArgminZeroLike {
fn zero_like(&self) -> Self;
}
pub trait ArgminEye {
fn eye(n: usize) -> Self;
fn eye_like(&self) -> Self;
}
pub trait ArgminAdd<T, U> {
fn add(&self, other: &T) -> U;
}
pub trait ArgminSub<T, U> {
fn sub(&self, other: &T) -> U;
}
pub trait ArgminMul<T, U> {
fn mul(&self, other: &T) -> U;
}
pub trait ArgminDiv<T, U> {
fn div(&self, other: &T) -> U;
}
pub trait ArgminScaledAdd<T, U, V> {
fn scaled_add(&self, factor: &U, vec: &T) -> V;
}
pub trait ArgminScaledSub<T, U, V> {
fn scaled_sub(&self, factor: &U, vec: &T) -> V;
}
pub trait ArgminNorm<U> {
fn norm(&self) -> U;
}
pub trait ArgminTranspose<U> {
fn t(self) -> U;
}
pub trait ArgminInv<T> {
fn inv(&self) -> Result<T, Error>;
}
pub trait ArgminRandom {
fn rand_from_range(min: &Self, max: &Self) -> Self;
}
pub trait ArgminMinMax {
fn min(x: &Self, y: &Self) -> Self;
fn max(x: &Self, y: &Self) -> Self;
}