ndarray.bend checks
raw source on the hub · import bend-ndarray@0.1.0.0/ndarray.bend as Ndarray
bend-ndarray: n-dimensional arrays for Bend 2, in the manner of NumPy.
import bend-ndarray@<version>/ndarray.bend as NP
An ND is a dtype, a shape (a list of Nats) and its elements. Every operation takes its arrays and answers a new one (no views; NP.clone makes two of one). An operation that can fail (shapes that do not broadcast, an axis that does not exist, two dtypes) answers Result<&1, &1, NP.Err, ND>: Done{array} or Fail{why}. dtypes: f32, i32, u32, u8 and bool; an operation takes one dtype (NP.astype converts), and integers wrap around. Shapes follow NumPy (shape.bend and LAWS.bend: broadcasting proved to be NumPy's rule).
4 imports
import Base import ./shape.bend as S import ./cells.bend as C import ./tree.bend as T
Types
type ND source · line 15 · raw
Type
ND@dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @shape:List<&2, Nat> -> @data:Array<U32> -> ND
Definitions
def f32 source · line 20 · raw
0x3812e108d3d3723b9d582970dd383a5c/shape.DType
def i32 source · line 23 · raw
0x3812e108d3d3723b9d582970dd383a5c/shape.DType
def u32 source · line 26 · raw
0x3812e108d3d3723b9d582970dd383a5c/shape.DType
def u8 source · line 29 · raw
0x3812e108d3d3723b9d582970dd383a5c/shape.DType
def bool source · line 32 · raw
0x3812e108d3d3723b9d582970dd383a5c/shape.DType
def dt_eq source · line 35 · raw
@a:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @b:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> Bool
def dt_name source · line 50 · raw
@dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> String
def nat_strs source · line 63 · raw
@s:List<&2, Nat> -> List<&2, String>
def shape_str source · line 71 · raw
@+s:List<&2, Nat> -> String
a shape as Python writes it: (2, 3), (4,), ()
def why source · line 75 · raw
@e:0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr -> String
an error in words
def dtype source · line 104 · raw
@a:ND -> Pair(0x3812e108d3d3723b9d582970dd383a5c/shape.DType, ND)
def shape source · line 109 · raw
@a:ND -> Pair(List<&2, Nat>, ND)
def clone_got source · line 114 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @p:Pair(Array<U32>, Array<U32>) -> Pair(ND, ND)
def clone source · line 121 · raw
@a:ND -> Pair(ND, ND)
def full source · line 126 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @+v:U32 -> ND
def zeros source · line 129 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> ND
def one_of source · line 132 · raw
@dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> U32
def ones source · line 139 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> ND
def count_pick source · line 142 · raw
@ok:Bool -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @xs:List<&2, U32> -> @+got:Nat -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def from_list source · line 150 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @+xs:List<&2, U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
an array of shape s from its elements in row-major order (cells: float32 bits for f32, see cells.bend)
def bits_of source · line 153 · raw
@xs:List<&2, F32> -> List<&2, U32>
def floats_of source · line 160 · raw
@xs:List<&2, U32> -> List<&2, F32>
def from_f32s source · line 168 · raw
@+s:List<&2, Nat> -> @xs:List<&2, F32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a float32 array from floats
def to_list source · line 172 · raw
@a:ND -> List<&2, U32>
the elements in row-major order (cells)
def to_f32s source · line 177 · raw
@a:ND -> List<&2, F32>
def range_cells source · line 180 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @i:Nat -> @+n:Nat -> List<&2, U32>
def arange source · line 188 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+n:Nat -> ND
0, 1, ..., n - 1
def lin_cells source · line 191 · raw
@+start:F32 -> @+step:F32 -> @+stop:F32 -> @i:Nat -> @+n:Nat -> List<&2, U32>
def linspace source · line 201 · raw
@+start:F32 -> @+stop:F32 -> @+num:Nat -> ND
num float32s from start to stop, both included
def eye_cells source · line 204 · raw
@+one:U32 -> @i:Nat -> @+n:Nat -> List<&2, U32>
def eye source · line 212 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+n:Nat -> ND
the n x n identity
def out_dt source · line 217 · raw
@op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> 0x3812e108d3d3723b9d582970dd383a5c/shape.DType
def bin_shaped source · line 220 · raw
@r:Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>> -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+sa:List<&2, Nat> -> @+sb:List<&2, Nat> -> @ta:Array<U32> -> @tb:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def bin_typed source · line 227 · raw
@ok:Bool -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+sa:List<&2, Nat> -> @+sb:List<&2, Nat> -> @ta:Array<U32> -> @tb:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def bin_same source · line 234 · raw
@same:Bool -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+da:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+db:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+sa:List<&2, Nat> -> @+sb:List<&2, Nat> -> @ta:Array<U32> -> @tb:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def binop source · line 242 · raw
@+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a binary operation (cells.bend's B2), broadcasting a and b
def add source · line 247 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def subtract source · line 250 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def multiply source · line 253 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def divide source · line 257 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
true division, float32 only (integers: floor_divide)
def floor_divide source · line 260 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def remainder source · line 263 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def minimum source · line 266 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def maximum source · line 269 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def power source · line 272 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def equal source · line 275 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def not_equal source · line 278 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def less source · line 281 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def less_equal source · line 284 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def greater source · line 287 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def greater_equal source · line 290 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def logical_and source · line 293 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def logical_or source · line 296 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def logical_xor source · line 299 · raw
@a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def un_typed source · line 302 · raw
@ok:Bool -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.U1 -> @+name:String -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def negative source · line 309 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def absolute source · line 314 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def logical_not source · line 319 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def astype source · line 325 · raw
@a:ND -> @+to:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> ND
the same elements as another dtype (float32 to integers rounds toward zero; to uint8 wraps; to bool: nonzero)
def relaid source · line 332 · raw
@dense:Bool -> @+s:List<&2, Nat> -> @+s2:List<&2, Nat> -> @d:Array<U32> -> Array<U32>
def reshaped source · line 340 · raw
@r:Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>> -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
between two shapes without padding the tree is already in row-major order, so it stays as it is
def reshape source · line 348 · raw
@a:ND -> @+s2:List<&2, Nat> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
the same elements, in row-major order, in shape s2
def index_of source · line 353 · raw
@+x:Nat -> @xs:List<&2, Nat> -> Nat
def down source · line 361 · raw
@j:Nat -> @+k:Nat -> List<&2, Nat>
k, ..., j - 1 counted down: the adjacent swaps that bring position j to k
def move source · line 368 · raw
@+cur:List<&2, Nat> -> @+j:Nat -> @+k:Nat -> List<&2, Nat>
def iota source · line 371 · raw
@i:Nat -> @+n:Nat -> List<&2, Nat>
def plan source · line 379 · raw
@perm:List<&2, Nat> -> @+k:Nat -> @+cur:List<&2, Nat> -> List<&2, Nat>
the adjacent swaps (i with i + 1) that turn axes 0 .. n - 1 into perm
def swap_dims source · line 386 · raw
@+s:List<&2, Nat> -> @+i:Nat -> List<&2, Nat>
def apply_swaps source · line 389 · raw
@sw:List<&2, Nat> -> @+s:List<&2, Nat> -> @t:Array<U32> -> Array<U32>
def transposed source · line 396 · raw
@r:Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>> -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @+perm:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def transpose source · line 404 · raw
@a:ND -> @+perm:List<&2, Nat> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
axes permuted: result axis k is a's axis perm[k]
def rev_iota source · line 409 · raw
@i:Nat -> List<&2, Nat>
def t source · line 417 · raw
@a:ND -> ND
the axes reversed (NumPy's a.T)
def expanded source · line 422 · raw
@ok:Bool -> @+axis:Nat -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def expand_dims source · line 430 · raw
@a:ND -> @+axis:Nat -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a new axis of length 1 at axis (0 .. ndim)
def squeezed source · line 435 · raw
@ok:Bool -> @+axis:Nat -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def squeeze source · line 443 · raw
@a:ND -> @+axis:Nat -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
axis removed; it must have length 1
def bto_pick source · line 448 · raw
@ok:Bool -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @+s2:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def broadcast_to source · line 456 · raw
@a:ND -> @+s2:List<&2, Nat> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a stretched to shape s2 (a must fit s2)
def sliced2 source · line 461 · raw
@+m:Nat -> @+ax:Nat -> @+start:Nat -> @+step:Nat -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def sliced source · line 464 · raw
@ok:Bool -> @+ax:Nat -> @+start:Nat -> @+stop:Nat -> @+step:Nat -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def slice source · line 472 · raw
@a:ND -> @+axis:Nat -> @+start:Nat -> @+stop:Nat -> @+step:Nat -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a[..., start:stop:step, ...] along axis (step >= 1; start and stop clamped to the axis, as Python's slices)
def joined source · line 477 · raw
@r:Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>> -> @+ax:Nat -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+sa:List<&2, Nat> -> @+sb:List<&2, Nat> -> @ta:Array<U32> -> @tb:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def join_same source · line 485 · raw
@same:Bool -> @+ax:Nat -> @+da:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+db:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+sa:List<&2, Nat> -> @+sb:List<&2, Nat> -> @ta:Array<U32> -> @tb:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def concatenate source · line 493 · raw
@+axis:Nat -> @a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a and b joined along axis (equal on every other axis)
def stack_same source · line 498 · raw
@same:Bool -> @+ax:Nat -> @a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def stack_go source · line 505 · raw
@+ax:Nat -> @a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def stack source · line 511 · raw
@+axis:Nat -> @a:ND -> @b:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a and b (the same shape) joined along a new axis
def identity source · line 517 · raw
@op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> Maybe<&2, U32>
the cells an empty reduction gives: sum 0, prod 1, all true, any false; min and max have none
def red_empty source · line 530 · raw
@m:Maybe<&2, U32> -> @+ax:Nat -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s2:List<&2, Nat> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def red_n source · line 537 · raw
@empty:Bool -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+ax:Nat -> @+keep:Bool -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def red_ok source · line 544 · raw
@ok:Bool -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+name:String -> @+ax:Nat -> @+keep:Bool -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def red_dt source · line 551 · raw
@op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> Bool
def reduce source · line 561 · raw
@+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+name:String -> @a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a reduction along axis, the axis kept as length 1 with keep; pairs combine left to right, as a balanced tree
def sum source · line 566 · raw
@a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def prod source · line 569 · raw
@a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def min source · line 572 · raw
@a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def max source · line 575 · raw
@a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def all source · line 578 · raw
@a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def any source · line 581 · raw
@a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def scale_by source · line 584 · raw
@r:Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND> -> @+n:Nat -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def mean_ok source · line 591 · raw
@ok:Bool -> @a:ND -> @+axis:Nat -> @+keep:Bool -> @+n:Nat -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def mean source · line 599 · raw
@a:ND -> @+axis:Nat -> @+keep:Bool -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
the mean along axis, float32 only (of a 0-length axis: nan, as NumPy)
def red_all_go source · line 605 · raw
@k:Nat -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+name:String -> @r:Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
a reduction over every element: the axes reduced one at a time, the last first (a 0-d result)
def ndim_of source · line 612 · raw
@a:ND -> Pair(Nat, ND)
def red_all_at source · line 617 · raw
@p:Pair(Nat, ND) -> @+op:0x3812e108d3d3723b9d582970dd383a5c/cells.B2 -> @+name:String -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def sum_all source · line 622 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def prod_all source · line 625 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def min_all source · line 628 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def max_all source · line 631 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def all_all source · line 634 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def any_all source · line 637 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def mean_all_ok source · line 640 · raw
@ok:Bool -> @+n:Nat -> @a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
def mean_all source · line 648 · raw
@a:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
the mean of every element, float32 only
def in_bounds source · line 655 · raw
@idx:List<&2, Nat> -> @s:List<&2, Nat> -> Bool
def cell_index source · line 665 · raw
@idx:List<&2, Nat> -> @s:List<&2, Nat> -> @+acc:Nat -> Nat
the cell index of element idx: each axis's index in its dep(n) bits, the first axis's highest
def got source · line 672 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @r:Pair(Array<U32>, U32) -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, Pair(U32, ND)>
def get_ok source · line 677 · raw
@ok:Bool -> @+idx:List<&2, Nat> -> @+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+s:List<&2, Nat> -> @d:Array<U32> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, Pair(U32, ND)>
def get source · line 685 · raw
@a:ND -> @+idx:List<&2, Nat> -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, Pair(U32, ND)>
element idx (one index per axis) and the array back
def and_then source · line 693 · raw
@r:Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND> -> @f:(@_:ND -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>) -> Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND>
f applied to r's array, or r's error
def cell_str source · line 701 · raw
@dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @+x:U32 -> String
one element as NumPy prints it
def strs_of source · line 712 · raw
@+dt:0x3812e108d3d3723b9d582970dd383a5c/shape.DType -> @xs:List<&2, U32> -> List<&2, String>
def stake source · line 719 · raw
@n:Nat -> @xs:List<&2, String> -> List<&2, String>
def sdrop source · line 726 · raw
@n:Nat -> @xs:List<&2, String> -> List<&2, String>
def groups source · line 734 · raw
@k:Nat -> @+n:Nat -> @+sep:String -> @+xs:List<&2, String> -> List<&2, String>
k groups of n strings, each joined by sep in brackets
def times source · line 741 · raw
@k:Nat -> @+s:String -> String
def sep source · line 749 · raw
@+i:Nat -> @+d:Nat -> String
NumPy's separator between the items of axis i of d: a space innermost, else newlines and an indent
def first_str source · line 752 · raw
@xs:List<&2, String> -> String
def fmt source · line 760 · raw
@rs:List<&2, Nat> -> @+d:Nat -> @+strs:List<&2, String> -> String
the axes from the innermost out (rs reversed), grouping the strings at each
def to_string source · line 768 · raw
@a:ND -> String
the array as NumPy prints it: [[0 1 2]\n [3 4 5]]
def show source · line 774 · raw
@r:Result<&1, &1, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, ND> -> String
a result as text: the array, or "error: " and why