diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 6fe312d..2811fca 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -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 diff --git a/src/matrix/mat.rs b/src/matrix/mat.rs index 02a042b..b3d93b6 100644 --- a/src/matrix/mat.rs +++ b/src/matrix/mat.rs @@ -364,6 +364,21 @@ impl Not for Matrix { } } +// implement for &Matrix +impl<'a> Not for &'a Matrix { + type Output = Matrix; + + fn not(self) -> Matrix { + // 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; pub type BoolMatrix = Matrix; pub type IntMatrix = Matrix;