[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matr
From: |
Kai Torben Ohlhus |
Subject: |
[Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions |
Date: |
Tue, 15 Jun 2021 22:39:53 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36 |
Update of bug #60784 (project octave):
Severity: 3 - Normal => 1 - Wish
Priority: 5 - Normal => 1 - Later
Status: None => Need Info
_______________________________________________________
Follow-up Comment #1:
Thanks for the report. I agree, that inconsistency can be annoying. In this
case I tend to support the current Matlab R2021a implementation
>> A = logical (rand (4));
>> det (A)
Check for incorrect argument data type or missing argument in call to function
'det'.
>> eig (A)
Error using eig
Invalid data type. Input matrix must be double or single.
(same for inv(A), svd(A), and lu(A)) to strictly forbid calling those function
with non-single or non-double input.
It is more for user convenience, but making a type cast explicit helps in
understanding memory issues and avoids ugly surprises. For example
>> A = rand (2e4); ## 3 GB
>> B = logical (A); ## 380 MB
>> tic; det (A), toc
ans = -Inf
Elapsed time is 223.995 seconds.
>> tic; det (B), toc
ans = 0
Elapsed time is 136.939 seconds.
tic; det (double (B)), toc
ans = 0
Elapsed time is 135.042 seconds.
An unaware programmer might think if "det (B)" is permitted, there must be a
memory efficient implementation for "logical" matrices in Octave.
However, running the example and observing a memory monitor shows a slightly
bigger memory blowup (as the original 380 MB matrix B has to be stored on top
of the internal conversion to a full double matrix). Thus one gets an even
worse memory usage, even though I did everything to save memory using a
logical array 😓
In my opinion, the discussion boils down to convenience vs. no surprises. As
said before, I prefer no surprises.
How do other maintainer think about it? 🙂 Is it worth ensuring consistency
and if yes, convenience or no surprises (Matlab compatibility)?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60784>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, anonymous, 2021/06/15
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions,
Kai Torben Ohlhus <=
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, Dmitri A. Sergatskov, 2021/06/15
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, Dmitri A. Sergatskov, 2021/06/15
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, John W. Eaton, 2021/06/16
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, John W. Eaton, 2021/06/16
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, Kai Torben Ohlhus, 2021/06/16
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, Dmitri A. Sergatskov, 2021/06/16
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, Kai Torben Ohlhus, 2021/06/16
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, John W. Eaton, 2021/06/16
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, anonymous, 2021/06/16
- [Octave-bug-tracker] [bug #60784] Inconsistent behavior for boolean matrix types with matrix functions, anonymous, 2021/06/16