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
//! Type aliases for linear combinations of rows and columns
//!
//! This module defines some [type aliases](https://doc.rust-lang.org/beta/reference/items/type-aliases.html) to help code from getting too verbose.
//!
use crate::;
/// Represents a linear combination of rows of a matrix
///
/// This is a [type alias](https://doc.rust-lang.org/beta/reference/items/type-aliases.html) for a
/// data structure that represents a linear combination of rows of a matrix of type `Matrix`
///
/// # Example
///
/// Here we construct a linear combination of rows, `u`, which has type [LinearCombinationOfRows].
///
/// ```
/// use oat_rust::algebra::matrices::types::{vec_of_vec::sorted::VecOfVec, packet::MatrixAlgebraPacket};
/// use oat_rust::algebra::rings::types::native::FieldFloat64;
/// use oat_rust::algebra::vectors::operations::VectorOperations;
///
/// // define inputs
/// let v = vec![ (0, 1.), (1, 1.), (2, 1.) ];
/// let data = vec![
/// vec![ (0, 1.), (1, 1.), (2, 1.) ],
/// vec![ (1, 1.), (2, 1.) ],
/// vec![ (2, 1.) ],
/// ];
/// let data = VecOfVec::new( data ).ok().unwrap();
/// let matrix = MatrixAlgebraPacket::with_default_order_and_f64_coefficients( &data );
///
/// // multiply
/// let u = v.multiply_self_as_a_row_vector_with_matrix( matrix );
///
/// // verify
/// assert!( u.eq( vec![ (0, 1.), (1, 2.), (2, 3.) ] ) );
/// ```
pub type LinearCombinationOfRows<
Matrix: MatrixAlgebra
>
= ;
/// Represents a linear combination of rows of a matrix, with entries appearing in **REVERSE** order
///
/// This is a [type alias](https://doc.rust-lang.org/beta/reference/items/type-aliases.html) for a
/// data structure that represents a linear combination of rows of a matrix of type `Matrix`;
/// the entries of the
///
/// # Example
///
/// Here we construct a linear combination of (reversed) rows, `u`, which has type [LinearCombinationOfRowsReverse].
///
/// ```
/// use oat_rust::algebra::matrices::types::{vec_of_vec::sorted::VecOfVec, packet::MatrixAlgebraPacket};
/// use oat_rust::algebra::rings::types::native::FieldFloat64;
/// use oat_rust::algebra::vectors::operations::VectorOperations;
/// use oat_rust::utilities::order::{OrderOperatorAuto, OrderOperatorByKey};
///
/// // define inputs
/// let v = vec![ (0, 1.), (1, 1.), (2, 1.) ];
/// let data = vec![
/// vec![ (0, 1.), (1, 1.), (2, 1.) ],
/// vec![ (1, 1.), (2, 1.) ],
/// vec![ (2, 1.) ],
/// ];
/// let data = VecOfVec::new( data ).ok().unwrap();
/// let matrix = MatrixAlgebraPacket::with_default_order_and_f64_coefficients( &data );
///
/// // multiply
/// let u = v.multiply_self_as_a_row_vector_with_matrix_and_return_entries_in_reverse_order( matrix );
///
/// // verify
/// assert!( u.eq( vec![ (2, 3.), (1, 2.), (0, 1.) ] ) );
/// ```
pub type LinearCombinationOfRowsReverse<
Matrix: MatrixAlgebra
>
= ;
/// Represents a linear combination of columns of a matrix
///
/// This is a [type alias](https://doc.rust-lang.org/beta/reference/items/type-aliases.html) for a
/// data structure that represents a linear combination of columns of a matrix of type `Matrix`
///
/// # Example
///
/// Here we construct a linear combination of columns, `u`, which has type [LinearCombinationOfColumns].
///
/// ```
/// use oat_rust::algebra::matrices::types::{vec_of_vec::sorted::VecOfVec, packet::MatrixAlgebraPacket};
/// use oat_rust::algebra::rings::types::native::FieldFloat64;
/// use oat_rust::algebra::vectors::operations::VectorOperations;
/// use oat_rust::utilities::order::{OrderOperatorAuto, OrderOperatorByKey};
///
/// // define inputs
/// let v = vec![ (0, 1.), (1, 1.), (2, 1.) ];
/// let data = vec![
/// vec![ (0, 1.), (1, 1.), (2, 1.) ],
/// vec![ (1, 1.), (2, 1.) ],
/// vec![ (2, 1.) ],
/// ];
/// let data = VecOfVec::new( data ).ok().unwrap();
/// let matrix = MatrixAlgebraPacket::with_default_order_and_f64_coefficients( &data );
///
/// // multiply
/// let u = v.multiply_self_as_a_column_vector_with_matrix( matrix );
///
/// // verify
/// assert!( u.eq( vec![ (0, 3.), (1, 2.), (2, 1.) ] ) );
/// ```
pub type LinearCombinationOfColumns<
Matrix: MatrixAlgebra
>
= ;
/// Represents a linear combination of columns of a matrix, with entries appearing in **REVERSE** order
///
/// This is a [type alias](https://doc.rust-lang.org/beta/reference/items/type-aliases.html) for a
/// data structure that represents a linear combination of columns of a matrix of type `Matrix`;
/// the entries of the resulting vector in **REVERSE** order.
///
/// # Example
///
/// Here we construct a linear combination of (reversed) columns, `u`, which has type [LinearCombinationOfRowsReverse].
///
/// ```
/// use oat_rust::algebra::matrices::types::{vec_of_vec::sorted::VecOfVec, packet::MatrixAlgebraPacket};
/// use oat_rust::algebra::rings::types::native::FieldFloat64;
/// use oat_rust::algebra::vectors::operations::VectorOperations;
/// use oat_rust::utilities::order::{OrderOperatorAuto, OrderOperatorByKey};
///
/// // define inputs
/// let v = vec![ (0, 1.), (1, 1.), (2, 1.) ];
/// let data = vec![
/// vec![ (0, 1.), (1, 1.), (2, 1.) ],
/// vec![ (1, 1.), (2, 1.) ],
/// vec![ (2, 1.) ],
/// ];
/// let data = VecOfVec::new( data ).ok().unwrap();
/// let matrix = MatrixAlgebraPacket::with_default_order_and_f64_coefficients( &data );
///
/// // multiply
/// let u = v.multiply_self_as_a_column_vector_with_matrix_and_return_entries_in_reverse_order( matrix );
///
/// // verify
/// assert!( u.eq( vec![ (2, 1.), (1, 2.), (0, 3.) ] ) );
/// ```
pub type LinearCombinationOfColumnsReverse<
Matrix: MatrixAlgebra
>
= ;