Merge branch 'main' into benchmarks

This commit is contained in:
Palash Tyagi 2025-05-02 23:43:07 +01:00 committed by GitHub
commit 147cb2f168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -2,9 +2,14 @@ name: run-unit-tests
on:
pull_request:
types: [review_requested, ready_for_review, synchronize, opened, reopened]
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run-unit-tests:
if: github.event.pull_request.draft == false

View File

@ -364,6 +364,21 @@ impl Not for Matrix<bool> {
}
}
// implement for &Matrix<bool>
impl<'a> Not for &'a Matrix<bool> {
type Output = Matrix<bool>;
fn not(self) -> Matrix<bool> {
// Invert each boolean element in the matrix
let data = self.data.iter().map(|&v| !v).collect();
Matrix {
rows: self.rows,
cols: self.cols,
data,
}
}
}
pub type FloatMatrix = Matrix<f64>;
pub type BoolMatrix = Matrix<bool>;
pub type IntMatrix = Matrix<i32>;