arithmetic

Parameters

Parameter label

I/O type

Data type

Mandatory parameter?

Default value

inputVec1

input

vector/scalar

yes

inputVec2

input

vector/scalar

yes

operator

input

string ("+"/"-"/"*"/"/"/"log")

no

"+"

divisionByZeroResultsInZero

input

bool

True

“value”

outputVec

output

vector

N/A

N/A

Functionality

If both inputVec1 and inputVec2 are vectors, the module performs the operation given in operator between all corresponding pairs of elements in inputVec1 and inputVec2. If at least one of both input vectors is a scalar, the operation is applied between the scalar and all elements of the other input vector. If operator is set to log, the element-wise natural logarithm of all elements of inputVec1 is computed and returned as outputVec.

If divisionByZeroResultsInZero is True, all division-by-zeros will return 0 instead of Inf.

Here are some simple examples:

operator="+"
inputVec1 = [1,1,1]
inputVec2 = [1,2,3]
...
outputVec = [2,3,4]
operator="+"
inputVec1 = [1,1,1]
inputVec2 = [8]
...
outputVec = [9,9,9]
operator="*"
inputVec1 = [1.1]
inputVec2 = [3]
...
outputVec = [3.3]
operator="log"
inputVec1 = np.array([np.e, np.e**2])
...
outputVec = [1,2]