Skip to content

Commit c651032

Browse files
committed
rename struct and file
1 parent dd61aa4 commit c651032

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

src/convert.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use crate::gf2_matrix::GF2Matrix;
2-
use crate::int_gf2_matrix::{BitOrder, InterGF2Matrix};
2+
use crate::packed_gf2_matrix::{BitOrder, PackedGF2Matrix};
33
use crate::matrix::{Matrix, Number};
44

5-
impl<T: Number> From<&InterGF2Matrix<T>> for GF2Matrix {
6-
fn from(int_matrix: &InterGF2Matrix<T>) -> Self {
5+
impl<T: Number> From<&PackedGF2Matrix<T>> for GF2Matrix {
6+
fn from(int_matrix: &PackedGF2Matrix<T>) -> Self {
77
int_matrix.from_int_matrix_to_gf2_matrix(BitOrder::MSB)
88
}
99
}
1010

11-
impl<T: Number> From<InterGF2Matrix<T>> for GF2Matrix {
12-
fn from(int_matrix: InterGF2Matrix<T>) -> Self {
11+
impl<T: Number> From<PackedGF2Matrix<T>> for GF2Matrix {
12+
fn from(int_matrix: PackedGF2Matrix<T>) -> Self {
1313
int_matrix.from_int_matrix_to_gf2_matrix(BitOrder::MSB)
1414
}
1515
}
@@ -33,7 +33,7 @@ where
3333
}
3434
}
3535

36-
impl<T: Number> From<GF2Matrix> for InterGF2Matrix<T>
36+
impl<T: Number> From<GF2Matrix> for PackedGF2Matrix<T>
3737
where
3838
T: Number + From<usize>,
3939
{
@@ -47,7 +47,7 @@ where
4747
}
4848
}
4949

50-
impl<T: Number> From<&GF2Matrix> for InterGF2Matrix<T>
50+
impl<T: Number> From<&GF2Matrix> for PackedGF2Matrix<T>
5151
where
5252
T: Number + From<usize>,
5353
{
@@ -61,13 +61,13 @@ where
6161
}
6262
}
6363

