reshape is not working properly or i'm doing something wrong?

已查看 37 次
跳至第一个未读帖子

Tiago Albineli Motta

未读,
2017年9月14日 11:13:222017/9/14
收件人 Scala Breeze

This test is not passing:


    val dense = DenseMatrix(
        DenseVector(1D, 2D, 1D, 2D, 1D, 2D),
        DenseVector(3D, 4D, 3D, 4D, 3D, 4D))

    val reshaped = dense.reshape(6, 2)
    val expected = DenseMatrix(
        DenseVector(1D, 2D),
        DenseVector(1D, 2D),
        DenseVector(1D, 2D),
        DenseVector(3D, 4D),
        DenseVector(3D, 4D),
        DenseVector(3D, 4D))

    Assert.assertEquals(expected, reshaped)


Result in Breeze is:

1.0  2.0  
3.0  4.0  
2.0  1.0  
4.0  3.0  
1.0  2.0  
3.0  4.0


NumPy works fine:

>>> import numpy as np
>>> dense = np.array([[1,2,1,2,1,2], [3,4,3,4,3,4]])
>>> dense.reshape(6,2)
array([[1, 2],
       [1, 2],
       [1, 2],
       [3, 4],
       [3, 4],
       [3, 4]])


I'm using: org.scalanlp:breeze_2.11:0.13.2


I created this issue: https://github.com/scalanlp/breeze/issues/655


David Hall

未读,
2017年9月15日 14:19:282017/9/15
收件人 scala-...@googlegroups.com
Sorry that I didn't unembargo this for so long. I think you got your answer on github.

If I were doing this over again, I'd do default row-major matrices, but that's too big of a change

--
You received this message because you are subscribed to the Google Groups "Scala Breeze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-breeze+unsubscribe@googlegroups.com.
To post to this group, send email to scala-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-breeze/f1a4b445-8657-4dc6-82cd-c9459144ce37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

回复全部
回复作者
转发
0 个新帖子