Beispiel #1
0
def test_axpy():
    x = np.array([1.0, 2.0, 3.0])
    y = np.array([3.0, 3.0, 3.0])
    z = axpy(3.0, x, y)
    np.testing.assert_array_almost_equal(z, np.array([6.0, 9.0, 12.0]))
    x = np.array([1.0, 2.0, 3.0, 4.0])
    y = np.array([3.0, 3.0, 3.0, 3.0])
    z = axpy(3.0, x, y)
    np.testing.assert_array_almost_equal(z, np.array([6.0, 9.0, 12.0, 15.0]))
Beispiel #2
0
#!/usr/bin/env python

import rust_ext
import numpy as np

x = np.array([1.0, 2.0])
y = np.array([2.0, 3.0])
result = rust_ext.axpy(3, x, y)
print(result)