Computes the Euclidean (L2) norm of each row of a numeric matrix, with the rows divided across threads by OpenMP.
Value
A numeric vector with one entry per row of x, each the square root of
the sum of squares of that row.
Details
The #pragma omp parallel for directive splits the outer loop over rows
across the available OpenMP threads. The directive is only meaningful when
the package is compiled with OpenMP support; without it the loop simply
runs serially.
Only the input matrix is read and the pre-allocated output vector is written inside the parallel region, and each thread writes a distinct index. No R API is touched inside the loop, which is what keeps the routine thread-safe.