def test_reciprocal_out(): var = sc.Variable([Dim.X], values=np.array([1.0, 2.0])) expected = sc.Variable([Dim.X], values=np.array([1.0 / 1.0, 1.0 / 2.0])) out = sc.reciprocal(x=var, out=var) assert var == expected assert out == expected
def test_reciprocal(): a = sc.DataArray(data=sc.Variable(['x'], values=np.array([5.0]))) r = sc.reciprocal(a) assert r.values[0] == 1.0 / 5.0
def test_reciprocal(): var = sc.Variable([Dim.X], values=np.array([1.0, 2.0])) expected = sc.Variable([Dim.X], values=np.array([1.0 / 1.0, 1.0 / 2.0])) assert sc.reciprocal(var) == expected