From eb90f0795b490a189e3c8d0ee5298fceb642cd9d Mon Sep 17 00:00:00 2001 From: Palash Tyagi <23239946+Magnus167@users.noreply.github.com> Date: Sat, 26 Apr 2025 17:30:45 +0100 Subject: [PATCH] Enhance README example with additional assertions for clarity in matrix operations --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 35451c6..93624e0 100644 --- a/README.md +++ b/README.md @@ -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); ```