elemental function versus loop over function



I have to perform a scalar function on each of the elements of a large
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.

My preliminary assumption is that isn't worth doing this, and just
looping over the array is likely to be faster.

.



Relevant Pages

  • Re: using fortran intrinsic functions in mex-file
    ... LOGICAL FUNCTION LSAME ... These programs must be called using F90 style array ... Scalar Arguments .. ... Purpose ...
    (comp.soft-sys.matlab)
  • Re: object array / array of objects
    ... LENGTH works if obj is a scalar or a vector of objects, ... of the class have to know about the whole array, ... then it would have been called with the scalar object stored in xas ... go back to the classdef file and put a for loop in every method. ...
    (comp.soft-sys.matlab)
  • [ANNOUNCE] New module Class::IntrospectionMethods
    ... access plain scalars, array, hash. ... These scalar, hash or array can ... object can be queried for the container object. ... parent object (the one constructed by Class::IntrospectionMethods ...
    (comp.lang.perl.modules)
  • Re: Another Perl datatype headache ( scalars $, hashes %, and arrays @ )
    ... > If I want to add Hash keys to another Hash, ... > Usually, I use scalar @array; ... $#array is not the length of the array. ... If you are sure your sub is called: ...
    (perl.beginners)
  • Re: operator overloading ... for numerical classes only
    ... The restriction to "scalar" types is meant to include complex numbers, ... and array code would be more similar? ... An ordered sequence type would ... sequence of data should be a List or an array. ...
    (comp.lang.java.programmer)