mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Add conjugate operator (#1100)
* cpu and gpu impl * add mx.conj and array.conj() --------- Co-authored-by: Alex Barron <abarron22@apple.com>
This commit is contained in:
@@ -4101,6 +4101,15 @@ array number_of_elements(
|
||||
{a}));
|
||||
}
|
||||
|
||||
array conjugate(const array& a, StreamOrDevice s /* = {} */) {
|
||||
// Mirror NumPy's behaviour for real input
|
||||
if (a.dtype() != complex64) {
|
||||
return a;
|
||||
}
|
||||
return array(
|
||||
a.shape(), a.dtype(), std::make_shared<Conjugate>(to_stream(s)), {a});
|
||||
}
|
||||
|
||||
array bitwise_impl(
|
||||
const array& a,
|
||||
const array& b,
|
||||
|
||||
Reference in New Issue
Block a user