strideMatInstantiateCheck

vecxt.strideMatInstantiateCheck

strideMatInstantiateCheck performs a set of safety checks when constructing a matrix view with arbitrary strides and offset into a backing array. The checks include:

  • Ensuring the number of rows and columns are positive.
  • Ensuring the offset is within the bounds of the backing array.
  • Ensuring both rowStride and colStride are non-zero.
  • Calculating the maximum and minimum indices that could be accessed by the matrix view, given the strides and offset, and ensuring these indices are within the bounds of the array.
  • Throws appropriate exceptions if any check fails.

Validates matrix construction parameters for stride-based layout.

Performs comprehensive bounds checking for matrices with flexible stride patterns, including support for broadcasting (zero strides) and negative strides for flipped views.

Validates:

  • Positive matrix dimensions
  • Valid offset within array bounds
  • Sensible stride values (zero for broadcasting, non-zero otherwise)
  • All matrix elements remain within array bounds
  • Negative strides don't cause negative index access
  • 1x1 matrices have semantically meaningful strides (0 or 1)

Value parameters

colStride

Memory offset between consecutive columns

cols

Number of matrix columns

offset

Starting position in the data array

raw

The underlying data array

rowStride

Memory offset between consecutive rows

rows

Number of matrix rows

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

inline def apply[A](raw: Array[A], rows: Row, cols: Col, rowStride: Int, colStride: Int, offset: Int)(using inline doCheck: BoundsCheck): Unit