gemv function

void gemv(
  1. Float32List w,
  2. Float32List x,
  3. Float32List y,
  4. int rows,
  5. int cols,
)

y0:rows = wrows, cols * x0:cols.

Shapes are validated here because the inner loop runs without bounds checks. All lists must start on a 16-byte boundary of their buffer.

Implementation

void gemv(Float32List w, Float32List x, Float32List y, int rows, int cols) {
  if (cols % 4 != 0 ||
      w.length < rows * cols ||
      x.length < cols ||
      y.length < rows ||
      w.offsetInBytes % 16 != 0 ||
      x.offsetInBytes % 16 != 0) {
    throw ArgumentError(
      'gemv: bad shapes rows=$rows cols=$cols w=${w.length} '
      'x=${x.length} y=${y.length}',
    );
  }
  _gemvUnchecked(
    Float32x4List.sublistView(w, 0, rows * cols),
    Float32x4List.sublistView(x, 0, cols),
    y,
    rows,
    cols ~/ 4,
  );
}