[SciPy-Dev] Multilinear interpolation

Pauli Virtanen pav at iki.fi
Mon Feb 25 15:19:17 EST 2013


25.02.2013 22:04, Pablo Winant kirjoitti:
[clip]
> > - The code assumes C-contiguous arrays, but does not check for it.
>
> right

Note that you can make Cython to check for this, the syntax is
sometype[::1] or sometype[:,::1] for multidim (see below).

[clip]
>> You can use fused types instead of templating; the end result is the same,
>> but Cython takes care of picking the correct routine.
>>
> I tried it but I didn't see how to do it. I would like to do define a 
> function like
> 
> def function(ndarray[fused_type, ndim=2]):
>      ...
>      cdef fused_type internal_variable
>      ...
>      return something

The syntax for these arrays is

	cdef fused number_t:
	    double
	    double complex


	def my_function(fused_type[:,:] arg)
	    ...

I think it doesn't work with the (old) np.ndarray syntax.

-- 
Pauli Virtanen




More information about the SciPy-Dev mailing list