From 4d3bf194aa395e818fc67230b219f41e454c435f Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Mon, 9 May 2011 11:49:25 -0400 Subject: slight speed increase --- test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test.py') diff --git a/test.py b/test.py index 2ff399c..5c7c234 100644 --- a/test.py +++ b/test.py @@ -17,6 +17,17 @@ def array2float3(arr): return x +def array2float4(arr): + if len(arr.shape) != 2 or arr.shape[-1] != 3: + raise Exception('shape mismatch') + + x = np.empty(arr.shape[0], dtype=gpuarray.vec.float4) + x['x'] = arr[:,0] + x['y'] = arr[:,1] + x['z'] = arr[:,2] + + return x + print 'device %s' % autoinit.device.name() source = open('src/linalg.h').read() + open('src/matrix.h').read() + \ -- cgit