Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fnrizzi opened this issue Jan 17, 2022 · 1 comment
Open

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

fnrizzi opened this issue Jan 17, 2022 · 1 comment

Comments

@fnrizzi
Copy link
Contributor

fnrizzi commented Jan 17, 2022

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 fnrizzi changed the title vector_norm2: should init be inside sqrt? vector_norm2: should init be inside or outside the sqrt? Jan 17, 2022
@fnrizzi fnrizzi changed the title vector_norm2: should init be inside or outside the sqrt? P1673: vector_norm2: should init be inside or outside the sqrt? Mar 14, 2022
@mhoemmen
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants