3

I am using a function returning a DenseVector but since yesterday I am not able to read its values as before. Here is the snippet:

val clusters = stsc()
for (i <- 0 until clusters.length) {
    print(clusters(i))
} 

It returns java.lang.AssertionError: assertion failed: List(method apply$mcI$sp, method apply$mcI$sp).

But this snippet works:

val clusters = stsc()
clusters.foreach { print }

And the illogical thing is that this snippet also runs:

val clusters = stsc()
clusters.foreach { print }
for (i <- 0 until clusters.length) {
    print(clusters(i))
}

stsc() always returns the same DenseVector. I do not understand why the first snipped does not work, it seems to me like a bug from Scala. Is there a way to get around it? I am using Scala 2.11.8.

Armand Grillet
  • 3,229
  • 5
  • 30
  • 60

0 Answers0