[ https://issues.apache.org/jira/browse/FLINK-1937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14516703#comment-14516703 ]
ASF GitHub Bot commented on FLINK-1937: --------------------------------------- GitHub user tillrohrmann opened a pull request: https://github.com/apache/flink/pull/636 [FLINK-1937] [ml] Fixes sparse vector/matrix creation fromCOO with a single element The problem seems to be that Scala apparently cannot infer the correct type of a single tuple in the presence of the overloaded method with the ```Iterable``` type parameter. If one provides more than one element, then Scala knows that only the varargs method is applicable and thus infers that the tuples have to be of type ```(Int, Double)```. One can solve this problem by specifying explicitly that the single tuple is of type ```(Int, Double)```. However, to ensure a nice user experience I added a special case method which takes a single tuple of type ```(Int, Int)``` and converts it into a ```(Int, Double)``` type. You can merge this pull request into a Git repository by running: $ git pull https://github.com/tillrohrmann/flink fixSparseVector Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/636.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #636 ---- commit 2a497a3e42574f5f17e4ec2133b8b7f7ccdd37bb Author: Till Rohrmann <trohrm...@apache.org> Date: 2015-04-28T09:01:07Z [FLINK-1937] [ml] Fixes sparse vector/matrix creation fromCOO with a single element ---- > Cannot create SparseVector with only one non-zero element. > ---------------------------------------------------------- > > Key: FLINK-1937 > URL: https://issues.apache.org/jira/browse/FLINK-1937 > Project: Flink > Issue Type: Bug > Components: Machine Learning Library > Reporter: Chiwan Park > Assignee: Till Rohrmann > Labels: ML > > I tried creating SparseVector with only one non-zero element. But I couldn't > create it. Following code causes the problem. > {code} > val vec2 = SparseVector.fromCOO(3, (1, 1)) > {code} > I got a compile error following: > {code:none} > Error:(60, 29) overloaded method value fromCOO with alternatives: > (size: Int,entries: Iterable[(Int, > Double)])org.apache.flink.ml.math.SparseVector <and> > (size: Int,entries: (Int, Double)*)org.apache.flink.ml.math.SparseVector > cannot be applied to (Int, (Int, Int)) > val vec2 = SparseVector.fromCOO(3, (1, 1)) > ^ > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)