Skip to content

Instantly share code, notes, and snippets.

@bartosz-witkowski
Created April 12, 2014 19:44
Show Gist options
  • Save bartosz-witkowski/10553147 to your computer and use it in GitHub Desktop.
Save bartosz-witkowski/10553147 to your computer and use it in GitHub Desktop.
val _10 = Stream.from(1).take(10)
val data = Stream.continually(_10).take(10).flatten.toArray
// Exiting paste mode, now interpreting.
_10: scala.collection.immutable.Stream[Int] = Stream(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
data: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
scala> :paste
// Entering paste mode (ctrl-D to finish)
val mat = new DenseMatrix(rows = 10, data, offset = 0).t
// Exiting paste mode, now interpreting.
mat: breeze.linalg.DenseMatrix[Int] =
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
scala> :paste
// Entering paste mode (ctrl-D to finish)
val area = mat(3 until 6, 2 until 7)
// Exiting paste mode, now interpreting.
area: breeze.linalg.DenseMatrix[Int] =
3 4 5 6 7
3 4 5 6 7
3 4 5 6 7
scala> :paste
// Entering paste mode (ctrl-D to finish)
area(1 until area.rows, 0 until area.cols)
// Exiting paste mode, now interpreting.
res17: breeze.linalg.DenseMatrix[Int] =
8 9 10 1 2
8 9 10 1 2
@dlwh
Copy link

dlwh commented Apr 13, 2014

bug, sorry, we'll get it fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment