You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: reg.rs
    path of file: ./repos/Peroxide/src/ml
    
    the code of the file until where you have to start completion: use crate::structure::polynomial::Polynomial;

/// Simple Least Square 2D
///
/// # Type
///
/// `(Vec<f64>, Vec<f64>) -> Polynomial`
///
/// # Examples
/// ```
/// #[macro_use]
/// extern crate peroxide;
/// use peroxide::fuga::*;
///
/// fn main() {
///     let a = c!(1,2,3,4,5);
/// 
    
pub fn least_square(node_x: Vec<f64>, node_y: Vec<f64>) -> Polynomial {
    let l = node_x.len();
    assert_eq!(l, node_y.len());

    let mut x_bar = 0f64;
    let mut t_bar = 0f64;
    let mut xt_bar = 0f64;
    let mut x_sq_bar = 0f64;
    for i in 0..l {
        let x = node_x[i];
        let t = node_y[i];

        x_bar += x;
        t_bar += t;
        xt_bar += x * t;
        x_sq_bar += x * x;
    }
    x_bar /= l as f64;
    t_bar /= l as f64;
    xt_bar /= l as f64;
    x_sq_bar /= l as f64;

    let x_bar_sq = x_bar.clone() * x_bar.clone();
    let x_bar_t_bar = x_bar.clone() * t_bar.clone();

    let w1 = (xt_bar - x_bar_t_bar) / (x_sq_bar - x_bar_sq);
    let w0 = t_bar - w1 * x_bar;

    Polynomial::new(vec![w1, w0])
}