[Top][All Lists]

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

[Octave-bug-tracker] [bug #38628] bsxfun slow for complex

From: Rik
Subject: [Octave-bug-tracker] [bug #38628] bsxfun slow for complex
Date: Mon, 19 Sep 2022 17:43:36 -0400 (EDT)

Follow-up Comment #14, bug #38628 (project octave):

Well, it might get messy in the same way that cellfun gets messy.  In cellfun
certain functions are detected and accelerated, and the rest are processed

I think it might be similarly useful if functions that are accelerated via
broadcasting, such as @plus, were simply forwarded to the broadcasting

But, we also need to be able to handle arbitrary binary functions.  For
example, this code

fun = @(a,b) a - exp(b);
a = 1:7; 
b = pi*[0 1/4 1/3 1/2 2/3 3/4 1].';
C = bsxfun(fun,a,b)

For those, we should do everything possible to speed things up.

It is not, in general, possible to know the real/complex nature of the result
without calculating the function.  For specific operations, say @plus, it is
possible to work out the return type in advance given the inputs.  But
something like

f = @(a,b) = sqrt (a - b);

Can produce real or complex output even though the inputs a,b are both real.


Reply to this item at:


Message sent via Savannah

reply via email to

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