vecOverArr Functions
Applies a binary operator to a vector and each vector along one dimension of an array.
enabled.
Usage
result = vecOverArr_and(dim,x,y)
result = vecOverArr_or(dim,x,y)
result = vecOverArr_xor(dim,x,y)
result = vecOverArr_eq(dim,x,y)
result = vecOverArr_ne(dim,x,y)
result = vecOverArr_le(dim,x,y)
result = vecOverArr_lt(dim,x,y)
result = vecOverArr_ge(dim,x,y)
result = vecOverArr_gt(dim,x,y)
result = vecOverArr_min(dim,x,y)
result = vecOverArr_max(dim,x,y)
result = vecOverArr_add(dim,x,y)
result = vecOverArr_sub(dim,x,y)
result = vecOverArr_mul(dim,x,y)
result = vecOverArr_div(dim,x,y)
result = vecOverArr_mod(dim,x,y)
Input Parameters
dim—The dimension on which to operate.
x,y—In either order, these parameters are a numerical vector and a numerical array. The vector must have the same number of elements as dimension dim of the array.
Returned Value
resultAn array of the same dimensions as the input array, where one of the PV-WAVE binary operators has been applied to the vector and each vector along dimension dim of the array. The data type of result is determined by the binary operator and the types of x and y.
Keywords
None.
Discussion
It is often necessary to perform an operation between a vector and each vector along one dimension of an array, most commonly between a vector and each column or row of a matrix. Using the vecOverArr functions for these operations is more convenient and efficient than the alternate methods, which involve REBIN or a FOR loop with subscripting.
Examples
The following three examples use vecOverArr_sub to subtract a vector from each column of a matrix, to subtract a vector from each row of a matrix, and to subtract each row of a matrix from a vector.
a = INDGEN(3,4) 
PM, a
; PV-WAVE prints the following:
;  0       3       6       9
;  1       4       7      10
;  2       5       8      11
PM, vecOverArr_sub(0,a,[0,1,2])
; PV-WAVE prints the following:
;  0       3       6       9
;  0       3       6       9
;  0       3       6       9
PM, vecOverArr_sub(1,a,[0,1,2,3])
; PV-WAVE prints the following:
;  0       2       4       6
;  1       3       5       7
;  2       4       6       8
PM, vecOverArr_sub(1,[0,1,2,3],a)
; PV-WAVE prints the following:
;  0      -2      -4      -6
; -1      -3      -5      -7
; -2      -4      -6      -8
See Also