You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a serious bug with the implementation of not_equal_scalar function. In it's current state, it is an alias for equal_scalar since it returns the opposite of it's expected result. Here is a reproducing example:
moduleNdarray=Owl.Dense.Ndarray.Generic;;
let x =Ndarray.create Bigarray.Int64 [|2;2;2|] 10L;;
Ndarray.equal_scalar x 10L;;
(*- : bool = true *)Ndarray.not_equal_scalar x 10L;;
(*- : bool = true *)
Evidently, not_equal_scalar is supposed to return false. With the help of my LSP server, I was able to jump to the definition of this function and to my surprised found that the underlying implementation of both functions is identical. See:
letequal_scalarxa= _owl_equal_scalar (kind x) (numel x) x a =1
letnot_equal_scalarxa= _owl_equal_scalar (kind x) (numel x) x a =1
Basically the implementation of equal_scalar was copied over to not_equal_scalar. I looked to see if there is an implementation function named _not_equal_scalar and it turns out it does exist at:
The text was updated successfully, but these errors were encountered:
zoj613
changed the title
Serious bug with not_equal_scalar function _always_ returning the wrong result.
Serious bug with not_equal_scalar function **always** returning the wrong result.
Jul 10, 2024
zoj613
changed the title
Serious bug with not_equal_scalar function **always** returning the wrong result.
Serious bug with not_equal_scalar function always returning the wrong result.
Jul 10, 2024
There is a serious bug with the implementation of
not_equal_scalar
function. In it's current state, it is an alias forequal_scalar
since it returns the opposite of it's expected result. Here is a reproducing example:Evidently,
not_equal_scalar
is supposed to returnfalse
. With the help of my LSP server, I was able to jump to the definition of this function and to my surprised found that the underlying implementation of both functions is identical. See:owl/src/owl/dense/owl_dense_ndarray_generic.ml
Lines 1940 to 1942 in 455bde1
Basically the implementation of
equal_scalar
was copied over tonot_equal_scalar
. I looked to see if there is an implementation function named_not_equal_scalar
and it turns out it does exist at:owl/src/owl/core/owl_ndarray_maths.ml
Line 1618 in 455bde1
So a simple fix for this bug is to just replace
with
Cc @mseri @jzstark
The text was updated successfully, but these errors were encountered: