[ 
https://issues.apache.org/jira/browse/MAHOUT-1895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15770360#comment-15770360
 ] 

ASF GitHub Bot commented on MAHOUT-1895:
----------------------------------------

Github user rawkintrevo commented on the issue:

    https://github.com/apache/mahout/pull/262
  
    Thanks for the comments @dlyubimov .  Do you mean we should add a method to 
expose 
[this](https://github.com/apache/mahout/blob/master/math/src/main/java/org/apache/mahout/math/DenseVector.java#L29)
 for dense implementations? 
    
    For `SequentialAccessSparseVector` could we [expose the 
`OrderedIntDoubleMapping`](https://github.com/apache/mahout/blob/master/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java#L45)
 underlying and then add a method [to expose `indices` and 
`values`](https://github.com/apache/mahout/blob/master/math/src/main/java/org/apache/mahout/math/OrderedIntDoubleMapping.java#L26)
 then zip them into a Map as a convenience.
    
    Similarly for [`Int2DoubleOpenHashMap` backing `RandomAccessSparseVector`] 
we could [expose 
`values`](https://github.com/apache/mahout/blob/master/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java#L36)
 and then using the interface for 
`it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap` we could [get the 
`keySet()`](http://fastutil.di.unimi.it/docs/it/unimi/dsi/fastutil/ints/Int2DoubleOpenHashMap.html#keySet--)
 and `values` which in turn are 
[`IntSet`](http://fastutil.di.unimi.it/docs/it/unimi/dsi/fastutil/ints/IntSet.html)
 and 
[`DoubleCollection`](http://fastutil.di.unimi.it/docs/it/unimi/dsi/fastutil/doubles/DoubleCollection.html)
 respectively, however both have `toArray()` methods. 
    
    If these are unacceptable, do you have any alternative approaches (and 
apologies if I entirely missed your point regarding the `DenseVector`s)
    
    
    



> Add convenience methods for converting Vectors to Scala types
> -------------------------------------------------------------
>
>                 Key: MAHOUT-1895
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1895
>             Project: Mahout
>          Issue Type: Bug
>    Affects Versions: 0.12.2
>            Reporter: Trevor Grant
>            Assignee: Trevor Grant
>            Priority: Minor
>             Fix For: 0.13.0
>
>
> While dense and sparse vectors may be created from `TraversableOnce[Double]` 
> such as `Array[Double]` and `TraversableOnce[(Int, AnyVal)]` such as 
> `Map[Int,Double]` respectively. Converting back into this format is somewhat 
> tedious.  We should add convenience methods to take care of this. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to