I would say that the iterator that makes sense for all vectors should be default, if there is any default.
Option 1: no default, user must specify which they want (avoids assumptions), Vector is no longer an iterable, but has two methods that return iterables. Option 2: default is all elements, user can select non-zero iterator Option 3: default is non-zero, user can select all element iterator I think that option 2 would surprise users of sparse vectors and 3 would surprise dense vector users. We have proof of the surprise in (2). My vote would be (1) because it is clear what is happening. On Tue, Jun 23, 2009 at 4:07 PM, Sean Owen <sro...@gmail.com> wrote: > Sounds good. Which should be the default (returned from iterator())? > non-zero? > > > On Tue, Jun 23, 2009 at 6:53 PM, Ted Dunning<ted.dunn...@gmail.com> wrote: > > I disagree. > > > > There are two common use cases: iterateAll and iterateNonZero > > > > One example of where iterateAll is different is where I want to get sum_i > > |x_i - z| (as in L_1 clustering). I can't iterate over just non-zero > > elements of x_i unless z is zero (which it is not, in general). > -- Ted Dunning, CTO DeepDyve 111 West Evelyn Ave. Ste. 202 Sunnyvale, CA 94086 http://www.deepdyve.com 858-414-0013 (m) 408-773-0220 (fax)