Re: Questions about Vector

2009-06-16 Thread Sean Owen
OK I have ready the changes described in this thread, but I didn't go ahead with removing "quick" methods. It proved to be a very large change, and, there were some situations where it looks like we need to think a little harder about what to do with the resulting code; it's not really just a matte

Re: Questions about Vector

2009-06-15 Thread Ted Dunning
IN fact, setQuick could be viewed as a performance degrading option since it leads people to imagine that they have "optimized" their code. set() is generally inlined and the bounds checks are often lifted out of the loop so there would be no difference. As Sean suggest, however, there is a huge

Re: Questions about Vector

2009-06-15 Thread Benson Margulies
I don't claim that an 'end-user' has much business. Just a class-that-extends. I'll all for your proposed names. Watch out for 'zero' if the 'default' value is in fact configurable. On Mon, Jun 15, 2009 at 7:54 PM, Sean Owen wrote: > Yeah exactly, not entirely clear why the *caller* should care ab

Re: Questions about Vector

2009-06-15 Thread Sean Owen
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 wrote: >

Re: Questions about Vector

2009-06-15 Thread Benson Margulies
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.

Re: Questions about Vector

2009-06-15 Thread Sean Owen
I don't dispute it but what is the use case? I am mostly curious at this point. On Tue, Jun 16, 2009 at 12:40 AM, Benson Margulies wrote: > 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 wrote:

Re: Questions about Vector

2009-06-15 Thread Benson Margulies
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 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

Re: Questions about Vector

2009-06-15 Thread Sean Owen
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 meth

Re: Questions about Vector

2009-06-15 Thread Jeff Eastman
Sean Owen wrote: On Mon, Jun 15, 2009 at 4:17 PM, Jeff Eastman wrote: The difference is getQuick does not check bounds. This does make sense for practical reasons. From an API perspective, seems like it's slightly undesirable to have two of these methods, one of which exists just to by

Re: Questions about Vector

2009-06-15 Thread Sean Owen
On Mon, Jun 15, 2009 at 4:17 PM, Jeff Eastman wrote: > The difference is getQuick does not check bounds. This does make sense for practical reasons. From an API perspective, seems like it's slightly undesirable to have two of these methods, one of which exists just to bypass the checks, as it migh

Re: Questions about Vector

2009-06-15 Thread Jeff Eastman
Sean Owen wrote: While leafing through the Vector API today, I had a few questions... toArray() -- should we really have this? the values, without the dimensions/indices, don't seem necessarily meaningful. It is used in one place, DenseMatrix.assignRow(), but seems like there is a potential bug