mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 04:00:01 +00:00
Enhance README example with additional assertions for clarity in matrix operations
This commit is contained in:
parent
fb6ebdf69b
commit
eb90f0795b
@ -75,6 +75,12 @@ let result = &result - 1.0; // subtract scalar
|
||||
let result = &result * 2.0; // multiply by scalar
|
||||
let result = &result / 2.0; // divide by scalar
|
||||
|
||||
let check = result.eq_elementwise(ma).all();
|
||||
let check = result.eq_elementwise(ma.clone()).all();
|
||||
assert!(check);
|
||||
|
||||
// The above math can also be written as:
|
||||
let check = &(&(&(&(&ma + 1.0) - 1.0) * 2.0) / 2.0)
|
||||
.eq_elementwise(ma)
|
||||
.all();
|
||||
assert!(check);
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user