normalize.vector: Normalize a Numeric Vector to Unit Length
Description
Returns the input vector normalized to have unit Euclidean norm (i.e., length equal to 1).
Usage
normalize.vector(v)
Value
A numeric vector of the same length as v, with unit norm.
Arguments
v
A numeric vector.
Details
This function performs:
$$v_\text{normalized} = \frac{v}{\sqrt{\sum v_i^2}}$$
It is primarily used to normalize weight vectors or component directions in Partial Least Squares algorithms.
Note: If the input vector has zero norm, the function returns NaN due to division by zero.