Reference Guide > T Routines > TENSOR Functions
  

TENSOR Functions
Compute the generalized tensor product of two arrays.
enabled.
Usage
c = TENSOR_ADD( a, b )
c = TENSOR_DIV( a, b )
c = TENSOR_EQ( a, b )
c = TENSOR_EXP( a, b )
c = TENSOR_GE( a, b )
c = TENSOR_GT( a, b )
c = TENSOR_LE( a, b )
c = TENSOR_LT( a, b )
c = TENSOR_MAX( a, b )
c = TENSOR_MIN( a, b )
c = TENSOR_MOD( a, b )
c = TENSOR_MUL( a, b )
c = TENSOR_NE( a, b )
c = TENSOR_SUB( a, b )
Input Parameters
a—An array.
b—An array.
Keywords
None.
Returned Value
c—The generalized tensor product of a and b. For logical operators (EQ, NE, etc.), a byte type result is returned. Otherwise, the result type depends on the type(s) of the input parameters.
If a is an m dimensional array of dimension lengths a1, ..., am and if b is an n dimensional array of dimension lengths b1, ..., bn then c is a m+n dimensional array with dimension lengths a1, ..., am, b1, ..., bn.
Each element of c is computed as:
c(i1 , . . im, j1 , . . jn) = a(i1 , . . im) % b( j1 , . . jn)
where % symbolizes the operator associated with the selected function. PV-WAVE Operators lists the available PV‑WAVE operators.
 
Table 17-1: PV-WAVE Operators
Function
PV-WAVE Operator
TENSOR_ADD
+
TENSOR_DIV
/
TENSOR_EQ
EQ
TENSOR_EXP
^
TENSOR_GE
GE
TENSOR_GT
GT
TENSOR_LE
LE
TENSOR_LT
LT
TENSOR_MAX
>
TENSOR_MIN
<
TENSOR_MOD
MOD
TENSOR_MUL
*
TENSOR_NE
NE
TENSOR_SUB
Discussion
The TENSOR functions are useful when it is necessary to apply a binary operator to all combinations of elements of one array with elements of a second array.
 
note
The combined dimensions of the two input parameters cannot exceed eight (8). If it does, an error is printed. If input parameters are not of the same type, one will be converted according to the rules used by PV‑WAVE binary operators.
Example
Refer to the Standard Library routine WHEREIN, where TENSOR_EQ is used to perform intersections and other related set operations.
(UNIX) <RW_DIR>/wave/lib/std/wherein.pro
(WIN) <RW_DIR>\wave\lib\std\wherein.pro
See Also
WHEREIN

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.