Guest7918 has quit [Killed (tepper.freenode.net (Nickname regained by services))]
xcm has joined #pypy
jcea has joined #pypy
Zaab1t has quit [Quit: bye bye friends]
jcea has quit [Remote host closed the connection]
jcea has joined #pypy
scorpion81 has joined #pypy
<scorpion81>
hello, is there a way to actually get structured python lists like [[1,2], [3,4]][[5,6],[7,8]] from cffi in a fast call ? like if you have some nested array cdata, how can you quickly convert it to its structured counterpart in python ? if i manually loop over each dimension, this becomes slower than the calculation in C and in the end slower than a "full" py implementation of the same calculation, lol.
<scorpion81>
would be very handy to have something like array.tolist() like numpy does... (but converting cdata into ndarray via buffers or so "flattens" the array structure)
<mattip>
what does your struct in C look like? How do you know the shape of the underlying flat buffer in C?
ceridwen has joined #pypy
ceridwen has quit [Changing host]
ceridwen has joined #pypy
<scorpion81>
well it is a 3 dimensional array with 2 variable lengths, and the 3rd lengths is 3
<scorpion81>
like float *(*verts)[3]
<scorpion81>
i "know" the structure because i i know how many verts per item and how many items i expect
<scorpion81>
like items * verts_per_item * 3
<mattip>
so get it into a numpy array and reshape it
<mattip>
assuming the memory is contiguous
<scorpion81>
ah, can numpy reshape "flat" arrays again ? (i am kind of newbie in numpy, thats why i ask :) )