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

Please help me!! how to assemble a new array with chumpy object? #17

Open
FLOWERCLOUD opened this issue Mar 10, 2018 · 2 comments
Open

Comments

@FLOWERCLOUD
Copy link

for example:
a = ch.array(5)

Rx = ch.array([[1, 0, 0],
[0, ch.cos(a), -ch.sin(a)],
[0, ch.sin(a), ch.cos(a)]])

but when I change a[0] ,the value in Rx will not change . It seems that my way of array assembly will break the forward-mode
So how can I assemble a new array and still hold the forward mode.

@tneumann
Copy link

It apparently works if you use the vstack, hstack, concatenate or reshape functions, e.g. one possibility with concatenate + reshape would be:

a = ch.array(5)
Rx = ch.concatenate([
  1, 0, 0,  
  0, ch.cos(a), -ch.sin(a),  
  0, ch.sin(a), ch.cos(a)]).reshape(3, 3)

@FLOWERCLOUD
Copy link
Author

that works well ,thank you

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

2 participants