Exemplo n.º 1
0
def test_random():
    shape = (3, 5)
    assert Matrix.random(shape, 0, 5, Zeroes()) == Matrix.zeroes(shape)

    assert Matrix.random(shape, 0, 5, Ones()) == Matrix([[1, 1, 1, 1, 1]] * 3)

    assert Matrix.random(shape, 0, 5, Count()) == \
        Matrix([[1, 2, 3, 4, 5],
                [6, 7, 8, 9, 10],
                [11, 12, 13, 14, 15]])
Exemplo n.º 2
0
def test_zeroes():
    zeroes = Matrix.zeroes((3, 2))
    assert zeroes == Matrix([[0, 0]] * 3)
Exemplo n.º 3
0
def test_zeroes_bad_shape():
    Matrix.zeroes((11, 2, 3))