Question: use std::{ops, fmt}; #[derive(PartialEq, Debug)] pub struct Matrix { /// Stores elements in [row-major order](https://en.wikipedia.org/wiki/Row-major_order) data: Vec , /// Number of rows row: usize, ///
use std::{ops, fmt}; #[derive(PartialEq, Debug)] pub struct Matrix { /// Stores elements in [row-major order](https://en.wikipedia.org/wiki/Row-major_order) data: Vec, /// Number of rows row: usize, /// Number of columns col: usize, } impl Matrix { /// Creates a new matrix of `row` rows and `col` columns, and initializes /// the matrix with the elements in `values` in row-major order. pub fn new(row: usize, col: usize, values: &[T]) -> Matrix { unimplemented!(); } /// Creates a new, empty matrix of `row` rows and `col` columns. /// `data` contains no element. pub fn new_empty(row: usize, col: usize) -> Matrix { unimplemented!(); } /// Returns a shared reference to `data` pub fn data(&self) -> &Vec { unimplemented!(); } /// Returns a mutable reference to `data` pub fn mut_data(&mut self) -> &mut Vec { unimplemented!(); } /// Returns the number of rows and columns in the first and second /// elements of the tuple, respectively. pub fn size(&self) -> (usize, usize) { unimplemented!(); } } impl + Copy> ops::Add for &'a Matrix { type Output = Matrix; /// Returns the sum of `self` and `rhs`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn add(self, rhs: Self) -> Self::Output { unimplemented!(); } } impl + Copy> ops::Add> for &'a Matrix { type Output = Matrix; /// Returns the sum of `self` and `rhs`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn add(self, rhs: Matrix) -> Self::Output { unimplemented!(); } } impl + Copy> ops::Add for Matrix { type Output = Self; /// Returns the sum of `self` and `rhs`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn add(self, rhs: Self) -> Self::Output { unimplemented!(); } } impl + Copy> ops::Add for Matrix { type Output = Self; /// Returns the sum of `self` and `rhs`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn add(self, rhs: &Self) -> Self::Output { unimplemented!(); } } impl + Copy> ops::Sub for &'a Matrix { type Output = Matrix; /// Returns the subtraction of `rhs` from `self`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn sub(self, rhs: Self) -> Self::Output { unimplemented!(); } } impl + Copy> ops::Sub> for &'a Matrix { type Output = Matrix; /// Returns the subtraction of `rhs` from `self`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn sub(self, rhs: Matrix) -> Self::Output { unimplemented!(); } } impl + Copy> ops::Sub for Matrix { type Output = Self; /// Returns the subtraction of `rhs` from `self`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn sub(self, rhs: Self) -> Self::Output { unimplemented!(); } } impl + Copy> ops::Sub for Matrix { type Output = Self; /// Returns the subtraction of `rhs` from `self`. If `self.row != rhs.row || self.col != rhs.col`, panic. fn sub(self, rhs: &Self) -> Self::Output { unimplemented!(); } } impl + ops::Mul the following functions are given. implement them (may not need all functions).
 data: Vec, /// Number of rows row: usize, ///](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3b7dcccb87_34866f3b7dc3fdc7.jpg)



' You will define a "Matrix" type , overload the and * operators, and implement the - , Display trait on it by providing the following API: use std: fops, fmt); Debug)] #[derive ( PartialEq, pub struct Matrix
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
