I have the following code:
trait MyTrait[B] {
def func()
}
class A[B: ClassTag : Zero](val x: SparseVector[B]) extends MyTrait[B] {
def this(x: Seq[(Int,B)]) = this({
val (index, vals) = x.unzip
vals.toArray
new SparseVector[B](index.toArray, vals.toArray, vals.length)
})
def func(): Unit = {}
}
And get a error: No ClassTag available for B
despite the fact that a ClassTag has been added to the generic parameter. What am I missing?
Above SparseVector is a member of the breeze linear algebra package (breeze.linalg
)