The REPLICATE_INPLACE procedure updates an existing array by replacing all or selected parts of it with a specified value. REPLICATE_INPLACE can be faster and use less memory than the IDL function REPLICATE or the IDL array notation for large arrays that already exist.
| Note |
REPLICATE_INPLACE, X, Value [, D1, Loc1 [, D2, Range]]
The array to be updated. X can be of any numeric type. REPLICATE_INPLACE does not change the size and type of X.
The value which will fill all or part of X. Value may be any scalar or one-element array that IDL can convert to the type of X. REPLICATE_INPLACE does not change Value.
An optional parameter indicating which dimension of X is to be updated.
An array with the same number of elements as the number of dimensions of X. The Loc1 and D1 arguments together determine which one-dimensional subvector (or subvectors, if D1 and Range are provided) of X is to be updated.
An optional parameter, indicating in which dimension of X a group of one-dimensional subvectors are to be updated. D2 should be different from D1.
An array of indices of dimension D2 of X, indicating where to put one-dimensional updates of X.
This routine is written to make use of IDL's thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the
; Create a multidimensional zero array: A = FLTARR( 40, 90, 10) ; Populate it with the value 4.5. (i.e., A[*]= 4.5 ): REPLICATE_INPLACE, A, 4.5 ;Update a single subvector.(i.e., A[*,4,0]= 20. ): REPLICATE_INPLACE, A, 20, 1, [0,4,0] ; Update a group of subvectors.(i.e., A[ 0, [0, 5,89], * ] = -8 ): REPLICATE_INPLACE, A, -8, 3, [0,0,0], 2, [0,5,89] ; Update a 2-dimensional slice of A (i.e., A[9,*, *] = 0.): REPLICATE_INPLACE, A, 0., 3, [9,0,0] , 2, LINDGEN(90)
Introduced: 5.1