mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-10-04 17:49:25 +00:00
Enhance README example with additional assertions for clarity in matrix operations
This commit is contained in:
@@ -75,6 +75,12 @@ let result = &result - 1.0; // subtract scalar
|
|||||||
let result = &result * 2.0; // multiply by scalar
|
let result = &result * 2.0; // multiply by scalar
|
||||||
let result = &result / 2.0; // divide 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);
|
assert!(check);
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user