Yeah exactly, not entirely clear why the *caller* should care about this; the class should take care of stuff like that.
At least I propose a rename of size() to getNumNonzeroElements() or somesuch, and rename of cardinality() to size(). On Tue, Jun 16, 2009 at 12:46 AM, Benson Margulies<bimargul...@gmail.com> wrote: > Lets say you have an algorithm in which a vector starts out sparse, > but gradually fills in. At some point, you want to give up and switch > to an ordinary vector. This came up in Brown and DiPietro's > entropy-based bigram information word clustering algorithm, and I > think it could come up elsewhere. > > A more complex class based on what you're doing here would use this > value to decide when to give up and use a dense vector instead.