Mon 29 Feb 2016 02:36:22 AM UTC, comment #9:
I applied the first of Lachlan's patches here http://hg.savannah.gnu.org/hgweb/octave/rev/a1aa52bff079. This fixes the error originally seen with bsxfun. There is still a problem with the operator '+' when it needs to do automatic broadcasting.
The second patch from Lachlan no longer applies cleanly. I can look at it again when it is refreshed to current tip.
|
Fri 25 Sep 2015 06:53:11 AM UTC, comment #5:
This report actually describes something unrelated to the problems with automatic broadcasting of sparse matrices. The bug with the explicit use of bsxfun is that the variable C in bsxfun() is not initialised properly for sparse matrices. It is fixed by the attached patch. It affects broadcast between any two sparse matrices of different storage types, such as single/double.
There is also a more subtle bug in bsxfun (f, a, b) when
f (a(:,1), b(:,1)) has a different type from f (a(:,2), b(:,2)).
The slow-path code converts singles to doubles, instead of doubles to
singles. To see this, try
This is not too serious; Matlab gives an error if the output of f has a different storage type, except for promoting real to complex. I'd be happy to fix this if it would be committed, but most of the patches I have submitted recently haven't been reviewed yet, so I'm not sure if it is worth it.
FWIW, the code in bsxfun() is pretty hard to follow, so I've written a bit of documentation, in the second attached patch.
(file #34976, file #34977)
|
Sat 30 May 2015 07:12:27 PM UTC, comment #1:
Sorry, markup typo cut off the report. Here it is again.
These work fine:
These fail, each in different ways, but they should produce the same results as above, only sparse:
Matlab does the correct thing with the bsxfun functions, but of course it does not consider the bare additions to be correct.
|