Circshift bug for sparse logical.

33 Ansichten (letzte 30 Tage)
Jan Orwat
Jan Orwat am 8 Dez. 2015
Bearbeitet: James Tursa am 23 Okt. 2024 um 21:15
Hello, does anybody know if it has been reported?
Circshift seems to shift sparse logicals properly, but changes trues to falses, which leads to several logical problems:
>> C = circshift(sparse(true),1)
C =
(1,1) 0
>> C == ~C
ans =
(1,1) 1
>> C&C
ans =
(1,1) 0
>> C|C
ans =
(1,1) 1
% etc.
It's not a major problem since sparse logicals doesn't seem to be in common use and workaround with indexing is very simple. Bug confirmed in 2015a and 2015b, denied in 2010b, 2013a and 2013b. It probably exists since last changes in circshift in 2014a.
  3 Kommentare
DGM
DGM am 23 Okt. 2024 um 0:59
Welp, I guess that was changed somewhere between R2017b and R2019b. I didn't see anything in bug reports, but ... yeah.
C = circshift(sparse(true),1)
C = sparse logical
(1,1) 1
C == ~C
ans = sparse logical
All zero
C&C
ans = sparse logical
(1,1) 1
C|C
ans = sparse logical
(1,1) 1
James Tursa
James Tursa am 23 Okt. 2024 um 21:01
Bearbeitet: James Tursa am 23 Okt. 2024 um 21:15
Looks like bug is fixed, at least for this example (using sarek sparse matrix checker from FEX):
>> st = sparse(true)
st =
sparse logical
(1,1) 1
>> sarek(st)
SAREK -- Sparse Analyzer Real Et Komplex , by James Tursa
Compiled in version R2020a (with -R2018a option)
Running in version R2020a
Matrix is logical ...
M = 1 >= 0 OK ...
N = 1 >= 0 OK ...
Nzmax = 1 >= 1 OK ...
Jc[0] == 0 OK ...
Jc[N] = 1 <= Nzmax = 1 OK ...
Jc array OK ...
Ir array OK ...
All stored elements nonzero OK ...
All sparse integrity checks OK
ans =
0
>>
>> cst = circshift(st,1)
cst =
sparse logical
(1,1) 1
>> sarek(cst)
SAREK -- Sparse Analyzer Real Et Komplex , by James Tursa
Compiled in version R2020a (with -R2018a option)
Running in version R2020a
Matrix is logical ...
M = 1 >= 0 OK ...
N = 1 >= 0 OK ...
Nzmax = 1 >= 1 OK ...
Jc[0] == 0 OK ...
Jc[N] = 1 <= Nzmax = 1 OK ...
Jc array OK ...
Ir array OK ...
All stored elements nonzero OK ...
All sparse integrity checks OK
ans =
0

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Steven Lord
Steven Lord am 23 Okt. 2024 um 18:05
Verschoben: Walter Roberson am 23 Okt. 2024 um 20:51
This bug was fixed in release R2018a.

Weitere Antworten (0)

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Produkte


Version

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by