Compare commits

...

17 Commits

Author SHA1 Message Date
Palash Tyagi
25a2a0d831 Add .vscode/ to .gitignore to exclude Visual Studio Code settings 2025-05-03 01:19:27 +01:00
Palash Tyagi
1dbe5d0efe Update matrix arithmetic operations 2025-05-03 01:19:01 +01:00
Palash Tyagi
b17863dcdc Organize code structure by adding section comments 2025-05-03 01:18:24 +01:00
Palash Tyagi
ac0eed2d56 Add comprehensive arithmetic and boolean logic tests for Matrix operations 2025-05-03 01:17:01 +01:00
Palash Tyagi
73a30d45c5 Rename test matrix creation functions for clarity and consistency 2025-05-03 01:16:33 +01:00
Palash Tyagi
3cb68be062 Refactor element-wise arithmetic operations to use a centralized dimension check for improved error handling 2025-05-03 01:11:59 +01:00
Palash Tyagi
ca734fbedf Enhance bitwise operations for boolean matrices and implement logical NOT for both owned and borrowed matrices 2025-05-03 00:39:08 +01:00
Palash Tyagi
36a0846efa Enhance element-wise arithmetic operations for Matrix + Scalar to support in-place modifications and improve performance 2025-05-03 00:38:07 +01:00
Palash Tyagi
7f587a7b7e Enhance element-wise arithmetic operations for Matrix to support multiple ownership variants and improve in-place modifications 2025-05-03 00:37:06 +01:00
Palash Tyagi
a30a7101e8 Refactor element-wise comparison macro to improve naming consistency 2025-05-03 00:36:03 +01:00
Palash Tyagi
10c6116f8f Enhance element-wise comparison methods to optimize data handling 2025-05-03 00:35:34 +01:00
Palash Tyagi
ecb1939ec2 Enhance error messages in Broadcastable trait to clarify row and column count mismatches 2025-05-03 00:32:46 +01:00
Palash Tyagi
bdd0a23096 Enhance add_column and add_row methods to handle empty matrices and improve error handling 2025-05-03 00:31:11 +01:00
Palash Tyagi
4c02006153 Optimize column swapping logic to handle empty matrices and prevent unnecessary swaps 2025-05-03 00:29:14 +01:00
Palash Tyagi
9fd3582061 Refactor delete_row method to improve bounds checking and optimize data rebuilding 2025-05-03 00:26:43 +01:00
Palash Tyagi
8574d86abc Enhance delete_column method to improve efficiency of column removal 2025-05-03 00:26:21 +01:00
Palash Tyagi
20727a2b91 Improve column swapping logic to handle empty matrices and prevent overlapping swaps 2025-05-03 00:25:45 +01:00
3 changed files with 611 additions and 178 deletions

1
.gitignore vendored
View File

@ -12,5 +12,6 @@ data/
*.info *.info
.venv/ .venv/
.vscode/
tarpaulin-report.* tarpaulin-report.*

View File

@ -76,17 +76,26 @@ let total: f64 = result.sum_vertical().iter().sum::<f64>();
assert_eq!(total, 184.0); assert_eq!(total, 184.0);
// broadcast & reduce // broadcast & reduce
let result: Matrix<f64> = &ma + 1.0; // add scalar let result: Matrix<f64> = ma.clone() + 1.0; // add scalar
let result: Matrix<f64> = &result - 1.0; // subtract scalar let result: Matrix<f64> = result + &ma - &ma; // add matrix
let result: Matrix<f64> = &result * 2.0; // multiply by scalar let result: Matrix<f64> = result - 1.0; // subtract scalar
let result: Matrix<f64> = &result / 2.0; // divide by scalar let result: Matrix<f64> = result * 2.0; // multiply by scalar
let result: Matrix<f64> = result / 2.0; // divide by scalar
let check: bool = result.eq_elementwise(ma.clone()).all(); let check: bool = result.eq_elem(ma.clone()).all();
assert!(check); assert!(check);
// The above math can also be written as: // The above math can also be written as:
let check: bool = (&(&(&(&ma + 1.0) - 1.0) * 2.0) / 2.0) let check: bool = (&(&(&(&ma + 1.0) - 1.0) * 2.0) / 2.0)
.eq_elementwise(ma) .eq_elem(ma.clone())
.all(); .all();
assert!(check); assert!(check);
// The above math can also be written as:
let check: bool = ((((ma.clone() + 1.0) - 1.0) * 2.0) / 2.0)
.eq_elem(ma)
.all();
assert!(check);
``` ```

File diff suppressed because it is too large Load Diff