diff options
author | Freya Murphy <freya@freyacat.org> | 2024-02-29 21:05:10 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-02-29 21:05:10 -0500 |
commit | ace046624d2e23fba67564a86af7f03ed8a48eae (patch) | |
tree | 21ae64bc5897b1b89ee2ab8563b0e7ce047bf34a /matrix-std/src/math.rs | |
parent | fix readme (diff) | |
download | matrix-ace046624d2e23fba67564a86af7f03ed8a48eae.tar.gz matrix-ace046624d2e23fba67564a86af7f03ed8a48eae.tar.bz2 matrix-ace046624d2e23fba67564a86af7f03ed8a48eae.zip |
remove unwraps, fix utf8
Diffstat (limited to 'matrix-std/src/math.rs')
-rw-r--r-- | matrix-std/src/math.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/matrix-std/src/math.rs b/matrix-std/src/math.rs index 111544c..503192d 100644 --- a/matrix-std/src/math.rs +++ b/matrix-std/src/math.rs @@ -15,7 +15,7 @@ fn trans(_: VmArgs, args: Vec<Value>) -> Result<Value> { let values = mat .cols() .reduce(|mut a, b| {a.extend(b); a}) - .unwrap() + .ok_or(exception!(RUNTIME_EXCEPTION, "matrix values smashed"))? .into_iter() .map(|e| e.clone()) .collect(); @@ -164,7 +164,7 @@ fn mat_det(mat: Matrix) -> Result<Value> { .collect::<Vec<Value>>() ) .reduce(|mut a, b| {a.extend(b); a}) - .unwrap(); + .ok_or(exception!(RUNTIME_EXCEPTION, "matrix values smashed"))?; let sub = Matrix::new(mat.domain - 1, mat.domain - 1, sub_values); let val = mat.get(0, col)?; let part = (val * mat_det(sub)?)?; |