You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The caller must pass ownership of other. Thus, anyone who wants to use this method must clone other, which seems wasteful. Instead the type of other should be &Self. But this item is obsoleted by the next item...
The only use of other in this implementation is to call other.size(), which merely returns a usize struct field. Thus, there is no need for an already-constructed EvaluationDomain for other here. Indeed, I suspect a common use of this method is where a caller knows the size of other but hasn't actually constructed a EvaluationDomain for it. In those use cases this method forces the caller to construct an EvaluationDomain just to call this method. I suggest changing the type of other from Self to usize. In that case it's name should be changed to something like other_domain_size.
Code comments are hard for me to understand. Seems like the rustdoc for this method should read something like
/// Convert `index` from [an index into an element from `other`] into [an index of an element from `self`].////// `other` must be a sub-domain of `self`./// etc.
It's not clear to me why this method should allow index >= other.size(). Shouldn't this be an out-of-bounds error?
I think I now understand the purpose for this case.
I suspect most use cases care only about where the indexth element of other occurs within self; this is the case index < other.size(). But some cases might wish to reorder all elements of self so that elements of other appear first. Such use cases can use reindex_by_subdomain to find where the indexth element of self occurs in this new ordering, including those index >= other.size().
Let's work through an example where self has size 16 and other has size 4.
Here's the method signature:
algebra/poly/src/domain/mod.rs
Lines 284 to 287 in 273bf21
Wish list
other
. Thus, anyone who wants to use this method must cloneother
, which seems wasteful. Instead the type ofother
should be&Self
. But this item is obsoleted by the next item...other
in this implementation is to callother.size()
, which merely returns ausize
struct field. Thus, there is no need for an already-constructedEvaluationDomain
forother
here. Indeed, I suspect a common use of this method is where a caller knows the size ofother
but hasn't actually constructed aEvaluationDomain
for it. In those use cases this method forces the caller to construct anEvaluationDomain
just to call this method. I suggest changing the type ofother
fromSelf
tousize
. In that case it's name should be changed to something likeother_domain_size
.algebra/poly/src/domain/mod.rs
Lines 289 to 292 in 273bf21
can be replaced with something shorter:
// `other` is a subgroup of `self`. Thus, index `i` in `other` is index `i*|self|/|other|` in `self.
algebra/poly/src/domain/mod.rs
Lines 297 to 304 in 273bf21
It's not clear to me why this method should allow
index >= other.size()
. Shouldn't this be an out-of-bounds error?The text was updated successfully, but these errors were encountered: