Various utilities for elementwise operations on arrays; allows more concise expression of elementwise equality, comparison, and arithmetic. These functions are available in the local scope in the Add/Remove Voxels and PowerEdit tools.
Examples:
a = [1, 2, 3, 4]
b = [1, 2, 3, 4]
equal a, b # true
c = [4, 5, 6, 7]
d = [2, 3, 4, 5]
sub c, d # [2, 2, 2, 2]
Call methods with.name()
,.name(arguments)
or just .name arguments
.
a
, b
)
-> Array
#Elementwise adds a
and b
. If the arrays are different lengths,
an array of the shorter length is returned.
Array
Array
Array
a
)
-> Boolean
#Returns true
if all elements of a
evaluate to true
Array
Boolean
a
)
-> Boolean
#Returns true
if any elements of a
evaluate to true
Array
Boolean
a
, b
)
-> -1/0/1
#Performs lexicographic, elementwise comparison on a and b; if a
is
the "larger" array, returns 1
; if b
is larger, returns -1
; else
returns 0
.
Arrays are first compared based on length (longer is larger), then
each element is compared in sequence (a[0]
vs b[0]
, then
a[1]
vs. b[1]
, and so on).
Array
Array
-1/0/1
1
if a
is greater, -1
if b
is greater, 0
if equal
a
, b
)
-> Array
#Elementwise divides a
and b
. If the arrays are different lengths,
an array of the shorter length is returned.
Array
Array
Array
a
, b
)
-> Boolean
#Returns true
if a
is elementwise greater than b
, else false
Array
Array
Boolean
a
, b
)
-> Boolean
#Returns true
if a
is elementwise greater than or equal to b
, else false
Array
Array
Boolean
a
, b
)
-> Boolean
#Returns true
if a
is elementwise less than b
, else false
Array
Array
Boolean
a
, b
)
-> Boolean
#Returns true
if a
is elementwise less than or equal to b
, else false
Array
Array
Boolean
a
, b
)
-> Array
#Elementwise multiplies a
and b
. If the arrays are different lengths,
an array of the shorter length is returned.
Array
Array
Array
a
, b
)
-> Array
#Elementwise subtracts a
and b
. If the arrays are different lengths,
an array of the shorter length is returned.
Array
Array
Array
a
)
-> Number
#Returns the sum of the elements in a
Array
Number
Sum of elements in a