rust矩阵运算--实例

#![allow(non_snake_case)]
// #[macro_use]
extern crate peroxide;
use peroxide::fuga::*;


// mod coeff;

fn main() {
    let vx1 = vec![1,2,3];
    let vx2 = vec![4,5,6];
    let mx1 = py_matrix(vec![vx1]);
    let mx2 = py_matrix(vec![vx2]);   
    mx1.print();
    mx2.print();

    let mx3 = &mx1 * &mx2.transpose(); // 矩阵乘法
    let mx4 = mx1.dot(&mx2);              // 矢量点乘
    mx3.print();
    mx4.print();
}
posted @ 2022-09-09 23:20  Nazorine  阅读(145)  评论(0)    收藏  举报