multiplyVector method

FVector multiplyVector(
  1. FVector vec
)

multiplies this matrix by a vector, resulting with new vector.

Implementation

FVector multiplyVector(FVector vec) {
  assert(vec.nRows == this.nColumns);
  Float32List float32list = Float32List(roundUp4(this.nRows));
  for (int i = 0; i < nRows; ++i) {
    Float32x4List currentRow = rowsData[i];
    Float32x4 sum = Float32x4.zero();
    for (int j = 0; j < currentRow.length; ++j) {
      sum = sum + (currentRow[j] * vec.columnData[j]);
    }
    float32list[i] = sum.x + sum.y + sum.z + sum.w;
  }
  return FVector.fromBuffer(this.nRows, float32list.buffer.asFloat32x4List());
}