On 02/08/2011 03:52 AM, Ilya Shlyakhter wrote:
> Is there a portable way to save vector of C++ structs to a binary
> file
C++ structs are not portable, so that sounds difficult. In practice, you
have compiler-specific ways to enforce some alignement within a
structure, but that sounds rather nig
Is there a portable way to save vector of C++ structs to a binary
file, and then
load it as a numpy recarray?
thanks,
ilya
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
On my mac (10.6.5) I'm running python2.6 with numpy 1.5.0.
While using f2py with
f2py -c --fcompiler=gnu95 --f77flags='-m32 -O1 -fno-second-underscore
-fbounds-check' src/mars.pyf src/mars.f
It compiles but has link warnings.
-m32 is not being passed to gcc.
ld: warning: in
/var/folders/k-/k-S
Like the Cython project? Want to get your hands dirty with it?
A great way to do so is to participate in the Cython workshop,
which takes place in Munich, March 30 -- April 3. We are renting
a house to live and work in, and will also give some talks at
a local university, LMU Munich:
http://wiki.
Le 07/02/2011 13:37, josef.p...@gmail.com a écrit :
> n0, n1 = k.shape
> ind0 = np.arange(n0)[:,None]
> ind1 = np.arange(n1)
> q0 = C1[ind0,ind1, k[ind0,ind1]]
>
> or better
> q0 = C1[ind0,ind1, k]
Great!!!
Thanks a lot.
Cheers,
--
Fred
___
NumPy-Dis
On Mon, Feb 7, 2011 at 7:21 AM, Fred wrote:
> Hi all,
>
> Let's say C1 is a 3D array,
> and q0 and k are 2D array.
>
> dim C1 = nx*ny*nz
>
> dim q0 = nx*ny = dim k
>
> I have to do the following:
>
> q0[0, 0] = C1[0, 0, k[0, 0]]
> q0[1, 1] = C1[1, 1, k[1, 1]]
> ...
> q0[i, j] = C1[i, j, k[i, j]]
>
Hi all,
Let's say C1 is a 3D array,
and q0 and k are 2D array.
dim C1 = nx*ny*nz
dim q0 = nx*ny = dim k
I have to do the following:
q0[0, 0] = C1[0, 0, k[0, 0]]
q0[1, 1] = C1[1, 1, k[1, 1]]
...
q0[i, j] = C1[i, j, k[i, j]]
...
I tried
q0 = C1[:, :, k]
but this obviously does not work.
How