[Matrix-SIG] int[] -> array (in C)

Henk Jansen H.Jansen@math.tudelft.nl
Thu, 18 Jun 1998 14:56:33 +0200 (METDST)


Bit overwhelmed (and confused) by the variety of array assignment
methods in "arrayobject.c", I just can't work out how to do a simple
thing like this (assignment of ints to an array): 

  ...
  int nd=2, n=100, k=5;
  int shape[nd];
  int tmp[k];

  shape[0] = n;
  shape[1] = k;

  array = (PyArrayObject*)PyArray_FromDims (nd, shape, PyArray_INT);

  for (i=0, i<n, ++i){
	a_func (tmp);       /* just a function which modifies tmp */
        for (j=0, j<k, ++i){

        # and now in Python syntax :

	array[i,:k] = tmp[:k]   /* How to do this in C ??? */

	}
  }

  Can anyone share with me his/her experience?

  Thanks,

  Henk.

-- 
  -----------------------------------------------------------------------
 | Henk Jansen                                hjansen@math.tudelft.nl    |
 | Delft University of Technology             P.O.Box 5031  (Mekelweg 4) |
 | > Information Technoloy and Systems (ITS)  2600 GA  Delft             |
 | >> Mathematics (TWI)                       The Netherlands            |
 | >>> Applied Analysis (TA)                  phone: +31(0)15.278.7295   |
 | >>>> Large Scale Models (WAGM)             fax:   +31(0)15.278.7209   |
  -----------------------------------------------------------------------