stdBLAS icon indicating copy to clipboard operation
stdBLAS copied to clipboard

P1673: `vector_norm2`: should `init` be inside or outside the `sqrt`?

Open fnrizzi opened this issue 4 years ago • 1 comments

In the impl we have:

  // Compute the sum of squares using an algorithm that avoids
  // underflow and overflow by scaling.
  auto ssq_res = vector_sum_of_squares(exec, x, ssq_init);
  using std::sqrt;
  return init + ssq_res.scaling_factor * sqrt(ssq_res.scaled_sum_of_squares);
}

but in the spec we have:

For N equal to v.extent(0), the mathematical expression for the algorithm is sqrt(init + s), 

fnrizzi avatar Jan 17 '22 07:01 fnrizzi

In P1673R7 (to be submitted tonight), I added wording to the spec to clarify init.

mhoemmen avatar Apr 15 '22 04:04 mhoemmen