Github user hzlyx commented on a diff in the pull request:
https://github.com/apache/spark/pull/3791#discussion_r22268406
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala
---
@@ -173,11 +173,13 @@ object Vectors {
* Creates a sparse vector providing its index array and value array.
*
* @param size vector size.
- * @param indices index array, must be strictly increasing.
- * @param values value array, must have the same length as indices.
+ * @param indices index array.
+ * @param values value array.
*/
- def sparse(size: Int, indices: Array[Int], values: Array[Double]):
Vector =
- new SparseVector(size, indices, values)
+ def sparse(size: Int, indices: Array[Int], values: Array[Double]):
Vector = {
+ val (newIndices, newValues) = indices.zip(values).sortBy(_._1).unzip
--- End diff --
I agree with your method. At least a error should be reported, otherwise
it's hard to locate problems in applications.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]