[MATRIX-SIG] Get array elements in c?

Konrad Hinsen hinsen@ibs.ibs.fr
Fri, 26 Dec 1997 09:49:12 +0100


> I need to copy an array to this struct:
> 
> typedef float   Matrix[4][4];

The data layout of this type is just 16 floats, as for a NumPy array
of Float32. As always, there are several ways to do what you want.
Perhaps the clearest is to cast array->data to Matrix and copy as
if you had two Matrix variables. Or just copy 16 floats linearly.
--
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________