module
Phase::CoordUtil
Overview
A collection of utility functions for putting coordinates (whose ordinates may be positive, forward indexes, or negative, reverse indexes) into canoncial form.
Extended Modules
Defined in:
coord_util.crInstance Method Summary
-
#canonicalize_coord(coord, shape) : Coord
Converts a
coordinto canonical form, such that each index incoordis positive. -
#canonicalize_index(index, shape, axis)
Returns the canonical (positive) form of
indexalong a particularaxisofshape. -
#canonicalize_index(index, size)
Returns the canonical (positive) form of
indexalong a particular axis of a givensize(number of elements). -
#has_coord?(coord, shape)
Checks if
coordis a valid coordinate for an array-like object with dimensions specified byshape. -
#has_index?(index, shape, axis)
Checks if
indexis a valid index alongaxisfor an array-like object with dimensions specified byshape. - #has_index?(index, size : Int::Unsigned)
-
#has_index?(index, size : Int)
Returns true if a given
indexcan be used to access an array axis withsizeelements.
Instance Method Detail
Converts a coord into canonical form, such that each index in coord is positive.
Throws an IndexError if at least one index specified in coord is out of range for the
corresponding axis of shape.
Returns the canonical (positive) form of index along a particular axis of shape.
Throws an IndexError if index is out of range of shape along this axis.
Returns the canonical (positive) form of index along a particular axis of a given size (number of elements).
Throws an IndexError if index is not a valid positive or negative array index for size elements.
Checks if coord is a valid coordinate for an array-like object with dimensions specified by shape.
A coord is a list (Enumerable) of integers specifying an index along each axis in shape.
Checks if index is a valid index along axis for an array-like object with dimensions specified by shape.
Returns true if a given index can be used to access an array axis with size elements.