Skip to content

Commit b19c79c

Browse files
committed
Negation
1 parent 76d643a commit b19c79c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ pub mod pyndarray {
219219
$dtype::imul(inst.clone(), other, vm)?;
220220
Ok(inst.into())
221221
}
222+
223+
#[pymethod(magic)]
224+
fn neg(&self, vm: &VirtualMachine) -> PyResult {
225+
Ok(self.arr.write(|sliced| $dtype { arr: SlicedArcArray::from_array(sliced.to_owned()) }.to_pyobject(vm)))
226+
}
222227
}
223228

224229
impl $dtype {

0 commit comments

Comments
 (0)