octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matr


From: anonymous
Subject: [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions
Date: Wed, 16 Jun 2021 17:57:39 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0

Follow-up Comment #10, bug #60784 (project octave):

While this discussion is going on, here is some more material to discuss:


A = (rand(1000) > 0.5); # A is boolean
B = A^2;                # boolean^2 converts to double
B = single(A)^2;        # B is type single
B = int8(A)^2;          # error
B = int16(A)^2;         # error
B = int32(A)^2;         # error


Now why is it OK to silently convert a boolean type to double but not the
integer types? Opening up that possibility could create problems with memory
usage though, so it's not clear-cut.

Based on comment #1 and comment #9, it might be better to require that all
matrix functions require single or double, and any type conversions need to be
done by the user explicitly. The price would be user inconvenience though, so
again the tradeoff is not clear.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60784>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]