Skip to content

Files

Latest commit

 

History

History

003_Practical_Machine_learning_Rust

Practical Machine Learning with Rust by Joydeep Bhattacharjee (Apress, 2020

Rust array(#[rustfmt::skip])

let s = [
    1, 2, 3, //
    4, 5, 6, //
    7, 8, 9, //
];


let matrix_2d = [
    [1, 2, 3], //
    [4, 5, 6], //
    [7, 8, 9], //
];

#[rustfmt::skip]
let matrix_2d = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];
#[rustfmt::skip]
let mat_mul = [
    [1],
    [2],
    [3]
];
  • 2d matrix sample
fn main() {
    let matrix_2d = [
        [1, 2, 3], //
        [4, 5, 6], //
        [7, 8, 9], //
    ];
    for mat_2d in matrix_2d {
        println!("{:?}", mat_2d);
    }
    println!();
}
  • Result
$ cargo r

[1, 2, 3]
[4, 5, 6]
[7, 8, 9]