23 lines
566 B
Rust
23 lines
566 B
Rust
use lll_rs::{matrix::Matrix as LLLMatrix, vector::BigVector};
|
|
|
|
use crate::matrix::Matrix;
|
|
|
|
impl Matrix {
|
|
pub fn to_lll_matrix(&self) -> LLLMatrix<BigVector> {
|
|
let n = self.n;
|
|
let mut lll_mat = LLLMatrix::init(n, n);
|
|
|
|
for row_idx in 0..n {
|
|
let mut elements = Vec::with_capacity(n);
|
|
|
|
for col_idx in 0..n {
|
|
let val = self[(row_idx, col_idx)].clone();
|
|
elements.push(val);
|
|
}
|
|
|
|
lll_mat[row_idx] = BigVector::from_vector(elements);
|
|
}
|
|
lll_mat
|
|
}
|
|
}
|