Beispiel #1
0
def test_eigs():
    backend = shell_backend.ShellBackend()
    init = shell_backend.ShellTensor((2, ), np.float64)
    eta, v = backend.eigs(lambda x: x, initial_state=init, numeig=2)
    assert len(eta) == 2
    for n in range(len(eta)):
        assert v[n].shape == (2, )

    def mv(x):
        return x

    eta, v = backend.eigs(mv, shape=(2, ), dtype=np.float64, numeig=2)
    assert len(eta) == 2
    for n in range(len(eta)):
        assert v[n].shape == (2, )
Beispiel #2
0
def test_shell_tensor_reshape():
    shell_tensor = shell_backend.ShellTensor((2, 1), np.float64)
    shell_tensor = shell_tensor.reshape((1, 2))
    assert shell_tensor.shape == (1, 2)