The 'numberOfNonDefaultValueElements' is useful. I'd give it an accessor, with, well, that very name.
On Mon, Jun 15, 2009 at 5:20 PM, Sean Owen<sro...@gmail.com> wrote: > OK don't want to push on this last bit too much, but I still see a > small concern here. > > I think it will be error-prone to call this method size(). On Vector, > I would strongly expect that this tells me the logical number of > elements of the vector -- which is its cardinality. This is what > seeing methods like List.size() trains one to expect. It's not that > though, and, right off the bat we already see a bug caused by this. > > One option is renaming. I might further ask, while we're at it, > whether we need to expose both values. When do I need to know the > number of non-zero elements, separately from any other operation? > > To give another example, Vector 'cardinality' maps to List 'size' > right now, and you could say Vector 'size' maps to List 'capacity'. > But List exposes no method regarding its capacity. > > Don't want to push too hard on this; it's a minor thing. But I figure > it's early, and such a key abstraction, that it is worth a bit of > discussion. > > Sean > > On Mon, Jun 15, 2009 at 6:16 PM, Jeff Eastman<j...@windwardsolutions.com> > wrote: >> Whoops, yes, cardinality is intended. Fortunately, the alpha vector in >> Dirichlet is dense so it does not impact correctness, such as it is. >> >> >