P1673: `vector_norm2`: should `init` be inside or outside the `sqrt`?
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 167
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
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),
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the vector_norm2 implementation and its call to vector_sum_of_squares, then compare the return expression with the P1673 specification's sqrt(init + s) formula. Resolve the intended placement of init and ensure the implementation matches the agreed interpretation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100