Convenience functions
+lake
+lakeAccepts
Rounding mode, one of ?(%n %u %d %z).
Produces
Specialized version of ++la core.
Source
++ lake
|= [inrnd=rounding-mode]
%*(. la rnd inrnd)
::Discussion
Lagoon operators are accessed through the ++la container core. This is a door which supplies necessary mathematical details for the implementation (which may be ignored for certain types).
For instance, by default ++la implements round-to-zero IEEE 754 behavior, much as the ++rs etc. doors in vanilla Hoon. This may be overridden using the ++lake gate:
(lake %u) :: resolve to round-upwards behavior+print
+printPretty-print an array.
Accepts
A $ray.
Produces
A $tank %slog (as side effect) and ~.
Source
+slog
+slogUtility function to print an array.
Accepts
A $ray.
Produces
A $tank %slog (as side effect) and ~.
Source
+to-tank
+to-tankConvert a $ray to a $tank.
Accepts
A list of data, a shape as a list of dimensions, and the scalar type as a $kind.
Produces
A tank.
Source
+get-term
+get-termUtility function to get the term tag associated with a $ray's metadata type.
Accepts
A $meta of the target shape and parameters.
Produces
A %slog-compatible tag as a term.
Source
+squeeze
+squeezeConvert a noun into a typed list.
Accepts
See source for parameter details.
Produces
See source for return type details.
Source
+submatrix
+submatrixProduce a submatrix from a $ray using slice notation.
Accepts
A $slice and a $ray.
Produces
A $ray.
Source
+product
+productProduce the cartesian product of two lists.
Accepts
A pair of lists.
Produces
The cartesian product as a list of pairs.
Source
+gather
+gatherUtility function to gather indices for submatrix extraction.
Accepts
A (list (list (list @))).
Produces
A (list (list @))
Source
+get-item
+get-itemGet item at index from a $ray.
Accepts
A $ray and target index as a list of multi-dimensional indices. Crashes if index is out of bounds.
Produces
A @ux.
Source
+set-item
+set-itemSet item at index in a $ray.
Accepts
A $ray, target index as a list of multi-dimensional indices, and the value to set.
Produces
A $ray.
Source
+get-row
+get-rowGet row at index from a $ray.
Accepts
A $ray and target index as a single-entry list of multi-dimensional indices.
Produces
A $ray of dimension .
Source
+set-row
+set-rowSet row at index in a $ray.
Accepts
A $ray, target index as a list of multi-dimensional indices, and the row to set.
Produces
A $ray.
Source
+get-col
+get-colGet column at index from a $ray.
Accepts
A $ray and target index as a single-entry list of multi-dimensional indices.
Produces
A $ray of dimension .
Source
+set-col
+set-colSet column at index in a $ray.
Accepts
A $ray, target index as a list of multi-dimensional indices, and the column to set.
Produces
A $ray.
Source
+get-bloq-offset
+get-bloq-offsetUtility function to get the bloq offset of an n-dimensional index.
Accepts
A $ray and target index as a list of multi-dimensional indices.
Produces
A $bloq offset @.
Source
+get-item-number
+get-item-numberUtility function to convert an n-dimensional index to a scalar index.
Accepts
A shape as a list of dimensions and a scalar index as a list of multi-dimensional indices.
Produces
A scalar index @.
Source
+strides
+stridesReturn the stride in each dimension: row, col, layer, etc.
Accepts
A $meta of the target shape and parameters.
Produces
A (list @).
Source
Discussion
The stride is reported in units of bits.
+get-dim
+get-dimUtility function to convert a scalar index to an n-dimensional index.
Accepts
A shape as a list of dimensions and a scalar index.
Produces
The -dimensional index as a (list @).
Source
+get-item-index
+get-item-indexUtility function to get the item index from a multi-dimensional index.
Accepts
A shape as a list of dimensions and a scalar index.
Produces
An index @.
Source
+ravel
+ravelUtility function to flatten a $ray into a list of atoms.
Accepts
A $ray.
Produces
A (list @).
Source
+en-ray
+en-rayConvert a $baum to a $ray.
Accepts
A $baum (or unwrapped $ray).
Produces
A $ray.
Source
+de-ray
+de-rayUtility function to convert a $ray to a $baum.
Accepts
A $ray.
Produces
A $baum (or unwrapped $ray).
Source
+rip
+ripUtility function to recursively rip a bite into a list of atoms.
Accepts
A target $bite and an atom to rip .b.
Produces
A (list @).
Source
+check
+checkCheck if a $ray is valid according to its metadata.
Accepts
A $ray.
Produces
A $flag.
Source
+get-item-baum
+get-item-baumUtility function to get an item from a $baum at a multi-dimensional index.
Accepts
Parameters as specified in source.
Produces
An item as raw @.
Source
+fill
+fillFill a $ray with a scalar value.
Accepts
A target $meta and a value to fill the array with.
Produces
A $ray.
Source
+spac
+spacUtility function to add a pinned 0x1 MSB to an in-flight $ray's data to preserve leading zeros. For internal library use only.
Accepts
A $ray.
Produces
A $ray.
Source
+unspac
+unspacUtility function to remove the pinned 0x1 MSB from an in-flight $ray's data. For internal library use only.
Accepts
A $ray.
Produces
An in-flight $ray.
Source
+scalar-to-ray
+scalar-to-rayConvert a scalar value to an $n$-dimensional $ray.
Accepts
A $meta of the target shape and parameters, and the single value as an atom .data.
Produces
A $ray.
Source
+change
+changeUtility function to change the type of a $ray's metadata.
Accepts
Parameters as specified in source
Produces
A $ray.
Source
Last updated