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

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

[Octave-bug-tracker] [bug #60539] Slow performance of betaincinv.m


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #60539] Slow performance of betaincinv.m
Date: Sat, 29 May 2021 04:28:09 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #21, bug #60539 (project octave):

Re comment 19:

Do you imply that there is supposed to be a general semantic difference
between singleton expansion and broadcasting, or do you just talk about the
specific singleton expansion as implemented by common_size()? At least in the
documentation, there is no distinction: according to Sect. 19.2, broadcasting
is the one that happens per dimension, which is exactly what bsxfun does (and
the "sx" obviously stands for singleton expansion). Expanding only arguments
that have length one in all dimensions is a behaviour that is particular to
common_size(), I think. And I want to repeat that "If the inputs cannot be
brought to a common size" in the documentation of common_size() is not really
correct.

I can accept that broadcasting is done only for specific functions (and I
would propose to correspondingly add "certain" before "functions" in the
second sentence of https://octave.org/doc/v6.2.0/Broadcasting.html) -- I see
that in order to have broadcasting work in general for internal functions, one
would have to introduce an additional layer that does just this expansion,
which then is not faster than if the expansion was done by the user -- the
nice thing about automatic broadcasting is that I can do (1:N)+(1:N)' and only
one N^2-size matrix (namely for the result) has to be allocated, which is much
more performant. 

I would think Matlab conformity is no issue here, as this is only about
reproducing all that Matlab can compute, while reasonable output where Matlab
errors out is specifically allowed, isn't it? But of course it can stay as it
is, the only problem is that bsxfun works only for binary functions, that is,
I can, e.g., compute bsxfun(@poisspdf,[1 2]',[5 5]) (which does not work
automatically), but I cannot do the equivalent for binopdf, which takes three
arguments, and I see no way how this could be done without manually expanding
the arguments. That is, a variadic bsxfun-generalization could be nice.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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