performance - Truly vectorized routines in python? -


are there methods in python vectorize matrix data constructs/containers -operations? according data constructs used?

(i observe , read pandas , numpy element-wise operations using vectorize or applymap (may case of apply/apply along axis rows/columns) not of speed progress compared loops. given when trying use them, have mess specificities of datatypes when little bit easier in loops, benefits? readability?)

are there ways achieve gap of performance similar happens in matlab when comparing loops , vectorized operations?

(note not bash numpy or pandas, these great, whole matrix operations ok, when have element-wise operations, becomes slow).

edit explain context:
wondering because received more once answers mentionning fact apply , on similar loops. that's why wondering if there similar functions implemented in such way perform better. actual problems varied. had element-wise, actually, not "doing sum, product, whatever of whole matrix". did lot of comparisons differential outputs based on other matrices, had use complex functions this. since matrices huge , implementation depended on "for loop like" mechanisms, in end felt program not work on more important dataset. hence question. not looking review, knowledge.

you need provide specific example.

normal per-element matlab or python functions cannot vectorized in general. whole point of vectorizing, in both matlab , python, off-load operation onto faster underlying c or fortran libraries designed work on arrays of uniform data. cannot done on functions operate on scalars, either in matlab or python.

for functions operate on arrays or matrices whole (such mathematical operators, sum, square, etc), matlab , python behave same. in fact use of same underlying c , fortran libraries calculations.

so need show actual operation want do, , can see if there way vectorize it.

if working code , want improve performance, code review stack exchange site better choice.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -