[algorithms, numerics] Replace "exactly" with "at most" in Complexity#7364
[algorithms, numerics] Replace "exactly" with "at most" in Complexity#7364frederick-vs-ja wants to merge 1 commit into
Conversation
a5c42f2 to
56ad45c
Compare
|
@jwakely ? |
|
This doesn't seem like an improvement. Do we want implementations to be allowed to perform fewer than If that's allowed, I can make my implementation much faster. |
|
I agree that for some cases like Is the concern that an exception could cause the loop to finish early? Because I don't think we care about that for the Complexity elements. |
56ad45c to
81ddcdf
Compare
81ddcdf to
34dac39
Compare
|
@jwakely Do you think an LWG would be desired? As [structure.specifications]/7 says:
It's arguably wrong to say "exactly". But sometimes we exactly want "exactly". |
|
For [structure.specifications], it seems like an "unless otherwise specified" would do the job. The point of saying the complexities are upper bounds is that we can then write
And it's clear that the "linear" is an upper bound. An "exactly" complexity presumably supersedes that. |
|
I'm also open to consider that [structure.specifications] is simply not quite right. It may have started as the plan for how to specify the library, but then it turned out that in specific cases we have more information and can provide exact counts rather than asymptotics, but we never mention that in the description of the element. It certainly seems unnecessary to say "at most" if we already impy "upper bounds". But moreso: I wonder if we even have a category error and underspecification here: "last - first" is a different kind of thing from "linear". The first is a count, the latter is, presumably, an asymptotic statement. It's not clear that we can even apply the notion of "upper bound" across both; at the very least that would mean very different things: an upper bound on a count is about numbers, but an upper bound on asymptotics would be about the growth (e.g. "upper bound: linear" would allow for "actually logarithmic", but not "actually quadratic"). But [structure.specifications] doesn't say what it means by "complexity", so I don't know how and whether we should change the concrete descriptions we have. I think this should be an LWG issue. |
Fixes #5636.
Per the discussion in that issue, I think this can be editorial. Although it seems to me that some "exactly" are actually exact.