Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: r_index - Function Up: quanta - Module Previous: r_slice - Function


r_fill - Function



Package general
Module quanta


Fill only a slice of a record array


Synopsis
r_fill(what, ...)


Arguments

what in value(s) that will be filled cyclically in array
    Allowed: any or vector/array of any
... in slicing dimensions
    Allowed: integers, an index record, integer vectors


Returns
record array


Description
r_fill will overwrite a slice of an array of records. It is comparable to an indexed write for standard Glish arrays. The value given as a filler will be re-used cyclically.



Example
- x := dq.unit('5km/s')				# a record
- x::
[id=quant] 
- print a := r_array(x,3,2)			# a record array
[*40=[value=5, unit=km/s], *41=[value=5, unit=km/s], *42=[value=5, unit=km/s],
 *43=[value=5, unit=km/s], *44=[value=5, unit=km/s], *45=[value=5, unit=km/s]]
- a::
[id=quant, shape=[3 2] ] 
- r_fill(dq.unit('2s'), a, 2, 1)		# overwrite an element
T 
- a
[*40=[value=5, unit=km/s], *41=[value=2, unit=s], *42=[value=5, unit=km/s],
 *43=[value=5, unit=km/s], *44=[value=5, unit=km/s], *45=[value=5, unit=km/s]] 
- r_fill(dq.unit(), a, 3,)			# a few more   
T 
- a
[*40=[value=5, unit=km/s], *41=[value=2, unit=s], *42=[value=1, unit=],
 *43=[value=5, unit=km/s], *44=[value=5, unit=km/s], *45=[value=1, unit=]] 
- b := dq.unit('2s')				# see what happens
- b::shape := 2					# if made an array
- r_fill(b, a, 3,)         
T 
- a
[*40=[value=5, unit=km/s], *41=[value=2, unit=s], *42=2,
 *43=[value=5, unit=km/s], *44=[value=5, unit=km/s], *45=s]





next up previous contents index
Next: r_index - Function Up: quanta - Module Previous: r_slice - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01