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

*Subject*: Re: subscript array question*From*: Craig Markwardt <craigmnet(at)astrog.physics.wisc.edu>*Date*: 16 Feb 1999 20:42:30 -0600*Newsgroups*: comp.lang.idl-pvwave*Organization*: U. Wisc. Madison Physics -- Compact Objects*References*: <79tduk$iks$1@news.NERO.NET> <36C2EFD5.8D76D36@no.spam.edu><7a0j1q$mvb$1@news.NERO.NET> <7a0u4v$ehu$1@readme.uio.no><36C9B0C9.66291DFA@silk.gsfc.nasa.gov>*Reply-To*: craigmnet(at)astrog.physics.wisc.edu*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:13650

Tom McGlynn <tam@silk.gsfc.nasa.gov> writes: > > This kind of thing comes up in a number of contexts, e.g., the > thread a couple of months ago for calculating cumulative totals > in arrays. The solution I've suggested to RSI is a new equality > operator (e.g., :=) which does not implicitly parallelize > array operations. > > In this case one could just write > > array[subs] := array[subs]+1 > > in a very natural way rather than use devious if clever subterfuges. > Yorick, which is very IDL-like, has some pretty handy ideas in it. While it doesn't consider your "anti-parallel" equality operator, it does have operators that *attach* to array subscripts and do most of the things you might want. Consider that there is no nicely vectorized function in IDL which computes the cumulative total of "x" in IDL. In Yorick, you would say: y = x(cum) Here "cum" is a special function which operates on a dimension of the array, and cranks out the cumulative total for you. Thus for example, y = x(dif) is the finite difference between elements of x (this is something I wish I had all the time!) There are also "rank-reducing" functions which remove one dimension of the array. Thus, y = x(sum) is the same as y = total(x) in IDL, y = x(max) is the same as y = max(x), etc. Whis is this nice? Sometimes you want to get the maximum along only a certain dimension. To get the maximum in each row of an array, you might try: y = x(max,*) which has no equivalent in IDL As I say, I find myself wishing for a lot of these features almost daily. IDL could become a whole lot more vector-friendly with them. The RSI people could take some lessons from Yorick. Craig -- -------------------------------------------------------------------------- Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response --------------------------------------------------------------------------

**References**:**subscript array question***From:*Scott Bennett

**Re: subscript array question***From:*Scott Bennett

**Re: subscript array question***From:*Stein Vidar Hagfors Haugan

**Re: subscript array question***From:*Tom McGlynn

- Prev by Date:
**Re: subscript array question** - Next by Date:
**Re: How do I prevent underflow errors?** - Prev by thread:
**Re: subscript array question** - Next by thread:
**Non-Blocking I/O** - Index(es):