mlx-c icon indicating copy to clipboard operation
mlx-c copied to clipboard

missing functions from ops.h

Open davidkoski opened this issue 9 months ago • 1 comments

I noticed that these are missing from ops.h:

/**
 * Extract the number of elements along some axes as a scalar array. Used to
 * allow shape dependent shapeless compilation (pun intended).
 */
array number_of_elements(
    const array& a,
    std::vector<int> axes,
    bool inverted,
    Dtype dtype = int32,
    StreamOrDevice s = {});

/** Bitwise and. */
array bitwise_and(const array& a, const array& b, StreamOrDevice s = {});
array operator&(const array& a, const array& b);

/** Bitwise inclusive or. */
array bitwise_or(const array& a, const array& b, StreamOrDevice s = {});
array operator|(const array& a, const array& b);

/** Bitwise exclusive or. */
array bitwise_xor(const array& a, const array& b, StreamOrDevice s = {});
array operator^(const array& a, const array& b);

/** Shift bits to the left. */
array left_shift(const array& a, const array& b, StreamOrDevice s = {});
array operator<<(const array& a, const array& b);

/** Shift bits to the right. */
array right_shift(const array& a, const array& b, StreamOrDevice s = {});
array operator>>(const array& a, const array& b);

I am not sure about number_of_elements() but the bitwise and arithmetic shift functions should be added.

davidkoski avatar Apr 29 '24 20:04 davidkoski

Yea it would be good to add the bitwise ops. number_of_elements probably shouldn't be added as it is mostly used internally for now.

awni avatar Apr 30 '24 23:04 awni

@davidkoski it looks to me these functions are now supported?

andresy avatar Jun 06 '24 20:06 andresy