3

I'm trying to do vector multiplication using numba vectorize. But instead of having two lists containing int or float type, i have two lists containing objects. I want to do multiplication of the attributes contained in these objects. ie. ob1.attr * ob2*attr where ob1 and ob2 are lists of size N. How do you do this?

  • Also if anyone knows how to use numbapro vectorise can anyone explain how to change the type to accept a class instead of float32. For example I have the function that does vector multiplication to accept type Class instead of only accepting float32 – SunshineAndLove Jan 22 '15 at 02:51
  • I doubt it supports using anything but native types. Either way, the numbers would have to be moved into a continuous array for the gpu. – M4rtini Jan 22 '15 at 03:17
  • I'm working in python so i'm using lists. Is there another way to do fast vector mathematics in python without having to just use native types? – SunshineAndLove Jan 22 '15 at 03:30
  • numpy,numexpr,pycuda,pyopencl,numba (and probably more than i don't know of) all can do fast vector mathemtics. but they all also require the data to be in some form of array\matrix. it's a fundamental requirement for the data to be continious in memory for it to be fast. – M4rtini Jan 22 '15 at 03:39

0 Answers0