Search code examples
scalascala-breeze

DenseMatrix from DenseVector duplications


There is apply method in DenseMatrix object that allows to construct DenseMatrix from rows (breeze 0.11.2). Like an example below:

val dv:DenseVector[Double]
DenseMatrix.apply[DenseVector[Double],Double](
   (for(i <- 0 until dv.activeSize)yield dv) :_ *)

the trouble, that such code needs additional implicit

implicit val rl = new LiteralRow[DenseVector[Double], Double] {
override def foreach[X](row: DenseVector[Double], fn: (Int, Double) => X): Unit = {
  for(i<- 0 until row.iterableSize) {
    fn(i, row(i))
  }
}

override def length(row: DenseVector[Double]): Int = row.iterableSize
}

Any simplier/more correct ways?


Solution

  • it's an oversight. please open a ticket.

    If you have columns, you can use DenseVector.horzcat(columns:_*)