Opened 13 years ago

Closed 12 years ago

#453 closed enhancement (wontfix)

avoid self-assignment of weights in 1D-normalizers

Reported by: Peter Owned by: Peter
Priority: minor Milestone:
Component: normalizer Version: trunk
Keywords: Cc:


All current 1D-normalizers: Centralizer, Gauss, Spearman, and Zscore, all include an assignment of the weights in which the weights are not modified but only copied from input to output. As it is quite common that input range is the same as output range, it makes sense if we could avoid self assignment of the weight part.

Change History (2)

comment:1 Changed 13 years ago by Peter

This seems difficult to accomplish in constant time, and if it can't be done in constant time there is no point in doing it.

The problem boils down to the following: Say that we have some function

template<typename Iterator1, typename Iterator2>
void some_function(Iterator1 first1, Iterator1 last1, Iterator2 first2);

and we want to check if [first1, last1) are pointing to same elements as [first2, first2+ last1-first1). A naive attempt would be to check 'first1==first2', which would work in most cases. Not in all cases though. For example, when having a StrideIterator the strides could be different so although the first element are the same, the following elements are different. Similarly having a boost::permutation_iterator could cause problems.

One could, of course, implement this speed-up and leave this weakness as a documented requirement on input ranges. Of note is that there are already requirements on how the input ranges may overlap: first2+n is not permitted to be pointing to same element as any of (first1+n, last1) (it may be same as first1+n).

comment:2 Changed 12 years ago by Peter

Milestone: yat 0.x+
Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.