Colt uses a foreachNonZero method that accepts what is essentially a
closure.  This works reasonably well.  A real iterator might be better, but
I can't say, having used only the Colt method.

I can see that having a nonZeroIndexIterator might be a very nice way to do
this.  Ultimately, one approach or the other might play better with the JIT
and inlining, but I definitely wouldn't worry about that yet.


On 4/9/08 9:21 AM, "Isabel Drost (JIRA)" <[EMAIL PROTECTED]> wrote:

> 
>     [ 
> https://issues.apache.org/jira/browse/MAHOUT-20?page=com.atlassian.jira.plugin
> .system.issuetabpanels:comment-tabpanel&focusedCommentId=12587253#action_12587
> 253 ] 
> 
> Isabel Drost commented on MAHOUT-20:
> ------------------------------------
> 
> 
> I guess, I will correct the first point Jeff mentioned on list.
> 
> 
>> One possible alternative might be to add a sort of iterator mechanism in the
>> Vector interface. That would
>> only visit non-null elements.
> 
> +1 to that. Maybe we could add that functionality after the patch is comitted,
> enhance the vector implementation after that? There were a few other points
> that Jeff mentioned. I would rather like to keep this patch focussed on the
> k-Means and Canopy classes and rather not touch the matrix stuff in it.
> 
> The alternative would be to wait with the patch until the proposed
> functionality is available in the matrix stuff.
> 
> 
> 
>> Migrate Canopy and KMeans Implementations to Vectors
>> ----------------------------------------------------
>> 
>>                 Key: MAHOUT-20
>>                 URL: https://issues.apache.org/jira/browse/MAHOUT-20
>>             Project: Mahout
>>          Issue Type: Task
>>          Components: Clustering
>>    Affects Versions: 0.1
>>            Reporter: Jeff Eastman
>>            Assignee: Isabel Drost
>>         Attachments: vectorClustering.txt
>> 
>> 
>> Canopy and KMeans clustering implementations use Float[] representations
>> instead of the new Vector package. They need to be migrated and the Vector
>> package may need some enhancement to support the notion of payloads. This
>> would be a good project for somebody new to the project who wants to get
>> involved. If somebody wants to implement this, just assign the issue to
>> yourself and I will hold off doing it myself.

Reply via email to