Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Numpy interaction

More
4 years 6 months 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
More
4 years 6 months ago #1911 by christopher
Replied by christopher on topic Numpy interaction
Hi, yes:
Code:
temp.FV().NumPy()[:] = a

Best
Christopher
The following user(s) said Thank You: bakerk
Time to create page: 0.134 seconds