Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code porting between python and nodejs #111

Open
pedefe opened this issue Jan 7, 2022 · 0 comments
Open

code porting between python and nodejs #111

pedefe opened this issue Jan 7, 2022 · 0 comments

Comments

@pedefe
Copy link

pedefe commented Jan 7, 2022

Hello,
Here is a sample of code in python I want to convert in nodejs.
But there are specific way to describe nparray index in python which not exist in nodejs, for exemple array[ index, :]
Idem for "operator" like + on nparray
Perhaps the dimensions order is different too.

# initialize perturbation rotation
angle = pi / 4
R_true = np.array([[cos(angle), -sin(angle)], [sin(angle),  cos(angle)]])
t_true = np.array([[-2], [5]])
# Generate data as a list of 2d points
num_points = 30
true_data = np.zeros((2, num_points))
true_data[0, :] = range(0, num_points)
true_data[1, :] = 0.2 * true_data[0, :] * np.sin(0.5 * true_data[0, :]) 
# Move the data
moved_data = R_true.dot(true_data) + t_true

Which are the way to convert python with "numjs" ?

Best regard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant