Builders
+eye
+eyeIdentity matrix of shape nxn.
Accepts
A $meta.
Produces
A $ray.
Source
++ eye :: produces identity matrix of shape nxn.
|= =meta
^- ray
~_ leaf+"lagoon-fail"
?> =(2 (lent shape.meta))
?> =((snag 0 shape.meta) (snag 1 shape.meta))
=/ n (snag 0 shape.meta)
=< +
%^ spin
(gulf 0 (dec n))
^- ray (zeros [~[n n] bloq.meta kind.meta ~])
|= [i=@ r=ray]
:: [i (set-item r ~[i i] 1)]
:- i
%^ set-item
r
~[i i]
^- @
?- kind.meta
%uint `@`1
::
%int2 !!
::
%i754
?+ bloq.meta ~|(bloq.meta !!)
%7 .~~~1
%6 .~1
%5 .1
%4 .~~1
==
==+zeros
+zerosAn array containing only zeros as values.
Accepts
A $meta of the target shape and parameters.
Produces
A $ray.
Source
+ones
+onesAn array containing only ones as values.
Accepts
A $meta of the target shape and parameters.
Produces
A $ray.
Source
+iota
+iotaProduce a 1-dimensional index array. Only produces %uint. Note that this runs from 0 to . (The point of +iota is to be an index, so it needs to pattern-match the context rather than slavishly follow APL.)
Accepts
A $meta of the target shape and parameters.
Produces
A $ray.
Source
Discussion
The target shape is determined from the length of .shape in .meta.
+magic
+magicProduce a magic square in dimensions.
Accepts
A $meta of the target shape and parameters.
Produces
A $ray.
Source
+range
+rangeProduce a 1-dimensional range along one dimension as with interval . Only produces %i754.
Accepts
A $meta of the target shape and parameters.
Produces
A $ray.
Source
+linspace
+linspaceProduce a 1-dimensional range along one dimension as with number of steps . Only produces %i754.
Accepts
A $meta of the target shape and parameters, a pair of left-hand and right-hand bounds, and a number of intervals.
Produces
A $ray.
Source
Discussion
The number of intervals n overrides any size specified in the input $meta.
+urge
+urgeCoerce 1D array along specified dimension with given overall dimensionality.
Accepts
A $ray, a target dimension index .i, and a resulting overall dimensionality .n.
Produces
A $ray.
Source
+scale
+scaleProduce an -dimensional array containing a single value.
Accepts
A $meta of the target shape and parameters, and the single value as an atom.
Produces
A $ray.
Source
Last updated