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_slice - Function Up: quanta - Module Previous: is_quantity - Function


r_array - Function



Package general
Module quanta


Create an array or vector of records


Synopsis
r_array(a, ..., id)


Arguments

a in initial filling value(s)
    Allowed: any or array of any
    Default: empty record
... in coordinate lengths for each dimension
    Allowed: non-zero integer
id in optional record id
    Allowed: string


Returns
record array


Description

r_array creates an array of records. Record arrays were introduced to be able to communicate arrays/vectors of arbitrary data types to and from C++ code. Most special records (quanta, measures, skycomponents etc.) will have an id attribute to identify them across the system, but this id is not essential. Arrays of records have always a shape attribute, to distinguish them from a 'scalar' record. They are created in the same way as normal Glish arrays (except using r_array). The function accepts an additional, optional, argument to set an id if wanted. A vector with length one is assumed to be a scalar (a multidimensional array with 1 element will be an array).



Example
- print a := r_array(1:5, 2, 3)			# create an array
[*3=1, *4=2, *5=3, *6=4, *7=5, *8=1]
- a::						# show the attributes
[shape=[2 3] ] 
- print a := r_array(1:5, 2, 3, id='quant')	# another
[*9=1, *10=2, *11=3, *12=4, *13=5, *14=1]
- a::						# and its attributes
[id=quant, shape=[2 3] ] 
- r_array(a,1)					# a 'scalar'
1
- r_array(a,2,1)				# initial with record array 
[*17=1, *18=2]





next up previous contents index
Next: r_slice - Function Up: quanta - Module Previous: is_quantity - 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