64-
impl<T: Number> From<Vec<T>> for InterGF2Matrix<T> {
64+
impl<T: Number> From<Vec<T>> for PackedGF2Matrix<T> {
6565
fn from(value: Vec<T>) -> Self {
6666
Self::from_vec(value)
6767
}
6868
}
6969

70-
impl<T: Number> From<&Vec<T>> for InterGF2Matrix<T> {
70+
impl<T: Number> From<&Vec<T>> for PackedGF2Matrix<T> {
7171
fn from(value: &Vec<T>) -> Self {
7272
Self::from_vec_referenced(value)
7373
}
@@ -81,7 +81,7 @@ mod tests {
8181
#[test]
8282
fn test_int_mtrix_to_gf2_matrix_convertion() {
8383
let elements = vec![0, 1, 2, 4, 8];
84-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
84+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
8585
let gf2_matrix = GF2Matrix::from(int_matrix);
8686
let expected = vec![
8787
vec![0, 0, 0, 0],
@@ -92,15 +92,15 @@ mod tests {
9292
];
9393
assert_eq!(gf2_matrix.elements, expected);
9494

95-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
95+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
9696
let gf2_matrix: GF2Matrix = int_matrix.into();
9797
assert_eq!(gf2_matrix.elements, expected);
9898
}
9999

100100
#[test]
101101
fn test_int_mtrix_to_gf2_matrix_convertion_by_ref() {
102102
let elements = vec![0, 1, 2, 4, 8];
103-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
103+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
104104
let gf2_matrix = GF2Matrix::from(&int_matrix);
105105
let expected = vec![
106106
vec![0, 0, 0, 0],
@@ -111,7 +111,7 @@ mod tests {
111111
];
112112
assert_eq!(gf2_matrix.elements, expected);
113113

114-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
114+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
115115
let gf2_matrix: GF2Matrix = (&int_matrix).into();
116116
assert_eq!(gf2_matrix.elements, expected);
117117
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub mod gf2_matrix;
2-
pub mod int_gf2_matrix;
2+
pub mod packed_gf2_matrix;
33
pub mod matrix;
44
pub use gf2_matrix::GF2Matrix;
55
pub mod convert;
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum BitOrder {
1414
///
1515
/// This type is typically used as a compact or efficient
1616
/// representation before expanding into an explicit GF(2) matrix.
17-
pub struct InterGF2Matrix<T: Number> {
17+
pub struct PackedGF2Matrix<T: Number> {
1818
elements: Vec<T>,
1919
n: usize,
2020
}
@@ -37,7 +37,7 @@ pub struct InterGF2Matrix<T: Number> {
3737
// }
3838
// }
3939

40-
impl<T: Number> InterGF2Matrix<T> {
40+
impl<T: Number> PackedGF2Matrix<T> {
4141
/// Creates a new integer-encoded matrix.
4242
///
4343
/// # Arguments
@@ -48,9 +48,9 @@ impl<T: Number> InterGF2Matrix<T> {
4848
/// # Example
4949
///
5050
/// ```rust
51-
/// # use lin_algebra::int_gf2_matrix::InterGF2Matrix;
51+
/// # use lin_algebra::packed_gf2_matrix::PackedGF2Matrix;
5252
///
53-
/// let m = InterGF2Matrix::new(vec![0b1011u8, 0b0101u8], 4);
53+
/// let m = PackedGF2Matrix::new(vec![0b1011u8, 0b0101u8], 4);
5454
/// ```
5555
pub fn new(elements: Vec<T>, n: usize) -> Self {
5656
Self {
@@ -114,9 +114,9 @@ impl<T: Number> InterGF2Matrix<T> {
114114
/// # Example
115115
///
116116
/// ```rust
117-
/// # use lin_algebra::int_gf2_matrix::{InterGF2Matrix, BitOrder};
117+
/// # use lin_algebra::packed_gf2_matrix::{PackedGF2Matrix, BitOrder};
118118
///
119-
/// let m = InterGF2Matrix::new(vec![0b0010u8], 4);
119+
/// let m = PackedGF2Matrix::new(vec![0b0010u8], 4);
120120
/// let gf2 = m.from_int_matrix_to_gf2_matrix(BitOrder::LSB);
121121
///
122122
/// // Result: [[0, 1, 0, 0]]
@@ -171,7 +171,7 @@ mod tests {
171171
#[test]
172172
fn test_from_int_matrix_to_gf2_matrix_u8_lsb() {
173173
let elements = vec![0, 1, 2, 4, 8];
174-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
174+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
175175
let gf2_matrix = int_matrix.from_int_matrix_to_gf2_matrix(BitOrder::LSB);
176176
let expected = vec![
177177
vec![0, 0, 0, 0],
@@ -183,7 +183,7 @@ mod tests {
183183
assert_eq!(gf2_matrix.elements, expected);
184184

185185
let elements = vec![0, 1, 2, 3, 5];
186-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
186+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
187187
let gf2_matrix = int_matrix.from_int_matrix_to_gf2_matrix(BitOrder::LSB);
188188
let expected = vec![
189189
vec![0, 0, 0, 0],
@@ -198,7 +198,7 @@ mod tests {
198198
#[test]
199199
fn test_from_int_matrix_to_gf2_matrix_u8_msb() {
200200
let elements = vec![0, 1, 2, 4, 8];
201-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
201+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
202202
let gf2_matrix = int_matrix.from_int_matrix_to_gf2_matrix(BitOrder::MSB);
203203
let expected = vec![
204204
vec![0, 0, 0, 0],
@@ -210,7 +210,7 @@ mod tests {
210210
assert_eq!(gf2_matrix.elements, expected);
211211

212212
let elements = vec![0, 1, 2, 3, 5];
213-
let int_matrix = InterGF2Matrix::<u8>::new(elements.clone(), 4);
213+
let int_matrix = PackedGF2Matrix::<u8>::new(elements.clone(), 4);
214214
let gf2_matrix = int_matrix.from_int_matrix_to_gf2_matrix(BitOrder::MSB);
215215
let expected = vec![
216216
vec![0, 0, 0, 0],

0 commit comments

Comments
 (0)