Re: elemental function versus loop over function
- From: "highegg" <highegg@xxxxxxxxx>
- Date: 28 Nov 2006 06:43:57 -0800
Mark Morss napsal:
I have to perform a scalar function on each of the elements of a largeA scalar is conformable with any array; therefore, as long as the
array. In general, for speed, does it matter much whether I loop over
the array or define an elemental function? One aspect of my problem is
that my array result depends not only on the input array, but on one or
two scalar inputs. So if I define an elemental function, before I can
call it with these arguments, my understanding is that I have to "blow
up" these scalars into constant-valued arrays of the same dimension as
my input array.
additional
arguments are scalar, you can easily use an elemental function.
A compiler would indeed be quite dumb to spread scalars into
My preliminary assumption is that isn't worth doing this, and just
looping over the array is likely to be faster.
conformable
arrays first. Most likely you will see no performance difference
between these
two approaches.
.
- References:
- elemental function versus loop over function
- From: Mark Morss
- elemental function versus loop over function
- Prev by Date: elemental function versus loop over function
- Next by Date: Re: elemental function versus loop over function
- Previous by thread: elemental function versus loop over function
- Next by thread: Re: elemental function versus loop over function
- Index(es):
Relevant Pages
|