comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: array manipulation problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: array manipulation problem [message #20368 is a reply to message #20365] Wed, 07 June 2000 00:00 Go to previous messageGo to previous message
Paul Hick is currently offline  Paul Hick
Messages: 9
Registered: November 1999
Junior Member
"Martin B. Schmidt" wrote:

> How can I assign
> a[i,j,k] = i^2+j^2+k^2 for all i,j,k (i,j,k=0,1,2,..,n-1)
> without using any loop?

one = replicate(1.0, n)
index = findgen(n)^2
a = reform( reform( index#one, n*n)#one + reform( one#index, n*n)#one
+ reform( one#one, n*n)#index ,n,n,n)

Not particularly pretty, but it should work.

Cheers,
Paul
--
____________________________________________________________ _____
| Paul Hick (pphick@ucsd.edu) |
| Office : SERF Rm. 302 Smail : UCSD/CASS/0424 |
| Phone : (858) 534-8965 9500 Gilman Drive |
| Fax : (858) 534-0177 La Jolla CA 92093-0424 |
| WWW : http://casswww.ucsd.edu/personal/Plh.html |
|___________________________________________________________ ______|
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Curvefit on PV-Wave
Next Topic: reasons for truncated sav files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 02:18:36 PDT 2025

Total time taken to generate the page: 0.48239 seconds