The VECTOR ELM MAP function is a convenient way of moving back and forth between disparate subscript ranges. In many cases it is possible to accomplish the same thing using the mapping capabilities of subscripts which can improve error checking.
The VECTOR ELM MAP function returns the value of the variable that is offset from vec by the specified amount. For example, when sub : s1,s2,s3 is a subscript, the following two equations would be the same:
var2[sub] = var1[sub] ~~|
var2[sub] = VECTOR ELM MAP(var1[s1],sub-1) ~~|
Note that in this case we use sub-1 because offset is effectively 0 based. One obvious use for this function is in situations where you want to have a variable with one subscript map to a variable with a different subscript. For example:
task : dig,build,test ~~|
skill : brawn,brain ~~|
task skill[task] = 0,1,1 ~Dmnl~|
avg task skill[task] =
VECTOR ELM MAP(avg labor skill[brawn],task skill[task]) ~Qua~|
Because you can do arbitrary mappings in this manner it is a very flexible function for managing nonstandard subscript use.
Units: VECTOR ELM MAP(units,dmnl) --> units
The offset expression should be dimensionless.
If you try to use an offset that would take your mapping outside the range of the variable an error message will be issued and :NA: will be returned.
Note that for variables that have more than one subscript the VECTOR ELM MAP function can be used to move between all subscripts but will require multiplication. For example the following two expressions are the same:
v2[sub,tub,gub] = v[sub,tub,gub] ~~|
v2[sub,tub,gub] = VECTOR ELM MAP(v[s1,t1,g1],
(sub-1)*ELMCOUNT(tub)*ELMCOUNT(gub) +
(tub-1) * ELMCOUNT(gub) + (gub-1)) ~~|
Availability: Professional and DSS only.
See also: VECTOR SELECT, VECTOR SORT ORDER
Sample model: VECTOR ELM MAP.mdl in FunctionExamples