normalize method

Vector normalize()

Normalizes this Vector to have magnitude 1.0

Vector a = Vector.fillRow(4, 4.0);
Vector b = a.normalize();
print( b );

prints

[0.5, 0.5, 0.5, 0.5]

Implementation

Vector normalize() {
  return Vector.fromMatrix(this._matrix * (1.0 / norm()));
}