Hi,
  I'm wondering how to access elements of a linalg.Vector, e.g:
sparseVector: Seq[org.apache.spark.mllib.linalg.Vector] =
List((3,[1,2],[1.0,2.0]), (3,[0,1,2],[3.0,4.0,5.0]))


scala> sparseVector(1)
res16: org.apache.spark.mllib.linalg.Vector = (3,[0,1,2],[3.0,4.0,5.0])

How to get the indices(0,1,2) and values(3.0,4.0,5.0) of  e.g:
 (3,[0,1,2],[3.0,4.0,5.0]) ?
It will be useful to map them into index->value pairs like:
0->3.0
1->4.0
2->5.0

I could not find such info from:
https://spark.apache.org/docs/1.2.0/api/scala/index.html#org.apache.spark.mllib.linalg.Vector

Thanks.

Cheers,
Dan

Reply via email to