list - How to convert a sequence variable into a matrix in Scala -


this should easy, i'm stuck. i'm trying convert seq[seq[double]] type breeze densematrix. (all nested seq[double]'s have same number of elements.)

converting single sequence densevector pretty easy:

val sss=seq(2.3,3.4,2.0,1.0) val bbb=densevector(sss:_*) 

is there similar approach convert seq[seq[double]] type densematrix? example:

val sss=seq(2.3,3.4,2.0,1.0) val sssm=seq(sss,sss,sss) val bbb=densevector(sss:_*) //val bbm= densematrix(sssm:_*:??)  //???? 

i noticed same approach works fine:

val sss=seq(2.3,3.4,2.0,1.0) val sssm=seq(sss,sss,sss) val bbb=densevector(sss:_*) val bbm= densematrix(sssm:_*) 

initially had thought need expand each nested sequence well. stated rex kerr, in comment below, breeze library automatically takes care of that.


Comments