The full function, which accepts n-ary args is:
def maxstar (*args):
I'm guessing to just leave this function as pure python - nothing numexpr
On Fri, Nov 9, 2012 at 8:52 AM, Francesc Alted <fal...@gmail.com> wrote:
> On 11/9/12 1:26 PM, Neal Becker wrote:
>> My problem is to code maxstar function. For 2 arguments, it is:
>> def maxstar2 (a, b):
>> to convert the corresponding c++ code into a binary ufunc.
>> The way this would be applied is to pass 2 large vectors, and the
>> Ultimately, it is intended to operate any more than 2 inputs, but I
>> So I'm wondering if I can use numexpr here. The above maxstar2 isn't
> If I understand you correctly, you can evaluate the above expression as:
> ne.evaluate('where(a>b, a, b) + log1p (exp (-abs (a - b)))')
> Here it is an actual example:
> In : a = np.arange(1e7)
> In : b = a + 1
> In : time np.where(a>b, a, b) + np.log1p (np.exp (-np.abs (a - b)))
> In : time ne.evaluate('where(a>b, a, b) + log1p (exp (-abs (a - b)))')
> [not using VML here]
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.