Arithmetic

+max

Yield the maximum value in an array.

Accepts

A $ray.

Produces

A $ray.

Source

++  max
  ~/  %max
  |=  a=ray
  ?>  (check a)
  =/  fun
    |:  [b=1 c=-:(ravel a)]
    ?.  =(((fun-scalar meta.a %gth) b c) 0)
      b  c
  (scalar-to-ray meta.a (reel (ravel a) fun))

+argmax

Yield the index of the maximum value in an array. Only returns the first match.

Accepts

A $ray.

Produces

A @ud.

Source


+min

Yield the minimum value in an array.

Accepts

A $ray.

Produces

A $ray.

Source


+argmin

Yield the index of the minimum value in an array. Only returns the first match.

Accepts

A $ray.

Produces

A @ud.

Source


+cumsum

Yield the cumulative sum of an array.

Accepts

A $ray.

Produces

A $ray.

Source


+prod

Yield the cumulative product of an array.

Accepts

A $ray.

Produces

A $ray.

Source


+diag

Return the diagonal of an array. Enforces that the array is square, and returns a 2D ($n \times 1$) array of the diagonal elements.

Accepts

A $ray.

Produces

A $ray.

Source


+trace

Compute the trace of an array.

Accepts

A $ray.

Produces

A $ray.

Source


+dot

Dot product of two arrays.

Accepts

A pair of $rays with the same shape.

Produces

A $ray.

Source


+mmul

Multiply two matrices (linear algebra).

Accepts

Parameters as specified in source

Produces

See source for return type details.

Source


+abs

Yield the absolute value of each element of an array as an array.

Accepts

A $ray.

Produces

A $ray.

Source


+add-scalar

Yield the sum of an array and a scalar.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+sub-scalar

Yield the difference of an array and a scalar.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+mul-scalar

Yield the product of an array and a scalar.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+div-scalar

Yield the quotient of an array and a scalar.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+mod-scalar

Yield the modulus of an array and a scalar.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+add

Add two arrays element-wise.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+sub

Subtract two arrays element-wise.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+mul

Multiply two arrays element-wise.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+div

Divide two arrays element-wise.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+mod

Yield the modulus of two arrays element-wise.

Accepts

A pair of $rays with the same shape.

Produces

A $ray.

Source


+pow-n

Raise a $ray to the power of an integer nn.

Accepts

A $ray and an integer power .n (as @ud not @r).

Produces

A $ray.

Source


+gth

Return the element-wise > greater-than comparison of two arrays, yielding a boolean array.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+gte

Return the element-wise >= greater-than-or-equal-to comparison of two arrays, yielding a boolean array.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+lth

Return the element-wise < less-than comparison of two arrays, yielding a boolean array.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+lte

Return the element-wise <= less-than-or-equal-to comparison of two arrays, yielding a boolean array.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+equ

Return the element-wise == equality comparison of two arrays, yielding a boolean array.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+neq

Return the element-wise != inequality comparison of two arrays, yielding a boolean array.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+mpow-n

Raise a matrix to the power of an integer nn.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+is-close

Check if two arrays are close to each other within a specified tolerance, in absolute or relative terms.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+any

Check if any element in an array is loobean false.

Accepts

Parameters as specified in source

Produces

See source for return type details.

Source


+all

Check if all elements in an array are loobean true.

Accepts

Parameters as specified in source

Produces

See source for return type details.

Source


+fun-scalar

Utility function to process a scalar function.

Accepts

Parameters as specified in source

Produces

A $-([@ @] @) gate.

Source


+trans-scalar

Utility function to produce a gate for scalar operations.

Accepts

Parameters as specified in source

Produces

A $-(@ @) gate.

Source


+el-wise-op

Utility function to operate element-wise on an array.

Accepts

Produces

A $ray.

Source


+bin-op

Utility function to perform a binary operation on two arrays.

Accepts

Parameters as specified in source

Produces

A $ray.

Source


+ter-op

Utility function to perform a ternary operation on three arrays.

Accepts

Parameters as specified in source

Produces

A $ray.

Source

Last updated