[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output
From: |
Nicholas Jankowski |
Subject: |
[Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions |
Date: |
Mon, 31 Oct 2022 00:40:16 -0400 (EDT) |
Follow-up Comment #16, bug #63281 (project octave):
in the interest of restoring some performance gain of avoiding bsxfun and
maybe preserving the sparseness:
looking for example at center.m, instead of the current:
## FIXME: Use bsxfun, rather than broadcasting, until broadcasting
## supports diagonal and sparse matrices (Bugs #41441, #35787).
y = bsxfun (@minus, x, mean (x, dim));
## y = x - mean (x, dim); # automatic broadcasting
would something like this be acceptable?:
try
y = x - mean (x, dim); # automatic broadcasting
catch err
if any (strcmp (typeinfo (sparse (x)), ...
{"sparse matrix", "diagonal matrix"}))
## y = bsxfun (@minus, x, mean (x, dim)); faster, but loses sparseness
y = bsxfun(@(x,y) x-y, x, mean(x, dim)); # preserves sparseness
else
rethrow(err);
endif
end_try_catch
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63281>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, (continued)
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, John W. Eaton, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, John W. Eaton, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, John W. Eaton, 2022/10/27
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions,
Nicholas Jankowski <=
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/31
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, John W. Eaton, 2022/10/31
- [Octave-bug-tracker] [bug #63281] bsxfun fails to preserve sparse output for some functions, Nicholas Jankowski, 2022/10/31