- Thank you received: 0
Numpy interaction
5 years 1 month ago #1910
by bakerk
Numpy interaction was created by bakerk
Hi,
This might seem straight forward but im not too sure. So, I am trying to put a numpy array into a BaseVector, thus far I have been doing so this way:
temp = un1.vec.CreateVector()
for j in range (0,len(un1.vec)):
temp[j] = a[j]
But this is very slow, is there a better way of doing this?
Thanks,
Katie
This might seem straight forward but im not too sure. So, I am trying to put a numpy array into a BaseVector, thus far I have been doing so this way:
temp = un1.vec.CreateVector()
for j in range (0,len(un1.vec)):
temp[j] = a[j]
But this is very slow, is there a better way of doing this?
Thanks,
Katie
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 1 month ago #1911
by christopher
Replied by christopher on topic Numpy interaction
Hi, yes:
Best
Christopher
Code:
temp.FV().NumPy()[:] = a
Best
Christopher
The following user(s) said Thank You: bakerk
Time to create page: 0.100 seconds