fix: correct from function
This commit is contained in:
parent
28fae41412
commit
1fdf5e281b
3 changed files with 11 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -4,4 +4,4 @@ version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matrix"
|
name = "matrix"
|
||||||
version = "0.1.5"
|
version = "0.1.7"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "matrix"
|
name = "matrix"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Zhongheng Liu <z.liu@outlook.com.gr>"]
|
authors = ["Zhongheng Liu <z.liu@outlook.com.gr>"]
|
||||||
homepage = "https://stvnliu.gitlab.io"
|
homepage = "https://stvnliu.gitlab.io"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,11 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! TODO:: Create matrix multiplication method
|
//! TODO:: Create matrix multiplication method
|
||||||
|
|
||||||
use std::{fmt::Display, ops::{Add, Mul, Sub}, str::FromStr};
|
use std::{
|
||||||
|
fmt::Display,
|
||||||
|
ops::{Add, Mul, Sub},
|
||||||
|
str::FromStr,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::error::{MatrixSetValueError, ParseMatrixError};
|
use crate::error::{MatrixSetValueError, ParseMatrixError};
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
|
|
@ -121,7 +125,6 @@ impl Matrix {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for Matrix {
|
impl FromStr for Matrix {
|
||||||
type Err = ParseMatrixError;
|
type Err = ParseMatrixError;
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
|
@ -221,8 +224,7 @@ impl From<Vec<i32>> for Matrix {
|
||||||
Matrix {
|
Matrix {
|
||||||
nrows: value.len(),
|
nrows: value.len(),
|
||||||
ncols: 1,
|
ncols: 1,
|
||||||
data: vec![value],
|
data: value.iter().map(|v| vec![*v]).collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue