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.
Here's the method signature:
https://github.com/arkworks-rs/algebra/blob/273bf2130420904cab815544664a539f049d0494/poly/src/domain/mod.rs#L284-L287
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
.index >= other.size()
. Shouldn't this be an out-of-bounds error?